added a few missing std:: and cleaned up a bit the requirements
This commit is contained in:
parent
ad4ad4026c
commit
3482ee805e
|
@ -127,7 +127,7 @@ class Quadric
|
||||||
return 2.0*c();
|
return 2.0*c();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Quadric fit(vector<CoordType> VV)
|
static Quadric fit(std::vector<CoordType> VV)
|
||||||
{
|
{
|
||||||
assert(VV.size() >= 5);
|
assert(VV.size() >= 5);
|
||||||
Eigen::MatrixXf A(VV.size(),5);
|
Eigen::MatrixXf A(VV.size(),5);
|
||||||
|
@ -160,7 +160,7 @@ class Quadric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static vector<CoordType> computeReferenceFrames(VertexTypeP vi)
|
static std::vector<CoordType> computeReferenceFrames(VertexTypeP vi)
|
||||||
{
|
{
|
||||||
vcg::face::VFIterator<FaceType> vfi(vi);
|
vcg::face::VFIterator<FaceType> vfi(vi);
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ class Quadric
|
||||||
|
|
||||||
assert(fabs(x * vi->N()) < 0.1);
|
assert(fabs(x * vi->N()) < 0.1);
|
||||||
|
|
||||||
vector<CoordType> res(3);
|
std::vector<CoordType> res(3);
|
||||||
|
|
||||||
res[0] = x;
|
res[0] = x;
|
||||||
res[1] = (vi->N() ^ res[0]).Normalize();
|
res[1] = (vi->N() ^ res[0]).Normalize();
|
||||||
|
@ -180,10 +180,10 @@ class Quadric
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static set<CoordType> getSecondRing(VertexTypeP v)
|
static std::set<CoordType> getSecondRing(VertexTypeP v)
|
||||||
{
|
{
|
||||||
set<VertexTypeP> ris;
|
std::set<VertexTypeP> ris;
|
||||||
set<CoordType> coords;
|
std::set<CoordType> coords;
|
||||||
|
|
||||||
vcg::face::VFIterator<FaceType> vvi(v);
|
vcg::face::VFIterator<FaceType> vvi(v);
|
||||||
for(;!vvi.End();++vvi)
|
for(;!vvi.End();++vvi)
|
||||||
|
@ -194,22 +194,22 @@ class Quadric
|
||||||
ris.insert(vvi2.F()->V((vvi2.I()+1)%3));
|
ris.insert(vvi2.F()->V((vvi2.I()+1)%3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
typename std::set<VertexTypeP>::iterator it;
|
||||||
for(typename set<VertexTypeP>::iterator it = ris.begin(); it != ris.end(); ++it)
|
for(it = ris.begin(); it != ris.end(); ++it)
|
||||||
coords.insert((*it)->P());
|
coords.insert((*it)->P());
|
||||||
|
|
||||||
return coords;
|
return coords;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Quadric fitQuadric(VertexTypeP v, vector<CoordType>& ref)
|
static Quadric fitQuadric(VertexTypeP v, std::vector<CoordType>& ref)
|
||||||
{
|
{
|
||||||
set<CoordType> ring = getSecondRing(v);
|
std::set<CoordType> ring = getSecondRing(v);
|
||||||
if (ring.size() < 5)
|
if (ring.size() < 5)
|
||||||
return Quadric(1,1,1,1,1);
|
return Quadric(1,1,1,1,1);
|
||||||
vector<CoordType> points;
|
std::vector<CoordType> points;
|
||||||
|
|
||||||
typename set<CoordType>::iterator b = ring.begin();
|
typename std::set<CoordType>::iterator b = ring.begin();
|
||||||
typename set<CoordType>::iterator e = ring.end();
|
typename std::set<CoordType>::iterator e = ring.end();
|
||||||
|
|
||||||
while(b != e)
|
while(b != e)
|
||||||
{
|
{
|
||||||
|
@ -229,11 +229,9 @@ class Quadric
|
||||||
static void computeCurvature(MeshType & m)
|
static void computeCurvature(MeshType & m)
|
||||||
{
|
{
|
||||||
|
|
||||||
assert(VertexType::HasVFAdjacency());
|
assert(vcg::tri::HasVFAdjacency(m));
|
||||||
assert(FaceType::HasFFAdjacency());
|
|
||||||
assert(FaceType::HasFaceNormal());
|
|
||||||
|
|
||||||
UpdateTopology<MeshType>::VertexFace(m);
|
vcg::tri::UpdateTopology<MeshType>::VertexFace(m);
|
||||||
|
|
||||||
vcg::tri::UpdateNormals<MeshType>::PerVertexAngleWeighted(m);
|
vcg::tri::UpdateNormals<MeshType>::PerVertexAngleWeighted(m);
|
||||||
vcg::tri::UpdateNormals<MeshType>::NormalizeVertex(m);
|
vcg::tri::UpdateNormals<MeshType>::NormalizeVertex(m);
|
||||||
|
@ -242,7 +240,7 @@ class Quadric
|
||||||
VertexIterator vi;
|
VertexIterator vi;
|
||||||
for(vi = m.vert.begin(); vi!=m.vert.end(); ++vi )
|
for(vi = m.vert.begin(); vi!=m.vert.end(); ++vi )
|
||||||
{
|
{
|
||||||
vector<CoordType> ref = computeReferenceFrames(&*vi);
|
std::vector<CoordType> ref = computeReferenceFrames(&*vi);
|
||||||
|
|
||||||
Quadric q = fitQuadric(&*vi,ref);
|
Quadric q = fitQuadric(&*vi,ref);
|
||||||
double a = q.a();
|
double a = q.a();
|
||||||
|
|
Loading…
Reference in New Issue