14#include <lagrange/common.h>
18template <
typename Po
intType>
19auto compute_barycentric_coordinates(
20 const Eigen::MatrixBase<PointType>& v0,
21 const Eigen::MatrixBase<PointType>& v1,
22 const Eigen::MatrixBase<PointType>& v2,
23 const Eigen::MatrixBase<PointType>& p) -> Eigen::Matrix<typename PointType::Scalar, 3, 1>
25 using Scalar =
typename PointType::Scalar;
26 const auto dim = p.size();
27 Eigen::Matrix<Scalar, 3, 3> M;
29 M.block(0, 0, dim, 1) = v0;
30 M.block(0, 1, dim, 1) = v1;
31 M.block(0, 2, dim, 1) = v2;
32 Eigen::Matrix<Scalar, 3, 1> rhs;
34 rhs.segment(0, dim) = p;
35 return (M.inverse() * rhs).eval();
Main namespace for Lagrange.
Definition: AABBIGL.h:30