Jump to content
  • Advertisement
Sign in to follow this  

Polygonal Arc Algorithm

This topic is 3302 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

Hi, i want to make a Point-in-Polygon test with following algorithm i found on the internet: int pnpoly(int npol, float *xp, float *yp, float x, float y) { int i, j, c = 0; for (i = 0, j = npol-1; i < npol; j = i++) { if ((((yp <= y) && (y < yp[j])) || ((yp[j] <= y) && (y < yp))) && (x < (xp[j] - xp) * (y - yp) / (yp[j] - yp) + xp)) c = !c; } return c; } the problem is: I need a closed polygon arc, but i only have an array with unsorted points. So i need an algorithm for finding the next point in my polygonal arc(in my array) with the smallest angle and shortest distance to my current polygonal arc point. I hope you know what i mean : / It is similar to the Graham-Scan-Algorithmus for finding the convex hull.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!