point.rst 1.4 KB

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