Reputation: 6193
assumed I have a rectangle:
A------B
| |
| |
D------C
Normally this rectangle is formed by an array of coordinates A-B-C-D-A which describe a closed polygon.
Now I do not have such an array but a bunch of separate lines B-A, D-A, B-C-D. When drawing both, the result is always the same rectangle but in second case much more data are used for it. So I want to rearrange and optimise the second case in order to get one single array of coordinates as in first case.
My question: is this possible somehow with boost::geometry or boost::polygon? If yes, how can this be done? If no: any other possibilities?
Thanks!
Upvotes: 1
Views: 135
Reputation: 2098
No, there is no algorithm for this in Boost.Geometry.
However there are things that might help you with writing your own:
boost::geometry::equals()
- check if a point is equal to another one, this is done WRT machine epsilon so you may consider using your own version strictly comparing coordinatesboost::geometry::intersects()
- check if a linestring intersects some other oneboost::geometry::index::rtree<>
- speed up the searching process
boost::geometry::envelope()
- calculate a bounding box of a linestringboost::geometry::correct()
- check the orientation of a polygon/ring and reverse to match the type definitionboost::geometry::is_valid()
- verify if the polygon/ring is valid (e.g. the edges don't cross other edges)Upvotes: 1