orient3d.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2019 Qingnan Zhou <[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. #pragma once
  9. #ifndef IGL_PREDICATES_ORIENT3D_H
  10. #define IGL_PREDICATES_ORIENT3D_H
  11. #include "../igl_inline.h"
  12. #include <Eigen/Core>
  13. #include "Orientation.h"
  14. namespace igl {
  15. namespace predicates {
  16. /// Compute the orientation of the tetrahedron formed by pa, pb, pc, pd.
  17. ///
  18. /// @param[in] pa 3D point on plane
  19. /// @param[in] pb 3D point on plane
  20. /// @param[in] pc 3D point on plane
  21. /// @param[in] pd 3D query point
  22. /// @return POSITIVE if pd is "below" the oriented plane formed by pa, pb and pc.
  23. /// NEGATIVE if pd is "above" the plane.
  24. /// COPLANAR if pd is on the plane.
  25. ///
  26. /// \fileinfo
  27. template<typename Vector3D>
  28. IGL_INLINE Orientation orient3d(
  29. const Eigen::MatrixBase<Vector3D>& pa,
  30. const Eigen::MatrixBase<Vector3D>& pb,
  31. const Eigen::MatrixBase<Vector3D>& pc,
  32. const Eigen::MatrixBase<Vector3D>& pd);
  33. /// Compute the orientation of the tetrahedron formed by each 4-tuple of
  34. /// points
  35. ///
  36. /// @param[in] A #P|1 by 3 matrix of 3D points
  37. /// @param[in] B #P|1 by 3 matrix of 3D points
  38. /// @param[in] C #P|1 by 3 matrix of 3D points
  39. /// @param[in] D #P|1 by 3 matrix of 3D points
  40. /// @param[out] R #P vector of orientations
  41. ///
  42. template
  43. <typename DerivedA,
  44. typename DerivedB,
  45. typename DerivedC,
  46. typename DerivedD,
  47. typename DerivedR>
  48. IGL_INLINE void orient3d(
  49. const Eigen::MatrixBase<DerivedA>& A,
  50. const Eigen::MatrixBase<DerivedB>& B,
  51. const Eigen::MatrixBase<DerivedC>& C,
  52. const Eigen::MatrixBase<DerivedD>& D,
  53. Eigen::PlainObjectBase<DerivedR>& R);
  54. }
  55. }
  56. #ifndef IGL_STATIC_LIBRARY
  57. #include "orient3d.cpp"
  58. #endif
  59. #endif