Jump to content

Ray-casting algorithm: Difference between revisions

m
Line 517:
{
/* should assert p->n > 1 */
int i, k, crosses, intersectResult;
vec *pv;
double min_x, max_x, min_y, max_y;
 
for (i = 0; i < p->n; i++) {
k = (i + 1) % p->n;
min_x = dist(v, p->v[i], p->v[k], tol);
if (min_x < tol) return 0;
Line 553:
for (i = 0; i < p->n; i++) {
k = (i + 1) % p->n;
kintersectResult = intersect(v, e, p->v[i], p->v[k], tol, 0);
 
/* picked a bad point, ray got too close to vertex.
re-pick */
if (!kintersectResult) break;
 
if (kintersectResult == 1) crosses++;
}
if (i == p->n) break;
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.