Subject: CGAL users discussion list
List archive
- From: Sandeep Dey <>
- To:
- Subject: Re: [cgal-discuss] Re: Segment Inside a Polygon
- Date: Fri, 3 Feb 2012 14:04:42 +0100
Hi,
If we consider that segment lies completely inside polygon means: that end point of segment is also inside polygon and not on the boundary then the query can be answered by writing a similar function bounded_side_2.
Actually if the 1st end point of the segment is inside the polygon then shooting the ray directing towards other end point of the segment can answer the query,
In case there is any intersection before reaching the other end point, then for sure the segment is not inside the polygon.
And if there is no intersection then the segment is inside the polygon.
Now if we want to consider a point on the boundary of polygon to be inside the polygon, we need one extra check for the special case as shown in your figure:
We can do the following:
The case when both the end points are on the boundary of polygon , and no other intersection taken place between two end points,
we need to do one more check, take any point in the line segment say mean of the two end points, then if this point lies outside polygon then the segment also lies outside polygon,
else the whole segment is inside the polygon.
Regards,
Sandeep.
On Fri, Feb 3, 2012 at 11:03 AM, pgiitu <> wrote:
Hello Sandeep,
Thanks for the help but I would like to emphasize that point inside a
polygon and line segment inside a polygon are two very different problems.
Even after counting the no. of intersections it is not possible to tell
whether the whole line segment is inside the polygon or not.
For Ex consider the following image in the file
http://cgal-discuss.949826.n4.nabble.com/file/n4354159/imagepdf.pdf
imagepdf.pdf
For the two red line segments the no of intersections are the same in every
case. so The no of intersections thing will not work.
--
View this message in context: http://cgal-discuss.949826.n4.nabble.com/Segment-Inside-a-Polygon-tp4352456p4354159.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- [cgal-discuss] Segment Inside a Polygon, pgiitu, 02/02/2012
- Re: [cgal-discuss] Segment Inside a Polygon, Sandeep Dey, 02/02/2012
- Re: [cgal-discuss] Segment Inside a Polygon, Sandeep Dey, 02/02/2012
- [cgal-discuss] Re: Segment Inside a Polygon, pgiitu, 02/03/2012
- Re: [cgal-discuss] Re: Segment Inside a Polygon, Sandeep Dey, 02/03/2012
- Re: [cgal-discuss] Re: Segment Inside a Polygon, Sebastien Loriot (GeometryFactory), 02/03/2012
- [cgal-discuss] Re: Segment Inside a Polygon, pgiitu, 02/03/2012
- [cgal-discuss] Re: Segment Inside a Polygon, pgiitu, 02/03/2012
- [cgal-discuss] Re: Segment Inside a Polygon, pgiitu, 02/03/2012
- Re: [cgal-discuss] Re: Segment Inside a Polygon, Sebastien Loriot (GeometryFactory), 02/03/2012
- Re: [cgal-discuss] Re: Segment Inside a Polygon, Sandeep Dey, 02/03/2012
- [cgal-discuss] Re: Segment Inside a Polygon, pgiitu, 02/03/2012
- Re: [cgal-discuss] Segment Inside a Polygon, Sandeep Dey, 02/02/2012
- Re: [cgal-discuss] Segment Inside a Polygon, Sandeep Dey, 02/02/2012
Archive powered by MHonArc 2.6.16.