| Home | Libraries | People | FAQ | More

##### BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES

Macro to register a box.

###### Description

The macro BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES registers a box such that it is recognized by Boost.Geometry and that Boost.Geometry functionality can used with the specified type.

###### Synopsis

    #define BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(Box, Point, Left,
                                            Bottom, Right, Top)

###### Parameters

Name | Description
--- | ---
Box | Box type to be registered
Point | Point type reported as point_type by box. Must be two dimensional. Note that these box tyeps do not contain points, but they must have a related point_type
Left | Left side (must be public member or method)
Bottom | Bottom side (must be public member or method)
Right | Right side (must be public member or method)
Top | Top side (must be public member or method)

###### Header

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

###### Example

Show the use of the macro BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES

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

    struct my_point
    {
        int x, y;
    };

    struct my_box
    {
        int left, top, right, bottom;
    };

    BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, int, cs::cartesian, x, y)

    // Register the box type, also notifying that it is based on "my_point"
    // (even if it does not contain it)
    BOOST_GEOMETRY_REGISTER_BOX_2D_4VALUES(my_box, my_point, left, top, right, bottom)

    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