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.

--

You are currently subscribed to cgal-discuss.

To unsubscribe or access the archives, go to

https://lists-sop.inria.fr/wws/info/cgal-discuss