segment_segment_intersect.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 "predicates.h"
  13. namespace igl
  14. {
  15. namespace predicates
  16. {
  17. // Given two segments in 2d test whether they intersect each other
  18. // using predicates 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. // Returns true if they intersect
  26. template <typename DerivedP>
  27. IGL_INLINE bool segment_segment_intersect(
  28. // input:
  29. const Eigen::MatrixBase<DerivedP>& A,
  30. const Eigen::MatrixBase<DerivedP>& B,
  31. const Eigen::MatrixBase<DerivedP>& C,
  32. const Eigen::MatrixBase<DerivedP>& D
  33. );
  34. }
  35. }
  36. #ifndef IGL_STATIC_LIBRARY
  37. # include "segment_segment_intersect.cpp"
  38. #endif
  39. #endif //IGL_PREDICATES_SEGMENT_SEGMENT_INTERSECT_H