point_in_poly.h 847 B

1234567891011121314151617181920212223242526272829
  1. #ifndef IGL_POINT_IN_POLY_H
  2. #define IGL_POINT_IN_POLY_H
  3. #include "igl_inline.h"
  4. #include <vector>
  5. namespace igl
  6. {
  7. // Determine if 2d point is inside a 2D polygon
  8. // Inputs:
  9. // poly vector of polygon points, [0]=x, [1]=y.
  10. // Polyline need not be closed (i.e. first point != last point),
  11. // the line segment between last and first selected points is constructed
  12. // within this function.
  13. // x x-coordinate of query point
  14. // y y-coordinate of query point
  15. // Returns true if query point is in polygon, false otherwise
  16. // from http://www.visibone.com/inpoly/
  17. bool IGL_INLINE point_in_poly( const std::vector<std::vector<unsigned int > >&poly,
  18. const unsigned int xt,
  19. const unsigned int yt);
  20. }
  21. #ifdef IGL_HEADER_ONLY
  22. # include "point_in_poly.cpp"
  23. #endif
  24. #endif