12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include "frame_to_cross_field.h"
- #include <igl/local_basis.h>
- #include <igl/dot_row.h>
- IGL_INLINE void igl::frame_to_cross_field(
- const Eigen::MatrixXd& V,
- const Eigen::MatrixXi& F,
- const Eigen::MatrixXd& FF1,
- const Eigen::MatrixXd& FF2,
- Eigen::MatrixXd& X)
- {
- using namespace Eigen;
-
- MatrixXd B1, B2, B3;
- igl::local_basis(V,F,B1,B2,B3);
-
- MatrixXd d1, d2;
- d1.resize(F.rows(),2);
- d2.resize(F.rows(),2);
- d1 << igl::dot_row(B1,FF1), igl::dot_row(B2,FF1);
- d2 << igl::dot_row(B1,FF2), igl::dot_row(B2,FF2);
- X.resize(F.rows(), 3);
- for (int i=0;i<F.rows();i++)
- {
- Vector2d v1 = d1.row(i);
- Vector2d v2 = d2.row(i);
-
- Matrix2d A;
- A << v1[0], v2[0],
- v1[1], v2[1];
-
- Eigen::JacobiSVD<Matrix<double,2,2> > svd(A, Eigen::ComputeFullU | Eigen::ComputeFullV );
- Matrix2d C = svd.matrixU() * svd.matrixV().transpose();
- Vector2d v = C.col(0);
- X.row(i) = v(0) * B1.row(i) + v(1) * B2.row(i);
- }
- }
- #ifdef IGL_STATIC_LIBRARY
- #endif
|