Skip to content

Instantly share code, notes, and snippets.

@kgabis
Created January 30, 2013 19:15
Show Gist options
  • Select an option

  • Save kgabis/4675885 to your computer and use it in GitHub Desktop.

Select an option

Save kgabis/4675885 to your computer and use it in GitHub Desktop.
int point2d_nquad_of_rectangled_old(Point2D point, RectangleD rect) {
int i;
for (i = 0; i < 4; i++) {
if (point2d_is_in_rectangled(point, rectangled_nquad(rect, i))) {
return i;
}
}
return -1;
}
GS_INLINE int point2d_nquad_of_rectangled_new(Point2D p, RectangleD r) { //added middle to RectangleD
return ((p.y >= r.middle.y) << 1) | (p.x >= r.middle.x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment