|
@@ -26,7 +26,7 @@ void igl::polyvector_field_one_ring_matchings(const Eigen::PlainObjectBase<Deriv
|
|
|
//first, check if the vertex is on a boundary
|
|
|
//then there must be two faces that are on the boundary
|
|
|
//(other cases not supported)
|
|
|
-
|
|
|
+
|
|
|
int fstart = -1;
|
|
|
int ind = 0;
|
|
|
for (int i =0; i<VF[vi].size(); ++i)
|
|
@@ -52,7 +52,7 @@ void igl::polyvector_field_one_ring_matchings(const Eigen::PlainObjectBase<Deriv
|
|
|
fi[i] = current_face;
|
|
|
for (int j=0; j<half_degree; ++j)
|
|
|
mvi(i,j) = j;
|
|
|
-
|
|
|
+
|
|
|
int next_face = -1;
|
|
|
while (next_face != fstart && current_face!=-1)
|
|
|
{
|
|
@@ -65,17 +65,17 @@ void igl::polyvector_field_one_ring_matchings(const Eigen::PlainObjectBase<Deriv
|
|
|
break;
|
|
|
}
|
|
|
assert(j!=-1);
|
|
|
-
|
|
|
+
|
|
|
next_face = TT(current_face, j);
|
|
|
++i;
|
|
|
-
|
|
|
+
|
|
|
if (next_face == -1)
|
|
|
mvi.row(i).setConstant(-1);
|
|
|
else
|
|
|
{
|
|
|
// look at the edge between the two faces
|
|
|
const int ¤t_edge = F2E(current_face,j);
|
|
|
-
|
|
|
+
|
|
|
for (int k=0; k<half_degree; ++k)
|
|
|
{
|
|
|
// check its orientation to determine whether match_ab or match_ba should be used
|
|
@@ -109,17 +109,17 @@ IGL_INLINE void igl::polyvector_field_singularities_from_matchings(
|
|
|
const Eigen::PlainObjectBase<DerivedM> &match_ba,
|
|
|
Eigen::PlainObjectBase<DerivedS> &singularities)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
std::vector<bool> V_border = igl::is_border_vertex(V,F);
|
|
|
std::vector<std::vector<int> > VF, VFi;
|
|
|
igl::vertex_triangle_adjacency(V,F,VF,VFi);
|
|
|
-
|
|
|
+
|
|
|
Eigen::MatrixXi TT, TTi;
|
|
|
igl::triangle_triangle_adjacency(F,TT,TTi);
|
|
|
-
|
|
|
+
|
|
|
Eigen::MatrixXi E, E2F, F2E;
|
|
|
igl::edge_topology(V,F,E,F2E,E2F);
|
|
|
-
|
|
|
+
|
|
|
igl::polyvector_field_singularities_from_matchings(V, F, V_border, VF, TT, E2F, F2E, match_ab, match_ba, singularities);
|
|
|
}
|
|
|
|
|
@@ -136,9 +136,9 @@ IGL_INLINE void igl::polyvector_field_singularities_from_matchings(
|
|
|
const Eigen::PlainObjectBase<DerivedM> &match_ba,
|
|
|
Eigen::PlainObjectBase<DerivedS> &singularities)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
int numV = V.rows();
|
|
|
-
|
|
|
+
|
|
|
std::vector<int> singularities_v;
|
|
|
int half_degree = match_ab.cols();
|
|
|
for (int vi =0; vi<numV; ++vi)
|
|
@@ -149,7 +149,7 @@ IGL_INLINE void igl::polyvector_field_singularities_from_matchings(
|
|
|
Eigen::VectorXi fi;
|
|
|
Eigen::MatrixXi mvi;
|
|
|
igl::polyvector_field_one_ring_matchings(V, F, VF, E2F, F2E, TT, match_ab, match_ba, vi, mvi, fi);
|
|
|
-
|
|
|
+
|
|
|
int num = fi.size();
|
|
|
//pick one of the vectors to check for singularities
|
|
|
for (int vector_to_match = 0; vector_to_match < half_degree; ++vector_to_match)
|
|
@@ -164,7 +164,7 @@ IGL_INLINE void igl::polyvector_field_singularities_from_matchings(
|
|
|
std::sort(singularities_v.begin(), singularities_v.end());
|
|
|
auto last = std::unique(singularities_v.begin(), singularities_v.end());
|
|
|
singularities_v.erase(last, singularities_v.end());
|
|
|
-
|
|
|
+
|
|
|
igl::list_to_matrix(singularities_v, singularities);
|
|
|
}
|
|
|
|
|
@@ -178,17 +178,17 @@ IGL_INLINE void igl::polyvector_field_singularities_from_matchings(
|
|
|
Eigen::PlainObjectBase<DerivedS> &singularities,
|
|
|
Eigen::PlainObjectBase<DerivedS> &singularity_indices)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
std::vector<bool> V_border = igl::is_border_vertex(V,F);
|
|
|
std::vector<std::vector<int> > VF, VFi;
|
|
|
igl::vertex_triangle_adjacency(V,F,VF,VFi);
|
|
|
-
|
|
|
+
|
|
|
Eigen::MatrixXi TT, TTi;
|
|
|
igl::triangle_triangle_adjacency(V,F,TT,TTi);
|
|
|
-
|
|
|
+
|
|
|
Eigen::MatrixXi E, E2F, F2E;
|
|
|
igl::edge_topology(V,F,E,F2E,E2F);
|
|
|
-
|
|
|
+
|
|
|
igl::polyvector_field_singularities_from_matchings(V, F, V_border, VF, TT, E2F, F2E, match_ab, match_ba, singularities, singularity_indices);
|
|
|
}
|
|
|
|
|
@@ -207,24 +207,28 @@ IGL_INLINE void igl::polyvector_field_singularities_from_matchings(
|
|
|
Eigen::PlainObjectBase<DerivedS> &singularity_indices)
|
|
|
{
|
|
|
igl::polyvector_field_singularities_from_matchings(V, F, V_border, VF, TT, E2F, F2E, match_ab, match_ba, singularities);
|
|
|
-
|
|
|
+
|
|
|
singularity_indices.setZero(singularities.size(), 1);
|
|
|
-
|
|
|
+
|
|
|
//get index from first vector only
|
|
|
int vector_to_match = 0;
|
|
|
for (int i =0; i<singularities.size(); ++i)
|
|
|
{
|
|
|
int vi = singularities[i];
|
|
|
-
|
|
|
- Eigen::VectorXi mvi,fi;
|
|
|
- igl::polyvector_field_one_ring_matchings(V, F, VF, E2F, F2E, TT, match_ab, match_ba, vi, vector_to_match, mvi, fi);
|
|
|
-
|
|
|
- singularity_indices[i] = (mvi.tail(1)[0] - vector_to_match);
|
|
|
+
|
|
|
+ // Eigen::VectorXi mvi,fi;
|
|
|
+ // igl::polyvector_field_one_ring_matchings(V, F, VF, E2F, F2E, TT, match_ab, match_ba, vi, vector_to_match, mvi, fi);
|
|
|
+ Eigen::VectorXi fi;
|
|
|
+ Eigen::MatrixXi mvi;
|
|
|
+ igl::polyvector_field_one_ring_matchings(V, F, VF, E2F, F2E, TT, match_ab, match_ba, vi, mvi, fi);
|
|
|
+
|
|
|
+ singularity_indices[i] = (mvi(mvi.rows()-1,vector_to_match) - vector_to_match);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#ifdef IGL_STATIC_LIBRARY
|
|
|
// Explicit template specialization
|
|
|
template void igl::polyvector_field_singularities_from_matchings<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
|
|
+template void igl::polyvector_field_singularities_from_matchings<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::__1::vector<bool, std::__1::allocator<bool> > const&, std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
|
|
|
#endif
|