Updated to reflect the Normal() -> TriangleNormal() change

Updated to reflect the changes to the UpdateFlags (new function names ::VertexBorderFromFaceAdj ::VertexBorderFromFaceBorder)
This commit is contained in:
Paolo Cignoni 2014-11-12 00:14:23 +00:00
parent 4b0e72293f
commit 9d89004760
8 changed files with 224 additions and 222 deletions

View File

@ -377,7 +377,7 @@ class Clustering
// the best orientation according to the averaged normal
if(!DuplicateFaceParam)
{
CoordType N=vcg::Normal(m.face[i]);
CoordType N=TriangleNormal(m.face[i]);
int badOrient=0;
if( N.dot((*ti).v[0]->N()) <0) ++badOrient;
if( N.dot((*ti).v[1]->N()) <0) ++badOrient;

View File

@ -66,7 +66,7 @@ template <class MESH> class AdvancingFront {
UpdateFlags<MESH>::FaceBorderFromNone(mesh);
UpdateFlags<MESH>::VertexBorderFromFace(mesh);
UpdateFlags<MESH>::VertexBorderFromFaceBorder(mesh);
nb.clear();
nb.resize(mesh.vert.size(), 0);
@ -343,7 +343,7 @@ public:
protected:
void AddFace(int v0, int v1, int v2) {
FaceIterator fi = vcg::tri::Allocator<MESH>::AddFace(mesh,v0,v1,v2);
ComputeNormalizedNormal(*fi);
fi->N() = TriangleNormal(*fi).Normalize();
if(tri::HasVFAdjacency(mesh))
{
for(int j=0;j<3;++j)

View File

@ -376,7 +376,7 @@ void SphericalCap(MeshType &in, float angleRad, const int subdiv = 3 )
tri::Refine(in, MidPoint<MeshType>(&in));
tri::UpdateFlags<MeshType>::FaceBorderFromFF(in);
tri::UpdateFlags<MeshType>::VertexBorderFromFace(in);
tri::UpdateFlags<MeshType>::VertexBorderFromFaceBorder(in);
for(int i=0;i<in.vn;++i)
if(in.vert[i].IsB())
@ -1015,6 +1015,7 @@ void BuildPrismFaceShell(MeshType &mIn, MeshType &mOut, float height=0, float in
typedef typename MeshType::CoordType CoordType;
if(height==0) height = mIn.bbox.Diag()/100.0f;
if(inset==0) inset = mIn.bbox.Diag()/200.0f;
tri::UpdateTopology<MeshType>::FaceFace(mIn);
tri::UpdateFlags<MeshType>::FaceClearV(mIn);
for(size_t i=0;i<mIn.face.size();++i) if(!mIn.face[i].IsV())
{
@ -1065,6 +1066,7 @@ void BuildPrismFaceShell(MeshType &mIn, MeshType &mOut, float height=0, float in
if(smoothFlag)
{
faceM.face.EnableFFAdjacency();
tri::UpdateTopology<MeshType>::FaceFace(faceM);
tri::UpdateFlags<MeshType>::FaceBorderFromFF(faceM);
tri::Refine(faceM, MidPoint<MeshType>(&faceM),0,true);

View File

@ -94,7 +94,7 @@ public:
assert(e0.IsBorder());
e1=e0;
e1.NextB();
n=vcg::Normal<TrivialEar>(*this);
n=TriangleNormal<TrivialEar>(*this);
ComputeQuality();
ComputeAngle();
}
@ -159,7 +159,7 @@ public:
(*f).V(0) = e0.VFlip();
(*f).V(1) = e0.v;
(*f).V(2) = e1.v;
face::ComputeNormalizedNormal(*f);
f->N() = TriangleNormal(*f).Normalize();
face::FFAttachManifold(f,0,e0.f,e0.z);
face::FFAttachManifold(f,1,e1.f,e1.z);
@ -644,8 +644,8 @@ template<class EAR>
static float ComputeDihedralAngle(CoordType p1,CoordType p2,CoordType p3,CoordType p4)
{
CoordType n1 = NormalizedNormal(p1,p3,p2);
CoordType n2 = NormalizedNormal(p1,p2,p4);
CoordType n1 = Normal(p1,p3,p2);
CoordType n2 = Normal(p1,p2,p4);
return math::ToDeg(AngleN(n1,n2));
}

View File

@ -369,11 +369,11 @@ public:
// store the old normals for non-collapsed face in v0
for(x.F() = v[0]->VFp(), x.I() = v[0]->VFi(); x.F()!=0; ++x ) // for all faces in v0
if(x.F()->V(0)!=v[1] && x.F()->V(1)!=v[1] && x.F()->V(2)!=v[1] ) // skip faces with v1
on.push_back(NormalizedNormal(*x.F()));
on.push_back(TriangleNormal(*x.F()).Normalize());
// store the old normals for non-collapsed face in v1
for(x.F() = v[1]->VFp(), x.I() = v[1]->VFi(); x.F()!=0; ++x ) // for all faces in v1
if(x.F()->V(0)!=v[0] && x.F()->V(1)!=v[0] && x.F()->V(2)!=v[0] ) // skip faces with v0
on.push_back(NormalizedNormal(*x.F()));
on.push_back(TriangleNormal(*x.F()).Normalize());
}
//// Move the two vertexe into new position (storing the old ones)
@ -393,7 +393,7 @@ public:
if(x.F()->V(0)!=v[1] && x.F()->V(1)!=v[1] && x.F()->V(2)!=v[1] ) // skip faces with v1
{
if(pp->NormalCheck){
nn=NormalizedNormal(*x.F());
nn=TriangleNormal(*x.F()).Normalize();
ndiff=nn.dot(on[i++]);
if(ndiff<MinCos) MinCos=ndiff;
}
@ -406,7 +406,7 @@ public:
if(x.F()->V(0)!=v[0] && x.F()->V(1)!=v[0] && x.F()->V(2)!=v[0] ) // skip faces with v0
{
if(pp->NormalCheck){
nn=NormalizedNormal(*x.F());
nn=TriangleNormal(*x.F()).Normalize();
ndiff=nn.dot(on[i++]);
if(ndiff<MinCos) MinCos=ndiff;
}

View File

@ -340,7 +340,7 @@ class TriEdgeCollapseQuadricTex: public vcg::tri::TriEdgeCollapse< TriMeshType,
qt= QualityFace(*x.F());
if(qt<MinQual) MinQual=qt;
if(pp->NormalCheck){
CoordType nn=NormalizedNormal(*x.F());
CoordType nn=TriangleNormal(*x.F()).Normalize();
ndiff=nn.dot(x.F()->N()) / x.F()->N().Norm();
if(ndiff<MinCos) MinCos=ndiff;
assert(!math::IsNAN(ndiff));
@ -352,7 +352,7 @@ class TriEdgeCollapseQuadricTex: public vcg::tri::TriEdgeCollapse< TriMeshType,
qt= QualityFace(*x.F());
if(qt<MinQual) MinQual=qt;
if(pp->NormalCheck){
CoordType nn=NormalizedNormal(*x.F());
CoordType nn=TriangleNormal(*x.F()).Normalize();
ndiff=nn.dot(x.F()->N() / x.F()->N().Norm());
if(ndiff<MinCos) MinCos=ndiff;
assert(!math::IsNAN(ndiff));

View File

@ -247,7 +247,7 @@ So it just require that you have correctly computed the flags; one way could be
\code
vcg::tri::UpdateTopology<Mesh>::FaceFace(m.cm);
vcg::tri::UpdateFlags<Mesh>::FaceBorderFromFF(m.cm);
vcg::tri::UpdateFlags<Mesh>::VertexBorderFromFace (m.cm);
vcg::tri::UpdateFlags<Mesh>::VertexBorderFromFaceBorder (m.cm);
vcg::tri::UpdateColor<Mesh>::PerVertexBorderFlag(m.cm);
\endcode
*/

View File

@ -503,7 +503,7 @@ static void ConvertVoronoiDiagramToMesh(MeshType &m,
if(vpp.triangulateRegion)
{
tri::UpdateFlags<MeshType>::FaceBorderFromFF(outMesh);
tri::UpdateFlags<MeshType>::VertexBorderFromFace(outMesh);
tri::UpdateFlags<MeshType>::VertexBorderFromFaceBorder(outMesh);
for(FaceIterator fi=outMesh.face.begin();fi!=outMesh.face.end();++fi) if(!fi->IsD())
{
for(int i=0;i<3;++i)
@ -734,7 +734,7 @@ static void ConvertVoronoiDiagramToMeshOld(MeshType &m,
tri::Allocator<MeshType>::CompactEveryVector(outMesh);
tri::UpdateTopology<MeshType>::FaceFace(outMesh);
tri::UpdateFlags<MeshType>::FaceBorderFromFF(outMesh);
tri::UpdateFlags<MeshType>::VertexBorderFromFace(outMesh);
tri::UpdateFlags<MeshType>::VertexBorderFromFaceBorder(outMesh);
// 3) set up faux bits
for(FaceIterator fi=outMesh.face.begin();fi!=outMesh.face.end();++fi)
@ -1282,7 +1282,7 @@ static int VoronoiRelaxing(MeshType &m, std::vector<VertexType *> &seedVec,
}
tri::UpdateFlags<MeshType>::FaceBorderFromVF(m);
tri::UpdateFlags<MeshType>::VertexBorderFromFace(m);
tri::UpdateFlags<MeshType>::VertexBorderFromFaceBorder(m);
PerVertexPointerHandle sources = tri::Allocator<MeshType>:: template GetPerVertexAttribute<VertexPointer> (m,"sources");
PerVertexBoolHandle fixed = tri::Allocator<MeshType>:: template GetPerVertexAttribute<bool> (m,"fixed");
int iter;