# Point of Intersection

• January 9th 2009, 06:31 AM
dinaharchery
Point of Intersection
Hello everyone. I am new to this forum and have a simple question (at least I hope it is simple).

I have a segment defined by two points (P0 and P1) and a convex polygon defined by a set of vertices n. I would like to know how to find the point of intersection (if it exists) for the segment and the convex polygon - can anyone help me?

BTW, the points for both the segment and the convex polygon are defined in X, Y, and Z coordinate space and the segment could be parallel to the plane containing the convex polygon.

Thank you.
• January 9th 2009, 09:38 AM
dinaharchery
Just to be sure, attached is a simple JPEG of what I would like to accomplish. I would like to calculate the actual point between P0 and P1 that intersects the polygon.

Thank you.
• January 9th 2009, 10:27 AM
HallsofIvy
This is complicated but it is the simplest way I can think of. Each of the sides of the polygon can be written as a linear equation. You can check to determine if one of the points is "inside" the polygon and the other "outside
(if an edge is ax+ by+ c= 0, then $(x_0,y_0)$ and $(x_1,y_1)$ are on the same side if $ax_0+ by_0+ c$ has the same sign as $ax_1+ by_1+ c$.) Once you have determined that the two points are outside and inside the polygon you can determine where the line between them intersect a side.