C++ Boost


Point

Overview

A point defines the location of a pixel inside an image. It can also be used to describe the dimensions of an image. In most general terms, points are N-dimensional and model the following concept:

concept PointNDConcept<typename T> : Regular<T>
{
    // the type of a coordinate along each axis
    template <size_t K> struct axis; where Metafunction<axis>;

    const size_t num_dimensions;

    // accessor/modifier of the value of each axis.
    template <size_t K> const typename axis<K>::type& T::axis_value() const;
    template <size_t K>       typename axis<K>::type& T::axis_value();
};

GIL uses a two-dimensional point, which is a refinement of PointNDConcept in which both dimensions are of the same type:

concept Point2DConcept<typename T> : PointNDConcept<T>
{
    where num_dimensions == 2;
    where SameType<axis<0>::type, axis<1>::type>;

    typename value_type = axis<0>::type;

    const value_type& operator[](const T&, size_t i);
        value_type& operator[](      T&, size_t i);

    value_type x,y;
};

Models

GIL provides a model of Point2DConcept, point<T> where T is the coordinate type.