BOOST_GEOMETRY_REGISTER_BOX

| Home | Libraries | People | FAQ | More

##### BOOST_GEOMETRY_REGISTER_BOX

Macro to register a box.

###### Description

The macro BOOST_GEOMETRY_REGISTER_BOX registers a box such that it is recognized by Boost.Geometry and that Boost.Geometry functionality can used with the specified type. The box may contain template parameters, which must be specified then.

###### Synopsis

    #define BOOST_GEOMETRY_REGISTER_BOX(Box, Point, MinCorner,
                                 MaxCorner)

###### Parameters

Name | Description
--- | ---
Box | Box type to be registered
Point | Point type on which box is based. Might be two or three-dimensional
MinCorner | minimum corner (should be public member or method)
MaxCorner | maximum corner (should be public member or method)

###### Header

`#include <boost/geometry/geometries/register/box.hpp>`

###### Example

Show the use of the macro BOOST_GEOMETRY_REGISTER_BOX

    #include <iostream>
    #include <boost/geometry.hpp>
    #include <boost/geometry/geometries/register/point.hpp>
    #include <boost/geometry/geometries/register/box.hpp>

    struct my_point
    {
        double x, y;
    };

    struct my_box
    {
        my_point ll, ur;
    };

    // Register the point type
    BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y)

    // Register the box type, also notifying that it is based on "my_point"
    BOOST_GEOMETRY_REGISTER_BOX(my_box, my_point, ll, ur)

    int main()
    {
        my_box b = boost::geometry::make<my_box>(0, 0, 2, 2);
        std::cout << "Area: "  << boost::geometry::area(b) << std::endl;
        return 0;
    }

Output:

    Area: 4