computational geometry - CGAL: Intersection between a segment and a polygon? -
i have set of polygons , want test intersection between , segment. checked manual cannot find matching function. intersection between points, lines, segments, triangles, planes exist. , intersection between polygons there. question is:
- is there such function?
- if not, mean need break down polygons segments , intersection among these segments? (the reason reluctant is, thought cgal might in fact use way intersections between polygons. how come there no such function intersecting line , polygon?) or there other better way it?
the easiest method create polygon_set_2 object may contain several polygons. test intersection of external polygon set apply do_intersect method.
for example:
typedef cgal::polygon_set_2<kernel, std::vector<kernel::point_2>> polygon_set_2; polygon_set_2 ps; polygon_2 poly; polygon_2 line; // line polygon defined 2 points ps.insert(poly); bool intersect = ps.do_intersect(line);
more on polygon_set_2:
- http://www.cgal.org/manual/3.2/doc_html/cgal_manual/boolean_set_operations_2_ref/class_general_polygon_set_2.html
- http://www.cgal.org/manual/3.2/doc_html/cgal_manual/boolean_set_operations_2_ref/class_polygon_set_2.html
i hope it's clear, kiril
Comments
Post a Comment