Opened 12 years ago

Closed 12 years ago

#4868 closed Bugs (fixed)

Boost::Polygon Polygon Concept contains function

Reported by: altanbileg <altanbileg@…> Owned by: Lucanus Simonson
Milestone: Boost 1.46.0 Component: polygon
Version: Boost 1.44.0 Severity: Problem
Keywords: Polygon Cc:

Description

bool Boost::Polygon::contains(const T&, const point_type& point, bool consider_touch=true) functions doesn't give right answer when type is Polygon. Example: Point pts[] = {gtl::construct<Point>(1565, 5735),

gtl::construct<Point>(915, 5735), gtl::construct<Point>(915, 7085), gtl::construct<Point>(1565, 7085) };

Polygon poly; gtl::set_points(poly, pts, pts+4); bool ret=gtl::contains(poly,gtl::construct<Point>(920, 7080));

The result must be true. But it is false.

Change History (1)

comment:1 by Lucanus Simonson, 12 years ago

Milestone: To Be DeterminedBoost 1.46.0
Resolution: fixed
Status: newclosed

The problem was that in the manhattan version of contains the algorithm assumed counter clockwise winding for the polygon. This mean that clockwise polygons gave inverted result for their interior. The fix is the check the winding of the polygon and invert the result if clockwise in the case where the point wasn't on the boundary.

Note: See TracTickets for help on using tickets.