• Advertisement
Sign in to follow this  

Polygonal Arc Algorithm

This topic is 3039 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
Advertisement
Sign in to follow this  

  • Advertisement