Failure of boost::geometry::within for polygons

Dear experts

As this title, I failed boost::geometry::within, some are succeeded but the others are failed.

I wonder if boost::geometry::within has specification for polygons, such as ordering (clockwise, or anti-clockwise), start & end points must be the same.

If you have the same experience, or have how to cope with this problem,
I would appreciate it if you could help me.

Kind regards
@Mitsuru, when you say "failed", what do you mean?

Can you give examples of which ones "failed"?

Note that any test point "on" the boundary of a polygon is necessarily going to raise questions about
- floating-point accuracy
- the definition of "inside" or "outside" for something which is "on the boundary of"

If you are worried about clockwise/anticlockwise traversal then simply try what happens with both. Similarly for closed/non-closed.

I suspect that non-convex polygon inside non-convex polygon is a bit of a nightmare anyway. You could have all vertices of the child polygon inside the parent, yet some parts of its area outside. Personally, I would try to avoid non-convex polygons: you can break them down into convex components, ultimately into triangles.
Last edited on
Topic archived. No new replies allowed.