Commit ce1186a4 authored by untereiner's avatar untereiner
Browse files

some namespace correction + dual map3 function

parent fda2918a
...@@ -379,14 +379,14 @@ public: ...@@ -379,14 +379,14 @@ public:
if(!normal.isValid()) if(!normal.isValid())
{ {
normal = m.template addAttribute<VEC3, VERTEX>("normal") ; normal = m.template addAttribute<VEC3, VERTEX>("normal") ;
Algo::Geometry::computeNormalVertices<PFP>(m, pos, normal) ; Algo::Surface::Geometry::computeNormalVertices<PFP>(m, pos, normal) ;
} }
edgeangle = m.template getAttribute<REAL, EDGE>("edgeangle") ; edgeangle = m.template getAttribute<REAL, EDGE>("edgeangle") ;
if(!edgeangle.isValid()) if(!edgeangle.isValid())
{ {
edgeangle = m.template addAttribute<REAL, EDGE>("edgeangle") ; edgeangle = m.template addAttribute<REAL, EDGE>("edgeangle") ;
Algo::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ; Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ;
} }
kmax = m.template getAttribute<REAL, VERTEX>("kmax") ; kmax = m.template getAttribute<REAL, VERTEX>("kmax") ;
...@@ -403,7 +403,7 @@ public: ...@@ -403,7 +403,7 @@ public:
Kmax = m.template addAttribute<VEC3, VERTEX>("Kmax") ; Kmax = m.template addAttribute<VEC3, VERTEX>("Kmax") ;
Kmin = m.template addAttribute<VEC3, VERTEX>("Kmin") ; Kmin = m.template addAttribute<VEC3, VERTEX>("Kmin") ;
Knormal = m.template addAttribute<VEC3, VERTEX>("Knormal") ; Knormal = m.template addAttribute<VEC3, VERTEX>("Knormal") ;
Algo::Geometry::computeCurvatureVertices_NormalCycles<PFP>(m, radius, pos, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles<PFP>(m, radius, pos, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
} }
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
...@@ -467,7 +467,7 @@ public: ...@@ -467,7 +467,7 @@ public:
if(!edgeangle.isValid()) if(!edgeangle.isValid())
{ {
edgeangle = m.template addAttribute<REAL, EDGE>("edgeangle") ; edgeangle = m.template addAttribute<REAL, EDGE>("edgeangle") ;
Algo::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ; Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ;
} }
edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo, EDGE>("edgeInfo") ;
......
...@@ -300,7 +300,7 @@ void EdgeSelector_Length<PFP>::updateEdgeInfo(Dart d, bool recompute) ...@@ -300,7 +300,7 @@ void EdgeSelector_Length<PFP>::updateEdgeInfo(Dart d, bool recompute)
template <typename PFP> template <typename PFP>
void EdgeSelector_Length<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) void EdgeSelector_Length<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
{ {
VEC3 vec = Algo::Geometry::vectorOutOfDart<PFP>(this->m_map, d, this->m_position) ; VEC3 vec = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->m_map, d, this->m_position) ;
einfo.it = edges.insert(std::make_pair(vec.norm2(), d)) ; einfo.it = edges.insert(std::make_pair(vec.norm2(), d)) ;
einfo.valid = true ; einfo.valid = true ;
} }
...@@ -989,7 +989,7 @@ void EdgeSelector_NormalArea<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -989,7 +989,7 @@ void EdgeSelector_NormalArea<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
template <typename PFP> template <typename PFP>
void EdgeSelector_NormalArea<PFP>::computeEdgeMatrix(Dart d) void EdgeSelector_NormalArea<PFP>::computeEdgeMatrix(Dart d)
{ {
const typename PFP::VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->m_map, d, this->m_position) ; const typename PFP::VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->m_map, d, this->m_position) ;
edgeMatrix[d].identity(); edgeMatrix[d].identity();
edgeMatrix[d] *= e.norm2(); edgeMatrix[d] *= e.norm2();
edgeMatrix[d] -= Geom::transposed_vectors_mult(e,e) ; edgeMatrix[d] -= Geom::transposed_vectors_mult(e,e) ;
...@@ -1086,15 +1086,15 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2) ...@@ -1086,15 +1086,15 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{ {
typename PFP::MAP& m = this->m_map ; typename PFP::MAP& m = this->m_map ;
normal[d2] = Algo::Geometry::vertexNormal<PFP>(m, d2, this->m_position) ; normal[d2] = Algo::Surface::Geometry::vertexNormal<PFP>(m, d2, this->m_position) ;
Algo::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
Dart vit = d2 ; Dart vit = d2 ;
do do
{ {
Dart nVert = m.phi1(vit) ; Dart nVert = m.phi1(vit) ;
normal[nVert] = Algo::Geometry::vertexNormal<PFP>(m, nVert, this->m_position) ; normal[nVert] = Algo::Surface::Geometry::vertexNormal<PFP>(m, nVert, this->m_position) ;
Algo::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, nVert, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, nVert, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
updateEdgeInfo(m.phi1(vit), false) ; // must recompute some edge infos in the updateEdgeInfo(m.phi1(vit), false) ; // must recompute some edge infos in the
if(vit == d2 || vit == dd2) // neighborhood of the collapsed edge if(vit == d2 || vit == dd2) // neighborhood of the collapsed edge
...@@ -1193,8 +1193,8 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -1193,8 +1193,8 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
this->m_position[newV] = m_positionApproximator->getApprox(d) ; this->m_position[newV] = m_positionApproximator->getApprox(d) ;
// compute things on the coarse version of the mesh // compute things on the coarse version of the mesh
normal[newV] = Algo::Geometry::vertexNormal<PFP>(m, d2, this->m_position) ; normal[newV] = Algo::Surface::Geometry::vertexNormal<PFP>(m, d2, this->m_position) ;
Algo::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
// VEC3 norm = normal[newV] ; // VEC3 norm = normal[newV] ;
REAL mCurv = (kmax[newV] + kmin[newV]) / REAL(2) ; REAL mCurv = (kmax[newV] + kmin[newV]) / REAL(2) ;
...@@ -1335,7 +1335,7 @@ void EdgeSelector_CurvatureTensor<PFP>::updateAfterCollapse(Dart d2, Dart dd2) ...@@ -1335,7 +1335,7 @@ void EdgeSelector_CurvatureTensor<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{ {
if (!eMark.isMarked(dit2)) if (!eMark.isMarked(dit2))
{ {
edgeangle[dit2] = Algo::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(m, dit2, this->m_position) ; edgeangle[dit2] = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(m, dit2, this->m_position) ;
eMark.mark(dit2); eMark.mark(dit2);
} }
} }
...@@ -1408,11 +1408,11 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -1408,11 +1408,11 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// compute tensor before collapse // compute tensor before collapse
MATRIX tens1; MATRIX tens1;
Algo::Selection::Collector_OneRing_AroundEdge<PFP> col1 (m); Algo::Surface::Selection::Collector_OneRing_AroundEdge<PFP> col1 (m);
col1.collectAll(d); col1.collectAll(d);
col1.computeNormalCyclesTensor(this->m_position,edgeangle,tens1); // edgeangle is up to date here col1.computeNormalCyclesTensor(this->m_position,edgeangle,tens1); // edgeangle is up to date here
tens1 *= col1.computeArea(this->m_position); // mean tensor * area = integral of the tensor tens1 *= col1.computeArea(this->m_position); // mean tensor * area = integral of the tensor
Algo::Geometry::normalCycles_SortTensor<PFP>(tens1); Algo::Surface::Geometry::normalCycles_SortTensor<PFP>(tens1);
// temporary edge collapse // temporary edge collapse
Dart d2 = m.phi2(m.phi_1(d)) ; Dart d2 = m.phi2(m.phi_1(d)) ;
...@@ -1423,11 +1423,11 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -1423,11 +1423,11 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// compute tensor after collapse // compute tensor after collapse
MATRIX tens2; MATRIX tens2;
Algo::Selection::Collector_OneRing<PFP> col2 (m); Algo::Surface::Selection::Collector_OneRing<PFP> col2 (m);
col2.collectAll(d); col2.collectAll(d);
col2.computeNormalCyclesTensor(this->m_position,tens2); // edgeangle is not up to date here col2.computeNormalCyclesTensor(this->m_position,tens2); // edgeangle is not up to date here
tens2 *= col2.computeArea(this->m_position); // mean tensor * area = integral of the tensor tens2 *= col2.computeArea(this->m_position); // mean tensor * area = integral of the tensor
Algo::Geometry::normalCycles_SortTensor<PFP>(tens2); Algo::Surface::Geometry::normalCycles_SortTensor<PFP>(tens2);
// vertex split to reset the initial connectivity and embeddings // vertex split to reset the initial connectivity and embeddings
m.insertTrianglePair(d, d2, dd2) ; m.insertTrianglePair(d, d2, dd2) ;
......
...@@ -181,7 +181,7 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -181,7 +181,7 @@ void computeCurvatureVertex_NormalCycles_Projected(
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles( void computeCurvatureVertices_NormalCycles(
typename PFP::MAP& map, typename PFP::MAP& map,
Algo::Selection::Collector<PFP> & neigh, Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3>& position, const VertexAttribute<typename PFP::VEC3>& position,
const VertexAttribute<typename PFP::VEC3>& normal, const VertexAttribute<typename PFP::VEC3>& normal,
const EdgeAttribute<typename PFP::REAL>& edgeangle, const EdgeAttribute<typename PFP::REAL>& edgeangle,
...@@ -196,7 +196,7 @@ template <typename PFP> ...@@ -196,7 +196,7 @@ template <typename PFP>
void computeCurvatureVertex_NormalCycles( void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Dart dart,
Algo::Selection::Collector<PFP> & neigh, Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3>& position, const VertexAttribute<typename PFP::VEC3>& position,
const VertexAttribute<typename PFP::VEC3>& normal, const VertexAttribute<typename PFP::VEC3>& normal,
const EdgeAttribute<typename PFP::REAL>& edgeangle, const EdgeAttribute<typename PFP::REAL>& edgeangle,
...@@ -209,7 +209,7 @@ void computeCurvatureVertex_NormalCycles( ...@@ -209,7 +209,7 @@ void computeCurvatureVertex_NormalCycles(
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles_Projected( void computeCurvatureVertices_NormalCycles_Projected(
typename PFP::MAP& map, typename PFP::MAP& map,
Algo::Selection::Collector<PFP> & neigh, Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3>& position, const VertexAttribute<typename PFP::VEC3>& position,
const VertexAttribute<typename PFP::VEC3>& normal, const VertexAttribute<typename PFP::VEC3>& normal,
const EdgeAttribute<typename PFP::REAL>& edgeangle, const EdgeAttribute<typename PFP::REAL>& edgeangle,
...@@ -224,7 +224,7 @@ template <typename PFP> ...@@ -224,7 +224,7 @@ template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected( void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Dart dart,
Algo::Selection::Collector<PFP> & neigh, Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3>& position, const VertexAttribute<typename PFP::VEC3>& position,
const VertexAttribute<typename PFP::VEC3>& normal, const VertexAttribute<typename PFP::VEC3>& normal,
const EdgeAttribute<typename PFP::REAL>& edgeangle, const EdgeAttribute<typename PFP::REAL>& edgeangle,
......
...@@ -80,7 +80,7 @@ void computeCurvatureVertex_QuadraticFitting( ...@@ -80,7 +80,7 @@ void computeCurvatureVertex_QuadraticFitting(
VEC3 n = normal[dart] ; VEC3 n = normal[dart] ;
MATRIX33 localFrame = Geometry::vertexLocalFrame<PFP>(map, dart, position, n) ; MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame<PFP>(map, dart, position, n) ;
MATRIX33 invLocalFrame ; MATRIX33 invLocalFrame ;
localFrame.invert(invLocalFrame) ; localFrame.invert(invLocalFrame) ;
......
...@@ -44,8 +44,8 @@ namespace Geometry ...@@ -44,8 +44,8 @@ namespace Geometry
template <typename PFP> template <typename PFP>
void vertexLocalFrame(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, typename PFP::VEC3& X, typename PFP::VEC3& Y, typename PFP::VEC3& Z) void vertexLocalFrame(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, typename PFP::VEC3& X, typename PFP::VEC3& Y, typename PFP::VEC3& Z)
{ {
Z = vertexNormal<PFP>(map, d, position) ; Z = Algo::Surface::Geometry::vertexNormal<PFP>(map, d, position) ;
X = vectorOutOfDart<PFP>(map, d, position) ; X = Algo::Surface::Geometry::vectorOutOfDart<PFP>(map, d, position) ;
Y = Z ^ X ; Y = Z ^ X ;
Y.normalize() ; Y.normalize() ;
X = Y ^ Z ; X = Y ^ Z ;
...@@ -70,7 +70,7 @@ template <typename PFP> ...@@ -70,7 +70,7 @@ template <typename PFP>
void vertexLocalFrame(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, typename PFP::VEC3& normal, typename PFP::VEC3& X, typename PFP::VEC3& Y, typename PFP::VEC3& Z) void vertexLocalFrame(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, typename PFP::VEC3& normal, typename PFP::VEC3& X, typename PFP::VEC3& Y, typename PFP::VEC3& Z)
{ {
Z = normal ; Z = normal ;
X = vectorOutOfDart<PFP>(map, d, position) ; X = Algo::Surface::Geometry::vectorOutOfDart<PFP>(map, d, position) ;
Y = Z ^ X ; Y = Z ^ X ;
Y.normalize() ; Y.normalize() ;
X = Y ^ Z ; X = Y ^ Z ;
......
...@@ -62,13 +62,13 @@ private: ...@@ -62,13 +62,13 @@ private:
DartMarker& inactiveMarker ; DartMarker& inactiveMarker ;
SelectorUnmarked dartSelect ; SelectorUnmarked dartSelect ;
Algo::Decimation::EdgeSelector<PFP>* m_selector ; Algo::Surface::Decimation::EdgeSelector<PFP>* m_selector ;
std::vector<Algo::Decimation::ApproximatorGen<PFP>*> m_approximators ; std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*> m_approximators ;
std::vector<Algo::Decimation::PredictorGen<PFP>*> m_predictors ; std::vector<Algo::Surface::Decimation::PredictorGen<PFP>*> m_predictors ;
std::vector<VSplit<PFP>*> m_splits ; std::vector<VSplit<PFP>*> m_splits ;
unsigned int m_cur ; unsigned int m_cur ;
Algo::Decimation::Approximator<PFP, VEC3, EDGE>* m_positionApproximator ; Algo::Surface::Decimation::Approximator<PFP, VEC3, EDGE>* m_positionApproximator ;
bool m_initOk ; bool m_initOk ;
...@@ -77,12 +77,12 @@ private: ...@@ -77,12 +77,12 @@ private:
std::vector<VEC3> originalDetailVectors ; std::vector<VEC3> originalDetailVectors ;
bool quantizationInitialized, quantizationApplied ; bool quantizationInitialized, quantizationApplied ;
Quantization<VEC3>* q ; Algo::PMesh::Quantization<VEC3>* q ;
public: public:
ProgressiveMesh( ProgressiveMesh(
MAP& map, DartMarker& inactive, MAP& map, DartMarker& inactive,
Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a, Algo::Surface::Decimation::SelectorType s, Algo::Surface::Decimation::ApproximatorType a,
VertexAttribute<typename PFP::VEC3>& position VertexAttribute<typename PFP::VEC3>& position
) ; ) ;
~ProgressiveMesh() ; ~ProgressiveMesh() ;
...@@ -92,9 +92,9 @@ public: ...@@ -92,9 +92,9 @@ public:
void createPM(unsigned int percentWantedVertices) ; void createPM(unsigned int percentWantedVertices) ;
std::vector<VSplit<PFP>*>& splits() { return m_splits ; } std::vector<VSplit<PFP>*>& splits() { return m_splits ; }
Algo::Decimation::EdgeSelector<PFP>* selector() { return m_selector ; } Algo::Surface::Decimation::EdgeSelector<PFP>* selector() { return m_selector ; }
std::vector<Algo::Decimation::ApproximatorGen<PFP>*>& approximators() { return m_approximators ; } std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*>& approximators() { return m_approximators ; }
std::vector<Algo::Decimation::PredictorGen<PFP>*>& predictors() { return m_predictors ; } std::vector<Algo::Surface::Decimation::PredictorGen<PFP>*>& predictors() { return m_predictors ; }
void edgeCollapse(VSplit<PFP>* vs) ; void edgeCollapse(VSplit<PFP>* vs) ;
void vertexSplit(VSplit<PFP>* vs) ; void vertexSplit(VSplit<PFP>* vs) ;
......
...@@ -284,7 +284,7 @@ void ProgressiveMesh<PFP>::refine() ...@@ -284,7 +284,7 @@ void ProgressiveMesh<PFP>::refine()
typename PFP::MATRIX33 invLocalFrame ; typename PFP::MATRIX33 invLocalFrame ;
if(m_localFrameDetailVectors) if(m_localFrameDetailVectors)
{ {
typename PFP::MATRIX33 localFrame = Algo::Surface::Geometry::vertexLocalFrame<PFP>(m_map, dd2, positionsTable) ; typename PFP::MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame<PFP>(m_map, dd2, positionsTable) ;
localFrame.invert(invLocalFrame) ; localFrame.invert(invLocalFrame) ;
} }
...@@ -381,7 +381,7 @@ void ProgressiveMesh<PFP>::localizeDetailVectors() ...@@ -381,7 +381,7 @@ void ProgressiveMesh<PFP>::localizeDetailVectors()
{ {
Dart d = m_splits[m_cur-1]->getEdge() ; Dart d = m_splits[m_cur-1]->getEdge() ;
Dart dd2 = m_splits[m_cur-1]->getRightEdge() ; Dart dd2 = m_splits[m_cur-1]->getRightEdge() ;
typename PFP::MATRIX33 localFrame = Algo::Surface::Geometry::vertexLocalFrame<PFP>(m_map, dd2, positionsTable) ; typename PFP::MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame<PFP>(m_map, dd2, positionsTable) ;
VEC3 det = m_positionApproximator->getDetail(d) ; VEC3 det = m_positionApproximator->getDetail(d) ;
det = localFrame * det ; det = localFrame * det ;
m_positionApproximator->setDetail(d, det) ; m_positionApproximator->setDetail(d, det) ;
...@@ -412,7 +412,7 @@ void ProgressiveMesh<PFP>::globalizeDetailVectors() ...@@ -412,7 +412,7 @@ void ProgressiveMesh<PFP>::globalizeDetailVectors()
{ {
Dart d = m_splits[m_cur-1]->getEdge() ; Dart d = m_splits[m_cur-1]->getEdge() ;
Dart dd2 = m_splits[m_cur-1]->getRightEdge() ; Dart dd2 = m_splits[m_cur-1]->getRightEdge() ;
typename PFP::MATRIX33 localFrame = Algo::Surface::Geometry::vertexLocalFrame<PFP>(m_map, dd2, positionsTable) ; typename PFP::MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame<PFP>(m_map, dd2, positionsTable) ;
typename PFP::MATRIX33 invLocalFrame ; typename PFP::MATRIX33 invLocalFrame ;
localFrame.invert(invLocalFrame) ; localFrame.invert(invLocalFrame) ;
VEC3 det = m_positionApproximator->getDetail(d) ; VEC3 det = m_positionApproximator->getDetail(d) ;
...@@ -436,7 +436,7 @@ void ProgressiveMesh<PFP>::initQuantization() ...@@ -436,7 +436,7 @@ void ProgressiveMesh<PFP>::initQuantization()
originalDetailVectors.resize(m_splits.size()) ; originalDetailVectors.resize(m_splits.size()) ;
for(unsigned int i = 0; i < m_splits.size(); ++i) for(unsigned int i = 0; i < m_splits.size(); ++i)
originalDetailVectors[i] = m_positionApproximator->getDetail(m_splits[i]->getEdge(),0) ; originalDetailVectors[i] = m_positionApproximator->getDetail(m_splits[i]->getEdge(),0) ;
q = new Quantization<VEC3>(originalDetailVectors) ; q = new Algo::PMesh::Quantization<VEC3>(originalDetailVectors) ;
quantizationInitialized = true ; quantizationInitialized = true ;
CGoGNout << " Differential Entropy -> " << q->getDifferentialEntropy() << CGoGNendl ; CGoGNout << " Differential Entropy -> " << q->getDifferentialEntropy() << CGoGNendl ;
} }
...@@ -575,8 +575,7 @@ void ProgressiveMesh<PFP>::calculCourbeDebitDistortion() ...@@ -575,8 +575,7 @@ void ProgressiveMesh<PFP>::calculCourbeDebitDistortion()
} }
*/ */
} //namespace PMesh } // namespace PMesh
} // Surface } // namespace Surface
} //namespace Algo } // namespace Algo
} } // namespace CGoGN
} //namespace CGoGN
...@@ -150,7 +150,7 @@ typename PFP::REAL Collector_OneRing<PFP>::computeArea(const VertexAttribute<VEC ...@@ -150,7 +150,7 @@ typename PFP::REAL Collector_OneRing<PFP>::computeArea(const VertexAttribute<VEC
REAL area = 0; REAL area = 0;
for (std::vector<Dart>::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it) for (std::vector<Dart>::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it)
area += Algo::Geometry::triangleArea<PFP>(this->map, *it, pos); area += Algo::Surface::Geometry::triangleArea<PFP>(this->map, *it, pos);
return area; return area;
} }
...@@ -164,7 +164,7 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE ...@@ -164,7 +164,7 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
// collect edges inside the neighborhood // collect edges inside the neighborhood
for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it)
{ {
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ; const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ;
} }
...@@ -180,8 +180,8 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE ...@@ -180,8 +180,8 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
// collect edges inside the neighborhood // collect edges inside the neighborhood
for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it)
{ {
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ; const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ; const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ;
} }
...@@ -256,7 +256,7 @@ typename PFP::REAL Collector_OneRing_AroundEdge<PFP>::computeArea(const VertexAt ...@@ -256,7 +256,7 @@ typename PFP::REAL Collector_OneRing_AroundEdge<PFP>::computeArea(const VertexAt
REAL area = 0; REAL area = 0;
for (std::vector<Dart>::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it) for (std::vector<Dart>::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it)
area += Algo::Geometry::triangleArea<PFP>(this->map, *it, pos); area += Algo::Surface::Geometry::triangleArea<PFP>(this->map, *it, pos);
return area; return area;
} }
...@@ -270,7 +270,7 @@ void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexA ...@@ -270,7 +270,7 @@ void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexA
// collect edges inside the neighborhood // collect edges inside the neighborhood
for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it)
{ {
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ; const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ;
} }
...@@ -286,8 +286,8 @@ void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexA ...@@ -286,8 +286,8 @@ void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexA
// collect edges inside the neighborhood // collect edges inside the neighborhood
for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it)
{ {
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ; const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ; const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ;
} }
...@@ -433,14 +433,14 @@ typename PFP::REAL Collector_WithinSphere<PFP>::computeArea(const VertexAttribut ...@@ -433,14 +433,14 @@ typename PFP::REAL Collector_WithinSphere<PFP>::computeArea(const VertexAttribut
typename PFP::REAL alpha, beta; typename PFP::REAL alpha, beta;
Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, this->radius, *it, pos, alpha); Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, this->radius, *it, pos, alpha);
Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, this->radius, this->map.phi2(f), pos, beta); Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, this->radius, this->map.phi2(f), pos, beta);
area += (alpha+beta - alpha*beta) * Algo::Geometry::triangleArea<PFP>(this->map, *it, pos); area += (alpha+beta - alpha*beta) * Algo::Surface::Geometry::triangleArea<PFP>(this->map, *it, pos);
} }
else else
{ // f and g are outside { // f and g are outside
typename PFP::REAL alpha, beta; typename PFP::REAL alpha, beta;
Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, this->radius, *it, pos, alpha); Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, this->radius, *it, pos, alpha);
Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, this->radius, this->map.phi2(g), pos, beta); Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, this->radius, this->map.phi2(g), pos, beta);
area += alpha * beta * Algo::Geometry::triangleArea<PFP>(this->map, *it, pos); area += alpha * beta * Algo::Surface::Geometry::triangleArea<PFP>(this->map, *it, pos);
} }
} }
return area; return area;
...@@ -456,15 +456,15 @@ void Collector_WithinSphere<PFP>::computeNormalCyclesTensor (const VertexAttribu ...@@ -456,15 +456,15 @@ void Collector_WithinSphere<PFP>::computeNormalCyclesTensor (const VertexAttribu
// collect edges inside the neighborhood // collect edges inside the neighborhood
for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it)
{ {
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ; const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ;
} }
// collect edges crossing the neighborhood's border // collect edges crossing the neighborhood's border
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it) for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
{ {
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ; const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
REAL alpha ; REAL alpha ;
Algo::Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, radius, *it, pos, alpha) ; Algo::Surface::Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, radius, *it, pos, alpha) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) * alpha ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) * alpha ;
} }
...@@ -482,17 +482,17 @@ void Collector_WithinSphere<PFP>::computeNormalCyclesTensor (const VertexAttribu ...@@ -482,17 +482,17 @@ void Collector_WithinSphere<PFP>::computeNormalCyclesTensor (const VertexAttribu
// collect edges inside the neighborhood // collect edges inside the neighborhood
for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it)
{ {
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ; const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ; const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ;
} }
// collect edges crossing the neighborhood's border // collect edges crossing the neighborhood's border
for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it) for (std::vector<Dart>::const_iterator it = this->border.begin(); it != this->border.end(); ++it)
{ {
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ; const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
REAL alpha ; REAL alpha ;
Algo::Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, radius, *it, pos, alpha) ; Algo::Surface::Geometry::intersectionSphereEdge<PFP>(this->map, centerPosition, radius, *it, pos, alpha) ;
const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ; const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(this->map, *it, pos) ;