point_inside_convex_polygon.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2019 Hanxiao Shen <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_PREDICATES_POINT_INSIDE_CONVEX_POLYGON_H
  9. #define IGL_PREDICATES_POINT_INSIDE_CONVEX_POLYGON_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include "predicates.h"
  13. namespace igl
  14. {
  15. namespace predicates
  16. {
  17. /// check whether 2d point lies inside 2d convex polygon
  18. /// @param[in] P: n*2 polygon, n >= 3
  19. /// @param[in] q: 2d query point
  20. /// @return true if point is inside polygon
  21. template <typename DerivedP, typename DerivedQ>
  22. IGL_INLINE bool point_inside_convex_polygon(
  23. const Eigen::MatrixBase<DerivedP>& P,
  24. const Eigen::MatrixBase<DerivedQ>& q
  25. );
  26. }
  27. }
  28. #ifndef IGL_STATIC_LIBRARY
  29. # include "point_inside_convex_polygon.cpp"
  30. #endif
  31. #endif