Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] get segment from polygon edge

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] get segment from polygon edge


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] get segment from polygon edge
  • Date: Mon, 29 Aug 2016 09:55:07 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:UnzsbBHI6VRvx+jZIYZs5p1GYnF86YWxBRYc798ds5kLTJ75r8iwAkXT6L1XgUPTWs2DsrQf2rOQ7/urAzxQqdbZ6TZZIcQKD0dEwewt3CUYSPafDkP6KPO4JwcbJ+9lEGFfwnegLEJOE9z/bVCB6le77DoVBwmtfVEtfre9JIfegoyN2vyo/NWLOkMT1WP7Peg5dkXm5UWJ749N0NMkcv5wgjLy4VJwM9xMwm1pIV/B1z3d3eyXuKBZziJLpvg6/NRBW6ipN44xTLhfESh0ezttvJ6j5lH/Sl6E6XIYF2kXiRFVGBPt7RfgX563vDGpmPB63XzQBsD8RKsoWDmkp4NsUh7vlG9HGDM+9WzLkN1ehalHpwiw5lY3l5XQZ5uUM+Y4e6f1ctYTRG4HVcFUAX8SSrigZpcCWrJSdd1TqJPw8gMD
  • Organization: GeometryFactory

It is not clear what you are looking for. You're talking about checking
if an intersection exists but then you seem to be looking for the
intersection of a domain bounded by a polygon with a segment.
In the latter case, you need to get all intersection points with the polygon segments and sort them by distance from the point that is
known to be inside the polygon. Then each pair of consecutive point
(including the endpoint inside the polygon) is part of the intersection
with the domain. If no intersection is found then the result is the
whole query segment.

Sebastien.

On 08/29/2016 02:02 AM, Mateus Bellomo wrote:
Hello,

I have a Kernel::Segment_2 r which one of it's vertex is inside a
GAL::Polygon_2<Kernel> p. I need to check if this segment r intersects
one of polygon edges.

Right now I'm trying to do this:

for(Polygon_edge_const_iterator e = p.edges_begin(); e !=
p.edges_end(); e++){
auto result = intersection(r, e);
if(result){
Point_2* p = boost::get<Point_2>(&*result);
return *p;
}
}

but I know it's not working because I need to get a segment from the
edge. Anyone could help me to do this, please?

Thanks in advance!




Archive powered by MHonArc 2.6.18.

Top of Page