Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: Segment Inside a Polygon

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: Segment Inside a Polygon


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Segment Inside a Polygon
  • Date: Fri, 03 Feb 2012 14:12:17 +0100

On 02/03/2012 02:04 PM, Sandeep Dey wrote:
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.
In that case it is not sufficient, (the midpoint can be inside the polygon but not the segment itself). In that case, I think you need to check if each polygon segments is intersected in its interior by the
query segment.

Sebastien.


Regards,

Sandeep.





On Fri, Feb 3, 2012 at 11:03 AM, pgiitu
<
<mailto:>>
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






Archive powered by MHonArc 2.6.16.

Top of Page