![]() |
Home | Libraries | People | FAQ | More |
The macro BOOST_GEOMETRY_REGISTER_RING registers a ring such that it is recognized by Boost.Geometry and that Boost.Geometry functionality can be used with the specified type. The ring may contain template parameters, which must be specified then. Optionally accepts Clockwise, or Clockwise and Closed, to specify orientation and closure. Closure stays at the default when omitted.
#define BOOST_GEOMETRY_REGISTER_RING(...)
|
Name |
Description |
|---|---|
|
... |
ring type to be registered, |
#include <boost/geometry/geometries/register/ring.hpp>
Show the use of the macro BOOST_GEOMETRY_REGISTER_RING
#include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/register/ring.hpp> using point_2d = boost::geometry::model::d2::point_xy<double>; BOOST_GEOMETRY_REGISTER_RING(std::vector<point_2d>)int main() { // Normal usage of std:: std::vector<point_2d> ring; ring.push_back(point_2d(1, 1)); ring.push_back(point_2d(2, 2)); ring.push_back(point_2d(2, 1)); // Usage of Boost.Geometry boost::geometry::correct(ring); std::cout << "Area: " << boost::geometry::area(ring) << std::endl; std::cout << "WKT: " << boost::geometry::wkt(ring) << std::endl; return 0; }
Output:
Area: 0.5 WKT: POLYGON((1 1,2 2,2 1,1 1))