// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2014 Daniele Panozzo // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "frame_to_cross_field.h" #include #include 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; // Generate local basis MatrixXd B1, B2, B3; igl::local_basis(V,F,B1,B2,B3); // Project the frame fields in the local basis 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 > 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 // Explicit template instantiation #endif