fixed bug in crease_cut.h + minor changes

This commit is contained in:
Luigi Malomo 2017-07-12 11:59:39 +02:00
parent c9194ae005
commit 014edf0e05
3 changed files with 12 additions and 12 deletions

View File

@ -2,7 +2,7 @@
* VCGLib o o * * VCGLib o o *
* Visual and Computer Graphics Library o o * * Visual and Computer Graphics Library o o *
* _ O _ * * _ O _ *
* Copyright(C) 2004-2016 \/)\/ * * Copyright(C) 2004-2017 \/)\/ *
* Visual Computing Lab /\/| * * Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | * * ISTI - Italian National Research Council | *
* \ * * \ *
@ -25,6 +25,7 @@
#define __VCG_CREASE_CUT #define __VCG_CREASE_CUT
#include<vcg/simplex/face/jumping_pos.h> #include<vcg/simplex/face/jumping_pos.h>
#include<vcg/complex/algorithms/update/normal.h> #include<vcg/complex/algorithms/update/normal.h>
#include<vcg/complex/algorithms/update/flag.h>
namespace vcg { namespace vcg {
namespace tri { namespace tri {
@ -82,7 +83,7 @@ void CutMeshAlongNonFauxEdges(MESH_TYPE &m)
} }
int locCreaseCounter=0; int locCreaseCounter=0;
int curVertexCounter =vertInd; int curVertexCounter=vertInd;
do { // The real Loop do { // The real Loop
size_t faceInd = Index(m,iPos.F()); size_t faceInd = Index(m,iPos.F());
@ -96,13 +97,13 @@ void CutMeshAlongNonFauxEdges(MESH_TYPE &m)
} }
iPos.NextFE(); iPos.NextFE();
} while (startPos!=iPos); } while (startPos!=iPos);
if(locCreaseCounter>0 && (!isBorderVertex) ) newVertexCounter--; if (locCreaseCounter > 0) newVertexCounter--;
//printf("For vertex %i found %i creases\n",vertInd,locCreaseCounter); //printf("For vertex %i found %i creases\n",vertInd,locCreaseCounter);
} }
} // end foreach face/vert } // end foreach face/vert
// Now the indVec vector contains for each the new index of each vertex (duplicated as necessary) // Now the indVec vector contains for each face wedge the new index of each vertex (duplicated as necessary)
// We do a second loop to copy split vertexes into new positions // We do a second loop to copy split vertices into new positions
tri::Allocator<MESH_TYPE>::AddVertices(m,newVertexCounter-m.vn); tri::Allocator<MESH_TYPE>::AddVertices(m,newVertexCounter-m.vn);
tri::UpdateFlags<MESH_TYPE>::VertexClearV(m); tri::UpdateFlags<MESH_TYPE>::VertexClearV(m);
@ -110,11 +111,10 @@ void CutMeshAlongNonFauxEdges(MESH_TYPE &m)
for(int j=0;j<3;++j) for(int j=0;j<3;++j)
{ {
size_t faceInd = Index(m, *fi); size_t faceInd = Index(m, *fi);
size_t vertInd = Index(m, (*fi).V(j));
int curVertexInd = indVec[faceInd*3+ j]; int curVertexInd = indVec[faceInd*3+ j];
assert(curVertexInd != -1); assert(curVertexInd != -1);
assert(curVertexInd < m.vn); assert(curVertexInd < m.vn);
if(curVertexInd < startVn) assert(size_t(curVertexInd) == vertInd); if(curVertexInd < startVn) { assert(size_t(curVertexInd) == Index(m, (*fi).V(j))); }
if(curVertexInd >= startVn) if(curVertexInd >= startVn)
{ {
m.vert[curVertexInd].ImportData(*((*fi).V(j))); m.vert[curVertexInd].ImportData(*((*fi).V(j)));

View File

@ -378,7 +378,7 @@ public:
{ {
int e0,e1; int e0,e1;
bool ret=face::FindSharedEdge(f,*it,e0,e1); bool ret=face::FindSharedEdge(f,*it,e0,e1);
assert(ret); assert(ret); (void)ret;
if(!face::IsBorder(**it,e1)) if(!face::IsBorder(**it,e1))
return false; return false;
} }

View File

@ -64,7 +64,7 @@ namespace vcg{
/** Spatial Hash Table /** Spatial Hash Table
Spatial Hashing as described in Spatial Hashing as described in
"Optimized Spatial Hashing for Coll ision Detection of Deformable Objects", "Optimized Spatial Hashing for Collision Detection of Deformable Objects",
Matthias Teschner and Bruno Heidelberger and Matthias Muller and Danat Pomeranets and Markus Gross Matthias Teschner and Bruno Heidelberger and Matthias Muller and Danat Pomeranets and Markus Gross
*/ */
template < typename ObjType,class FLT=double> template < typename ObjType,class FLT=double>