|
@@ -15,6 +15,7 @@
|
|
|
#include <sstream>
|
|
|
|
|
|
#include "tutorial_shared_path.h"
|
|
|
+#include <igl/serialize.h>
|
|
|
|
|
|
// Input mesh
|
|
|
Eigen::MatrixXd V;
|
|
@@ -38,13 +39,13 @@ Eigen::MatrixXd BIS1, BIS2;
|
|
|
Eigen::MatrixXd BIS1_combed, BIS2_combed;
|
|
|
|
|
|
// Per-corner, integer mismatches
|
|
|
-Eigen::MatrixXi MMatch;
|
|
|
+Eigen::Matrix<int, Eigen::Dynamic, 3> MMatch;
|
|
|
|
|
|
// Field singularities
|
|
|
-Eigen::VectorXi isSingularity, singularityIndex;
|
|
|
+Eigen::Matrix<int, Eigen::Dynamic, 1> isSingularity, singularityIndex;
|
|
|
|
|
|
// Per corner seams
|
|
|
-Eigen::MatrixXi Seams;
|
|
|
+Eigen::Matrix<int, Eigen::Dynamic, 3> Seams;
|
|
|
|
|
|
// Combed field
|
|
|
Eigen::MatrixXd X1_combed, X2_combed;
|
|
@@ -234,50 +235,50 @@ int main(int argc, char *argv[])
|
|
|
// Load a mesh in OFF format
|
|
|
igl::readOFF(TUTORIAL_SHARED_PATH "/3holes.off", V, F);
|
|
|
|
|
|
+ double gradient_size = 50;
|
|
|
+ double iter = 0;
|
|
|
+ double stiffness = 5.0;
|
|
|
+ bool direct_round = 0;
|
|
|
+ std::string filename = "/Users/daniele/x.dat";
|
|
|
+
|
|
|
// Compute face barycenters
|
|
|
igl::barycenter(V, F, B);
|
|
|
|
|
|
// Compute scale for visualizing fields
|
|
|
global_scale = .5*igl::avg_edge_length(V, F);
|
|
|
|
|
|
+ // Contrain one face
|
|
|
+ VectorXi b(1);
|
|
|
+ b << 0;
|
|
|
+ MatrixXd bc(1, 3);
|
|
|
+ bc << 1, 0, 0;
|
|
|
|
|
|
- // Contrain one face
|
|
|
- VectorXi b(1);
|
|
|
- b << 0;
|
|
|
- MatrixXd bc(1,3);
|
|
|
- bc << 1, 0, 0;
|
|
|
-
|
|
|
- // Create a smooth 4-RoSy field
|
|
|
- VectorXd S;
|
|
|
- igl::copyleft::comiso::nrosy(V,F,b,bc,VectorXi(),VectorXd(),MatrixXd(),4,0.5,X1,S);
|
|
|
+ // Create a smooth 4-RoSy field
|
|
|
+ VectorXd S;
|
|
|
+ igl::copyleft::comiso::nrosy(V, F, b, bc, VectorXi(), VectorXd(), MatrixXd(), 4, 0.5, X1, S);
|
|
|
|
|
|
- // Find the the orthogonal vector
|
|
|
- MatrixXd B1,B2,B3;
|
|
|
- igl::local_basis(V,F,B1,B2,B3);
|
|
|
- X2 = igl::rotate_vectors(X1, VectorXd::Constant(1,M_PI/2), B1, B2);
|
|
|
-
|
|
|
- double gradient_size = 50;
|
|
|
- double iter = 0;
|
|
|
- double stiffness = 5.0;
|
|
|
- bool direct_round = 0;
|
|
|
+ // Find the the orthogonal vector
|
|
|
+ MatrixXd B1, B2, B3;
|
|
|
+ igl::local_basis(V, F, B1, B2, B3);
|
|
|
+ X2 = igl::rotate_vectors(X1, VectorXd::Constant(1, M_PI / 2), B1, B2);
|
|
|
|
|
|
- // Always work on the bisectors, it is more general
|
|
|
- igl::compute_frame_field_bisectors(V, F, X1, X2, BIS1, BIS2);
|
|
|
+ // Always work on the bisectors, it is more general
|
|
|
+ igl::compute_frame_field_bisectors(V, F, X1, X2, BIS1, BIS2);
|
|
|
|
|
|
- // Comb the field, implicitly defining the seams
|
|
|
- igl::comb_cross_field(V, F, BIS1, BIS2, BIS1_combed, BIS2_combed);
|
|
|
+ // Comb the field, implicitly defining the seams
|
|
|
+ igl::comb_cross_field(V, F, BIS1, BIS2, BIS1_combed, BIS2_combed);
|
|
|
|
|
|
- // Find the integer mismatches
|
|
|
- igl::cross_field_missmatch(V, F, BIS1_combed, BIS2_combed, true, MMatch);
|
|
|
+ // Find the integer mismatches
|
|
|
+ igl::cross_field_missmatch(V, F, BIS1_combed, BIS2_combed, true, MMatch);
|
|
|
|
|
|
- // Find the singularities
|
|
|
- igl::find_cross_field_singularities(V, F, MMatch, isSingularity, singularityIndex);
|
|
|
+ // Find the singularities
|
|
|
+ igl::find_cross_field_singularities(V, F, MMatch, isSingularity, singularityIndex);
|
|
|
|
|
|
- // Cut the mesh, duplicating all vertices on the seams
|
|
|
- igl::cut_mesh_from_singularities(V, F, MMatch, Seams);
|
|
|
+ // Cut the mesh, duplicating all vertices on the seams
|
|
|
+ igl::cut_mesh_from_singularities(V, F, MMatch, Seams);
|
|
|
|
|
|
- // Comb the frame-field accordingly
|
|
|
- igl::comb_frame_field(V, F, X1, X2, BIS1_combed, BIS2_combed, X1_combed, X2_combed);
|
|
|
+ // Comb the frame-field accordingly
|
|
|
+ igl::comb_frame_field(V, F, X1, X2, BIS1_combed, BIS2_combed, X1_combed, X2_combed);
|
|
|
|
|
|
// Global parametrization
|
|
|
igl::copyleft::comiso::miq(V,
|