segment_segment_intersect.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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_inline.h"
  11. #include "predicates.h"
  12. #include <Eigen/Core>
  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. /// @param[in] A: 1st endpoint of segment 1
  21. /// @param[in] B: 2st endpoint of segment 1
  22. /// @param[in] C: 1st endpoint of segment 2
  23. /// @param[in] D: 2st endpoint of segment 2
  24. /// @return true if they intersect
  25. template <typename DerivedP>
  26. IGL_INLINE bool segment_segment_intersect(
  27. const Eigen::MatrixBase<DerivedP>& A,
  28. const Eigen::MatrixBase<DerivedP>& B,
  29. const Eigen::MatrixBase<DerivedP>& C,
  30. const Eigen::MatrixBase<DerivedP>& D
  31. );
  32. }
  33. }
  34. #ifndef IGL_STATIC_LIBRARY
  35. # include "segment_segment_intersect.cpp"
  36. #endif
  37. #endif