| Home | Libraries | People | FAQ | More

#### dimension

Metafunction defining value as the number of coordinates (the number of axes of any geometry) of the point type making up the specified geometry type.

###### Synopsis

    template<typename Geometry>
    struct dimension
          : public core_dispatch::dimension< tag< Geometry >::type, geometry::util::bare_type< Geometry >::type >
    {
      // ...
    };

###### Template parameter(s)

Parameter | Description
--- | ---
typename Geometry | Any type fulfilling a Geometry Concept

###### Header

`#include <boost/geometry/core/coordinate_dimension.hpp>`

###### Complexity

Compile time

###### Example

Examine the number of coordinates making up the points in a linestring type

    #include <iostream>

    #include <boost/geometry.hpp>
    #include <boost/geometry/geometries/linestring.hpp>
    #include <boost/geometry/geometries/adapted/boost_tuple.hpp>

    BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian);

    int main()
    {
        int dim = boost::geometry::dimension
            <
                boost::geometry::model::linestring
                    <
                        boost::tuple<float, float, float>
                    >
            >::value;

        std::cout << "dimensions: " << dim << std::endl;

        return 0;
    }

Output:

    dimensions: 3