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: Pol Monsó Purtí <>
  • To:
  • Subject: Re: [cgal-discuss] Intersection between segment and polygon
  • Date: Thu, 28 Jul 2016 11:12:20 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:7mPlMBHSpHLZNeXkd9TKBZ1GYnF86YWxBRYc798ds5kLTJ75pMuwAkXT6L1XgUPTWs2DsrQf2rKQ7f+rADVIyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWD14LpiKvrotX6WEZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwu3cYh/V0/MFJVeD2fr8zUKdDJDUgKWE8osPx5jfZSg7a3nwYGkARlAHTSzDY9g1/FsP1tjb8v6x73zeTFcLzRLEwHz+l6vE4G1fTlC4bOmthoynsgctqgfcDrQ==

I remember reading another post claiming a two point degenerate polygon had some issues since one of the latest cgal versions. I couldn't find it again thought, so I might be utterly wrong.

The issue is that I have rays as well, which I can't turn into a degenerate polygon. I'll just take the iteration approach then.

Efficiency is not really an issue, I don't have to perform the operation that many times.

Thanks nonetheless Monique. I think I'll try out turning the segment into a polygon for curiosity.

On Thu, Jul 28, 2016 at 11:02 AM, Monique Teillaud <> wrote:
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