• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Point
2=====
3
4.. contents::
5   :local:
6   :depth: 2
7
8Overview
9--------
10
11A point defines the location of a pixel inside an image. It can also be used
12to describe the dimensions of an image. In most general terms, points are
13N-dimensional and model the following concept:
14
15.. code-block:: cpp
16
17  concept PointNDConcept<typename T> : Regular<T>
18  {
19      // the type of a coordinate along each axis
20      template <size_t K> struct axis; where Metafunction<axis>;
21
22      const size_t num_dimensions;
23
24      // accessor/modifier of the value of each axis.
25      template <size_t K> const typename axis<K>::type& T::axis_value() const;
26      template <size_t K>       typename axis<K>::type& T::axis_value();
27  };
28
29GIL uses a two-dimensional point, which is a refinement of ``PointNDConcept``
30in which both dimensions are of the same type:
31
32.. code-block:: cpp
33
34  concept Point2DConcept<typename T> : PointNDConcept<T>
35  {
36      where num_dimensions == 2;
37      where SameType<axis<0>::type, axis<1>::type>;
38
39      typename value_type = axis<0>::type;
40
41      const value_type& operator[](const T&, size_t i);
42          value_type& operator[](      T&, size_t i);
43
44      value_type x,y;
45  };
46
47.. seealso::
48
49  - `PointNDConcept <reference/structboost_1_1gil_1_1_point_n_d_concept.html>`_
50  - `Point2DConcept <reference/structboost_1_1gil_1_1_point2_d_concept.html>`_
51
52Models
53------
54
55GIL provides a model of ``Point2DConcept``, ``point<T>`` where ``T`` is the
56coordinate type.
57