|
@@ -54,12 +54,12 @@ IGL_INLINE void igl::cut_mesh(
|
|
|
igl::triangle_triangle_adjacency(F,FF,FFi);
|
|
igl::triangle_triangle_adjacency(F,FF,FFi);
|
|
|
|
|
|
|
|
// store current number of occurance of each vertex as the alg proceed
|
|
// store current number of occurance of each vertex as the alg proceed
|
|
|
- Eigen::Matrix<Index,Eigen::Dynamic,1> o(V.rows());
|
|
|
|
|
- o.setConstant(1);
|
|
|
|
|
|
|
+ Eigen::Matrix<Index,Eigen::Dynamic,1> occurence(V.rows());
|
|
|
|
|
+ occurence.setConstant(1);
|
|
|
|
|
|
|
|
- // set target number of occurance of each vertex
|
|
|
|
|
- Eigen::Matrix<Index,Eigen::Dynamic,1> g(V.rows());
|
|
|
|
|
- g.setZero();
|
|
|
|
|
|
|
+ // set eventual number of occurance of each vertex expected
|
|
|
|
|
+ Eigen::Matrix<Index,Eigen::Dynamic,1> eventual(V.rows());
|
|
|
|
|
+ eventual.setZero();
|
|
|
for(Index i=0;i<F.rows();i++){
|
|
for(Index i=0;i<F.rows();i++){
|
|
|
for(Index k=0;k<3;k++){
|
|
for(Index k=0;k<3;k++){
|
|
|
if(C(i,k) == 1){
|
|
if(C(i,k) == 1){
|
|
@@ -67,8 +67,8 @@ IGL_INLINE void igl::cut_mesh(
|
|
|
Index v = F(i,(k+1)%3);
|
|
Index v = F(i,(k+1)%3);
|
|
|
if(FF(i,k) == -1) continue;
|
|
if(FF(i,k) == -1) continue;
|
|
|
if(u > v) continue; // only compute every (undirected) edge ones
|
|
if(u > v) continue; // only compute every (undirected) edge ones
|
|
|
- g(u) += 1;
|
|
|
|
|
- g(v) += 1;
|
|
|
|
|
|
|
+ eventual(u) += 1;
|
|
|
|
|
+ eventual(v) += 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -76,7 +76,7 @@ IGL_INLINE void igl::cut_mesh(
|
|
|
auto is_border = igl::is_border_vertex(F);
|
|
auto is_border = igl::is_border_vertex(F);
|
|
|
for(Index i=0;i<V.rows();i++)
|
|
for(Index i=0;i<V.rows();i++)
|
|
|
if(is_border[i])
|
|
if(is_border[i])
|
|
|
- g(i) += 1;
|
|
|
|
|
|
|
+ eventual(i) += 1;
|
|
|
|
|
|
|
|
// original number of vertices
|
|
// original number of vertices
|
|
|
Index n_v = V.rows();
|
|
Index n_v = V.rows();
|
|
@@ -84,7 +84,7 @@ IGL_INLINE void igl::cut_mesh(
|
|
|
// estimate number of new vertices and resize V
|
|
// estimate number of new vertices and resize V
|
|
|
Index n_new = 0;
|
|
Index n_new = 0;
|
|
|
for(Index i=0;i<g.rows();i++)
|
|
for(Index i=0;i<g.rows();i++)
|
|
|
- n_new += ((g(i) > 0) ? g(i)-1 : 0);
|
|
|
|
|
|
|
+ n_new += ((eventual(i) > 0) ? eventual(i)-1 : 0);
|
|
|
V.conservativeResize(n_v+n_new,Eigen::NoChange);
|
|
V.conservativeResize(n_v+n_new,Eigen::NoChange);
|
|
|
I = DerivedI::LinSpaced(V.rows(),0,V.rows());
|
|
I = DerivedI::LinSpaced(V.rows(),0,V.rows());
|
|
|
|
|
|
|
@@ -94,7 +94,7 @@ IGL_INLINE void igl::cut_mesh(
|
|
|
for(Index k=0;k<3;k++){
|
|
for(Index k=0;k<3;k++){
|
|
|
Index v0 = F(f,k);
|
|
Index v0 = F(f,k);
|
|
|
if(F(f,k) >= n_v) continue; // ignore new vertices
|
|
if(F(f,k) >= n_v) continue; // ignore new vertices
|
|
|
- if(C(f,k) == 1 && o(v0) != g(v0)){
|
|
|
|
|
|
|
+ if(C(f,k) == 1 && occurence(v0) != eventual(v0)){
|
|
|
igl::HalfEdgeIterator<DerivedF,DerivedF,DerivedF> he(F,FF,FFi,f,k);
|
|
igl::HalfEdgeIterator<DerivedF,DerivedF,DerivedF> he(F,FF,FFi,f,k);
|
|
|
|
|
|
|
|
// rotate clock-wise around v0 until hit another cut
|
|
// rotate clock-wise around v0 until hit another cut
|
|
@@ -113,7 +113,7 @@ IGL_INLINE void igl::cut_mesh(
|
|
|
V.row(pos) << V.row(v0);
|
|
V.row(pos) << V.row(v0);
|
|
|
I(pos) = v0;
|
|
I(pos) = v0;
|
|
|
// add one occurance to v0
|
|
// add one occurance to v0
|
|
|
- o(v0) += 1;
|
|
|
|
|
|
|
+ occurence(v0) += 1;
|
|
|
|
|
|
|
|
// replace old v0
|
|
// replace old v0
|
|
|
for(Index f0: fan)
|
|
for(Index f0: fan)
|