barycentric_coordinates.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
  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_BARYCENTRIC_COORDINATES_H
  9. #define IGL_BARYCENTRIC_COORDINATES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Compute barycentric coordinates in a tet
  15. //
  16. // Inputs:
  17. // P #P by 3 Query points in 3d
  18. // A #P by 3 Tet corners in 3d
  19. // B #P by 3 Tet corners in 3d
  20. // C #P by 3 Tet corners in 3d
  21. // D #P by 3 Tet corners in 3d
  22. // Outputs:
  23. // L #P by 4 list of barycentric coordinates
  24. //
  25. template <
  26. typename DerivedP,
  27. typename DerivedA,
  28. typename DerivedB,
  29. typename DerivedC,
  30. typename DerivedD,
  31. typename DerivedL>
  32. IGL_INLINE void barycentric_coordinates(
  33. const Eigen::PlainObjectBase<DerivedP> & P,
  34. const Eigen::PlainObjectBase<DerivedA> & A,
  35. const Eigen::PlainObjectBase<DerivedB> & B,
  36. const Eigen::PlainObjectBase<DerivedC> & C,
  37. const Eigen::PlainObjectBase<DerivedD> & D,
  38. Eigen::PlainObjectBase<DerivedL> & L);
  39. }
  40. #ifdef IGL_HEADER_ONLY
  41. # include "barycentric_coordinates.cpp"
  42. #endif
  43. #endif