🔒 Locked
Polygon Intersection
Advertisement
Original Post
Hi! I have two arbitrary polygons . When there is an intersection between these polygons, the first polygon should cut off the intersection area of the second polygon. To give a better experience I have drawn some example pics: Pic1 Pic2 Pic3 Pic4 Pic5 Pic6 Pic7 The red cicled vertices have to be added to the 2. polygon. The green cicled vertices have to be deleated. I am able to calculate these vertices already, but the problem is how to connect the new red vertices. Now the problem is that I don't know how to connect the red vertices, as I can't determine the sequence. I have drawn another example to emphasize the problem. There are many new red points which should be added to the polygon, but I can't determine in which sequence. Pic8 If I haven't something precisely explained, please let me know.. Thanks in advance. [Edited by - NMO on March 11, 2007 3:21:03 PM]
Based on your drawings alone, it's hard to tell if the polygons are coplanar. Are they arbitrarily oriented in 3D space, or are they coplanar?
I would say that you should start by detecting the intersections of the line segments formed by adjacent points on the polygons. Once you have found those you can eliminate the interior ones.
Lets see.
Add the intersection points to both of the polygons. (this means plus one point on the line segment)
Store wich points on the polys are from intersection.
Now start to traverse through the points of one of the poly.
Start with an interior point, and go CCW.
while (not got back to the starting point) do
_go to the next point
_if (this point is an intersection point) then continue with traversing the other poly //(jump to the corrsponding point on the other poly)
end loop
I made a "comic" for better understanding.
Add the intersection points to both of the polygons. (this means plus one point on the line segment)
Store wich points on the polys are from intersection.
Now start to traverse through the points of one of the poly.
Start with an interior point, and go CCW.
while (not got back to the starting point) do
_go to the next point
_if (this point is an intersection point) then continue with traversing the other poly //(jump to the corrsponding point on the other poly)
end loop
I made a "comic" for better understanding.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement