segment_segment_intersect.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_SEGMENT_SEGMENT_INTERSECT_H
  9. #define IGL_PREDICATES_SEGMENT_SEGMENT_INTERSECT_H
  10. #include <igl/igl_inline.h>
  11. #include <Eigen/Core>
  12. #include <igl/predicates/predicates.h>
  13. namespace igl
  14. {
  15. namespace predicates
  16. {
  17. // Given two segments in 2d test whether they intersect each other
  18. // using orient2D
  19. //
  20. // Inputs:
  21. // A: 1st endpoint of segment 1
  22. // B: 2st endpoint of segment 1
  23. // C: 1st endpoint of segment 2
  24. // D: 2st endpoint of segment 2
  25. // eps: precision used for colinear case
  26. // Returns true if they intersect
  27. template <typename DerivedP>
  28. IGL_INLINE bool segment_segment_intersect(
  29. // input:
  30. const Eigen::MatrixBase<DerivedP>& A,
  31. const Eigen::MatrixBase<DerivedP>& B,
  32. const Eigen::MatrixBase<DerivedP>& C,
  33. const Eigen::MatrixBase<DerivedP>& D
  34. );
  35. }
  36. }
  37. #ifndef IGL_STATIC_LIBRARY
  38. # include "segment_segment_intersect.cpp"
  39. #endif
  40. #endif //IGL_PREDICATES_SEGMENT_SEGMENT_INTERSECT_H