1
votes

I need to make some polygon computation on 2D plan. Typically, isInside operation.

I found boost::Polygon API but my points are inside a single big array. That's I call indexed geometry. See http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-9-vbo-indexing/

So my best way is just to boost::Polygon and give to it my array + indices of points to use.

The objective is just to don't copy my million of points (because they are shared at least by two polygons).

I don't know if API allows it ( or I need to inherit my own class :-( ). Maybe, someone know another API (inside boost or other).

Thanks

Documentation

1
I know it might not be sufficient answer for you but I would recomment two things: - if you work with such big data, then before sending it anywhere outside you could try to implement some basic validation by yourself, for your case - it's known that "isInside" operation will be false if any pair of segments from two polygons intersects, you might try to implement intersection check -if any occurs you know that isInside is false - try to use PgSQLJacek Rosłan
It always works better to show some code. Even if it's just a simplified example (SSCCE)sehe

1 Answers

1
votes

Boost Geometry allows for adapted user-defined data types.

Specifically, C arrays are adapted here: https://www.boost.org/doc/libs/1_68_0/boost/geometry/geometries/adapted/c_array.hpp

I have another answer up where I show how to use Boost Geometry algorithms on a direct C array of structs (in that case I type punned using tuple as the point type): How to calculate the convex hull with boost from arrays instead of setting each point separately? (the other answers show alternatives that may be easier if you can afford to copy some data).

The relevant algorithms would be: