25 const Eigen::PlainObjectBase<DerivedF> &F,
26 Eigen::PlainObjectBase<DerivedC> &C)
29 using namespace Eigen;
33 assert(F.cols() == 3);
37 Matrix<typename DerivedC::Scalar, Dynamic, 3> l2;
40 Matrix<typename DerivedC::Scalar, Dynamic, 3>
l;
41 l = l2.array().sqrt();
44 Matrix<typename DerivedC::Scalar, Dynamic, 1> dblA;
49 for (
int i = 0; i < m; i++) {
50 C(i, 0) = (l2(i, 1) + l2(i, 2) - l2(i, 0)) / dblA(i) / 4.0;
51 C(i, 1) = (l2(i, 2) + l2(i, 0) - l2(i, 1)) / dblA(i) / 4.0;
52 C(i, 2) = (l2(i, 0) + l2(i, 1) - l2(i, 2)) / dblA(i) / 4.0;
57inline void cotmatrix(
const Eigen::PlainObjectBase<DerivedV> &
V,
58 const Eigen::PlainObjectBase<DerivedF> &F,
59 Eigen::SparseMatrix<Scalar> &
L)
61 using namespace Eigen;
64 L.resize(
V.rows(),
V.rows());
65 Matrix<int, Dynamic, 2> edges;
67 assert(F.cols() == 3);
72 L.reserve(10 *
V.rows());
74 edges << 1, 2, 2, 0, 0, 1;
77 Matrix<Scalar, Dynamic, Dynamic>
C;
81 IJV.reserve(F.rows() * edges.rows() * 4);
83 for (
int i = 0; i < F.rows(); i++) {
85 for (
int e = 0;
e < edges.rows();
e++) {
86 int source =
F(i, edges(
e, 0));
87 int dest =
F(i, edges(
e, 1));
94 L.setFromTriplets(IJV.begin(), IJV.end());