Jump to content
  • Advertisement
Sign in to follow this  

point of intersection with 2D polygons

This topic is 3274 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Supposedly there are 2 polygon, let's say they are both convex, and supposedly they are colliding with each other. How do i find where are they colliding? Basically i want a way to find the intersection(s) of their edges. ~thanks

Share this post


Link to post
Share on other sites
Advertisement
Intersection of convex polygons is implemented in the Wm4ConvexPolygon2.* files at my Mathematics page. In particular, look at the functions FindIntersection (intersection of two convex polygons) and FindAllIntersections (intersection of multiple convex polygons). The algorithm uses clipping one polygon against each edge of the other polygon. (There is an asymptotically faster method; see Joseph O'Rourke's book "Computational Geometry in C".)

Share this post


Link to post
Share on other sites
I am using Java to program, but that shouldn't matter since programming languages are alike, but one think i don't get is that the findIntersection method returns a boolean, but what I am trying to find a the point at where they intersect, not if they are intersecting or not.

Share this post


Link to post
Share on other sites
The 'bool' return indicates whether or not there is an intersection. The last parameter of the function is an "output" parameter and stores the convex polygon of intersection. The simplest choice for a point of intersection is one of the output polygon's vertices.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!