fixed bug in crease_cut.h + minor changes
This commit is contained in:
parent
c9194ae005
commit
014edf0e05
|
@ -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 {
|
||||||
|
|
||||||
|
@ -49,11 +50,11 @@ void CreaseCut(MESH_TYPE &m, float angleRad)
|
||||||
template<class MESH_TYPE>
|
template<class MESH_TYPE>
|
||||||
void CutMeshAlongNonFauxEdges(MESH_TYPE &m)
|
void CutMeshAlongNonFauxEdges(MESH_TYPE &m)
|
||||||
{
|
{
|
||||||
typedef typename MESH_TYPE::FaceIterator FaceIterator;
|
typedef typename MESH_TYPE::FaceIterator FaceIterator;
|
||||||
typedef typename MESH_TYPE::FaceType FaceType;
|
typedef typename MESH_TYPE::FaceType FaceType;
|
||||||
|
|
||||||
tri::Allocator<MESH_TYPE>::CompactVertexVector(m);
|
tri::Allocator<MESH_TYPE>::CompactVertexVector(m);
|
||||||
tri::Allocator<MESH_TYPE>::CompactFaceVector(m);
|
tri::Allocator<MESH_TYPE>::CompactFaceVector(m);
|
||||||
tri::RequireFFAdjacency(m);
|
tri::RequireFFAdjacency(m);
|
||||||
|
|
||||||
tri::UpdateFlags<MESH_TYPE>::VertexClearV(m);
|
tri::UpdateFlags<MESH_TYPE>::VertexClearV(m);
|
||||||
|
@ -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)));
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue