Boost logo

Geometry :

Subject: [geometry] How far should I expect to get with points that are "values"?
From: Patrick J. LoPresti (lopresti_at_[hidden])
Date: 2014-07-15 21:21:37


I usually like value semantics, especially for tiny classes like
points. So I do not provide the ability to set the components of my
point objects.

What parts of Boost.Geometry should I expect to work and not to work
for me? For example, this code fails to compile:

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

struct MyPoint {
  int x,y;
};

BOOST_GEOMETRY_REGISTER_POINT_2D_CONST(MyPoint, int, cs::cartesian, x, y);

namespace bg = boost::geometry;

MyPoint make(int x, int y)
{
  return bg::make<MyPoint>(1, 2);
}

If I use the "BOOST_GEOMETRY_REGISTER_POINT_2D" version (without the
CONST), it works fine... But that is not an option for my actual class
where I have no setters for the components.

In particular, will a bg::index::rtree, holding rectangles and using
rectangle queries, work OK? (I notice that "intersects()" works for my
boxes but "intersection()" does not...)

Of course, I can add setters to my points if necessary.

Thanks!

 - Pat


Geometry list run by mateusz at loskot.net