Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Intersection between segment and polygon

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Intersection between segment and polygon


Chronological Thread 
  • From: Monique Teillaud <>
  • To:
  • Subject: Re: [cgal-discuss] Intersection between segment and polygon
  • Date: Thu, 28 Jul 2016 11:02:46 +0200

On 28 Jul 2016, at 10:31, Pol Monsó Purtí <> wrote:

CGAL::intersect and do_intersect take segments, rays, squares... but not polygon_2.

Indeed, because intersect is in the CGAL Kernel(s), which only handle(s) constant-size objects, by definition. 

And the reverse for Polygon_2 intersection functions, who only takes polygons.

How do you usually solve this, iterating over the segments of the polygon + checking if the ends are inside? 

Sounds reasonable. 
Alternatively, if you want to use the intersection function of polygons, you can also create another polygon from the two vertices of the segment, then intersect the two polygons. Not sure about efficiency (I don’t precisely know how the intersection of 2 polygons is implemented). 

--
Monique Teillaud 
https://members.loria.fr/Monique.Teillaud/
INRIA Nancy - Grand Est, LORIA 
Institut National de Recherche en Informatique et Automatique 




Archive powered by MHonArc 2.6.18.

Top of Page