removed a few point3f and changed into coordTypes

This commit is contained in:
Paolo Cignoni 2014-06-17 13:42:10 +00:00
parent 3e4c020642
commit b389e3a314
1 changed files with 444 additions and 442 deletions

View File

@ -207,7 +207,7 @@ struct ContinuityLoopWeight {
template<class MESH_TYPE, class LSCALAR_TYPE = typename MESH_TYPE::ScalarType> template<class MESH_TYPE, class LSCALAR_TYPE = typename MESH_TYPE::ScalarType>
struct Centroid { struct Centroid {
typedef typename MESH_TYPE::ScalarType Scalar; typedef typename MESH_TYPE::ScalarType Scalar;
typedef typename MESH_TYPE::CoordType Coord; typedef typename MESH_TYPE::CoordType CoordType;
typedef LSCALAR_TYPE LScalar; typedef LSCALAR_TYPE LScalar;
typedef vcg::Point3<LScalar> LVector; typedef vcg::Point3<LScalar> LVector;
@ -224,9 +224,9 @@ struct Centroid {
sumP += p * w; sumP += p * w;
sumW += w; sumW += w;
} }
inline void project(std::pair<Point3f,Point3f> &nv) const { inline void project(std::pair<CoordType,CoordType> &nv) const {
LVector position = sumP / sumW; LVector position = sumP / sumW;
nv.first = Coord(position.X(), position.Y(), position.Z()); nv.first = CoordType(position.X(), position.Y(), position.Z());
} }
}; };
@ -242,7 +242,7 @@ struct Centroid {
template<class MESH_TYPE, class LSCALAR_TYPE = typename MESH_TYPE::ScalarType> template<class MESH_TYPE, class LSCALAR_TYPE = typename MESH_TYPE::ScalarType>
struct LS3Projection { struct LS3Projection {
typedef typename MESH_TYPE::ScalarType Scalar; typedef typename MESH_TYPE::ScalarType Scalar;
typedef typename MESH_TYPE::CoordType Coord; typedef typename MESH_TYPE::CoordType CoordType;
typedef LSCALAR_TYPE LScalar; typedef LSCALAR_TYPE LScalar;
typedef vcg::Point3<LScalar> LVector; typedef vcg::Point3<LScalar> LVector;
@ -272,7 +272,7 @@ struct LS3Projection {
sumDotPP += w * vcg::SquaredNorm(p); sumDotPP += w * vcg::SquaredNorm(p);
sumW += w; sumW += w;
} }
void project(std::pair<Point3f,Point3f> &nv) const { void project(std::pair<CoordType,CoordType> &nv) const {
LScalar invSumW = Scalar(1)/sumW; LScalar invSumW = Scalar(1)/sumW;
LScalar aux4 = beta * LScalar(0.5) * LScalar aux4 = beta * LScalar(0.5) *
(sumDotPN - invSumW*sumP.dot(sumN)) (sumDotPN - invSumW*sumP.dot(sumN))
@ -348,6 +348,7 @@ struct OddPointLoopGeneric : public std::unary_function<face::Pos<typename MESH_
typedef METHOD_TYPE Projection; typedef METHOD_TYPE Projection;
typedef WEIGHT_TYPE Weight; typedef WEIGHT_TYPE Weight;
typedef typename MESH_TYPE::template PerVertexAttributeHandle<int> ValenceAttr; typedef typename MESH_TYPE::template PerVertexAttributeHandle<int> ValenceAttr;
typedef typename MESH_TYPE::CoordType CoordType;
MESH_TYPE &m; MESH_TYPE &m;
Projection proj; Projection proj;
@ -372,7 +373,7 @@ struct OddPointLoopGeneric : public std::unary_function<face::Pos<typename MESH_
if (he.IsBorder()) { if (he.IsBorder()) {
proj.addVertex(*l, 0.5); proj.addVertex(*l, 0.5);
proj.addVertex(*r, 0.5); proj.addVertex(*r, 0.5);
std::pair<Point3f,Point3f>pp; std::pair<CoordType,CoordType>pp;
proj.project(pp); proj.project(pp);
nv.P()=pp.first; nv.P()=pp.first;
nv.N()=pp.second; nv.N()=pp.second;
@ -399,7 +400,7 @@ struct OddPointLoopGeneric : public std::unary_function<face::Pos<typename MESH_
proj.addVertex(*u, 1.0/8.0); proj.addVertex(*u, 1.0/8.0);
proj.addVertex(*d, 1.0/8.0); proj.addVertex(*d, 1.0/8.0);
} }
std::pair<Point3f,Point3f>pp; std::pair<CoordType,CoordType>pp;
proj.project(pp); proj.project(pp);
nv.P()=pp.first; nv.P()=pp.first;
nv.N()=pp.second; nv.N()=pp.second;
@ -434,6 +435,7 @@ struct EvenPointLoopGeneric : public std::unary_function<face::Pos<typename MESH
typedef METHOD_TYPE Projection; typedef METHOD_TYPE Projection;
typedef WEIGHT_TYPE Weight; typedef WEIGHT_TYPE Weight;
typedef typename MESH_TYPE::template PerVertexAttributeHandle<int> ValenceAttr; typedef typename MESH_TYPE::template PerVertexAttributeHandle<int> ValenceAttr;
typedef typename MESH_TYPE::CoordType CoordType;
Projection proj; Projection proj;
Weight weight; Weight weight;
@ -442,7 +444,7 @@ struct EvenPointLoopGeneric : public std::unary_function<face::Pos<typename MESH
inline EvenPointLoopGeneric(Projection proj = Projection(), Weight weight = Weight()) : inline EvenPointLoopGeneric(Projection proj = Projection(), Weight weight = Weight()) :
proj(proj), weight(weight), valence(0) {} proj(proj), weight(weight), valence(0) {}
void operator()(std::pair<Point3f,Point3f> &nv, face::Pos<typename MESH_TYPE::FaceType> ep) { void operator()(std::pair<CoordType,CoordType> &nv, face::Pos<typename MESH_TYPE::FaceType> ep) {
proj.reset(); proj.reset();
face::Pos<typename MESH_TYPE::FaceType> he(ep.f,ep.z,ep.f->V(ep.z)); face::Pos<typename MESH_TYPE::FaceType> he(ep.f,ep.z,ep.f->V(ep.z));
@ -575,7 +577,7 @@ bool RefineOddEvenE(MESH_TYPE &m, ODD_VERT odd, EVEN_VERT even, PREDICATE edgePr
// store updated vertices // store updated vertices
std::vector<bool> updatedList(m.vn, false); std::vector<bool> updatedList(m.vn, false);
//std::vector<typename MESH_TYPE::VertexType> newEven(m.vn); //std::vector<typename MESH_TYPE::VertexType> newEven(m.vn);
std::vector<std::pair<Point3f,Point3f> > newEven(m.vn); std::vector<std::pair<typename MESH_TYPE::CoordType, typename MESH_TYPE::CoordType> > newEven(m.vn);
typename MESH_TYPE::VertexIterator vi; typename MESH_TYPE::VertexIterator vi;
typename MESH_TYPE::FaceIterator fi; typename MESH_TYPE::FaceIterator fi;