Commit afad58ac authored by Sylvain Thery's avatar Sylvain Thery

add Surface/Volume namespace in Multiresolution Algos

parent ce89d70a
......@@ -33,6 +33,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -129,6 +132,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -36,6 +36,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -644,13 +647,14 @@ public:
{}
} ;
} // namespace Filters
} // namespace Primal
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -34,6 +34,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -447,6 +450,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -34,6 +34,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -90,7 +93,7 @@ public:
TraversorF<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
{
typename PFP::VEC3 p = Algo::Geometry::faceCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 p = Geometry::faceCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ;
if(m_map.faceDegree(d) != 3)
......@@ -111,6 +114,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -34,6 +34,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -255,6 +258,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -34,6 +34,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -64,7 +67,7 @@ public:
TraversorF<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
{
typename PFP::VEC3 p = Algo::Geometry::faceCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 p = Geometry::faceCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ;
......@@ -89,6 +92,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -34,6 +34,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -329,6 +332,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -35,6 +35,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -193,6 +196,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -37,6 +37,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -83,6 +86,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -28,6 +28,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -149,6 +152,8 @@ void Map2MR<PFP>::synthesis()
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......@@ -45,6 +45,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -111,6 +114,8 @@ public:
} // namespace Multiresolution
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -30,6 +30,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -44,14 +47,14 @@ Map2MR_PM<PFP>::~Map2MR_PM()
{
if(m_selector)
delete m_selector ;
for(typename std::vector<Algo::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
for(typename std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
delete (*it) ;
for(typename std::vector<Algo::Decimation::PredictorGen<PFP>*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it)
for(typename std::vector<Algo::Surface::Decimation::PredictorGen<PFP>*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it)
delete (*it) ;
}
template <typename PFP>
void Map2MR_PM<PFP>::createPM(Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a, const FunctorSelect& select)
void Map2MR_PM<PFP>::createPM(Algo::Surface::Decimation::SelectorType s, Algo::Surface::Decimation::ApproximatorType a, const FunctorSelect& select)
{
CGoGNout << " creating approximator and predictor.." << CGoGNflush ;
......@@ -59,31 +62,31 @@ void Map2MR_PM<PFP>::createPM(Algo::Decimation::SelectorType s, Algo::Decimation
pos_v.push_back(&m_position) ;
switch(a)
{
case Algo::Decimation::A_QEM : {
m_approximators.push_back(new Algo::Decimation::Approximator_QEM<PFP>(m_map, pos_v)) ;
case Algo::Surface::Decimation::A_QEM : {
m_approximators.push_back(new Algo::Surface::Decimation::Approximator_QEM<PFP>(m_map, pos_v)) ;
break ; }
case Algo::Decimation::A_MidEdge : {
m_approximators.push_back(new Algo::Decimation::Approximator_MidEdge<PFP>(m_map, pos_v)) ;
case Algo::Surface::Decimation::A_MidEdge : {
m_approximators.push_back(new Algo::Surface::Decimation::Approximator_MidEdge<PFP>(m_map, pos_v)) ;
break ; }
case Algo::Decimation::A_hHalfCollapse : {
Algo::Decimation::Predictor_HalfCollapse<PFP>* pred = new Algo::Decimation::Predictor_HalfCollapse<PFP>(m_map, m_position) ;
case Algo::Surface::Decimation::A_hHalfCollapse : {
Algo::Surface::Decimation::Predictor_HalfCollapse<PFP>* pred = new Algo::Surface::Decimation::Predictor_HalfCollapse<PFP>(m_map, m_position) ;
m_predictors.push_back(pred) ;
m_approximators.push_back(new Algo::Decimation::Approximator_HalfCollapse<PFP>(m_map, pos_v, pred)) ;
m_approximators.push_back(new Algo::Surface::Decimation::Approximator_HalfCollapse<PFP>(m_map, pos_v, pred)) ;
break ; }
case Algo::Decimation::A_CornerCutting : {
Algo::Decimation::Predictor_CornerCutting<PFP>* pred = new Algo::Decimation::Predictor_CornerCutting<PFP>(m_map, m_position) ;
case Algo::Surface::Decimation::A_CornerCutting : {
Algo::Surface::Decimation::Predictor_CornerCutting<PFP>* pred = new Algo::Surface::Decimation::Predictor_CornerCutting<PFP>(m_map, m_position) ;
m_predictors.push_back(pred) ;
m_approximators.push_back(new Algo::Decimation::Approximator_CornerCutting<PFP>(m_map, pos_v, pred)) ;
m_approximators.push_back(new Algo::Surface::Decimation::Approximator_CornerCutting<PFP>(m_map, pos_v, pred)) ;
break ; }
case Algo::Decimation::A_TangentPredict1 : {
Algo::Decimation::Predictor_TangentPredict1<PFP>* pred = new Algo::Decimation::Predictor_TangentPredict1<PFP>(m_map, m_position) ;
case Algo::Surface::Decimation::A_TangentPredict1 : {
Algo::Surface::Decimation::Predictor_TangentPredict1<PFP>* pred = new Algo::Surface::Decimation::Predictor_TangentPredict1<PFP>(m_map, m_position) ;
m_predictors.push_back(pred) ;
m_approximators.push_back(new Algo::Decimation::Approximator_MidEdge<PFP>(m_map, pos_v, pred)) ;
m_approximators.push_back(new Algo::Surface::Decimation::Approximator_MidEdge<PFP>(m_map, pos_v, pred)) ;
break ; }
case Algo::Decimation::A_TangentPredict2 : {
Algo::Decimation::Predictor_TangentPredict2<PFP>* pred = new Algo::Decimation::Predictor_TangentPredict2<PFP>(m_map, m_position) ;
case Algo::Surface::Decimation::A_TangentPredict2 : {
Algo::Surface::Decimation::Predictor_TangentPredict2<PFP>* pred = new Algo::Surface::Decimation::Predictor_TangentPredict2<PFP>(m_map, m_position) ;
m_predictors.push_back(pred) ;
m_approximators.push_back(new Algo::Decimation::Approximator_MidEdge<PFP>(m_map, pos_v, pred)) ;
m_approximators.push_back(new Algo::Surface::Decimation::Approximator_MidEdge<PFP>(m_map, pos_v, pred)) ;
break ; }
}
CGoGNout << "..done" << CGoGNendl ;
......@@ -91,23 +94,23 @@ void Map2MR_PM<PFP>::createPM(Algo::Decimation::SelectorType s, Algo::Decimation
CGoGNout << " creating selector.." << CGoGNflush ;
switch(s)
{
case Algo::Decimation::S_MapOrder : {
m_selector = new Algo::Decimation::EdgeSelector_MapOrder<PFP>(m_map, m_position, m_approximators, select) ;
case Algo::Surface::Decimation::S_MapOrder : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_MapOrder<PFP>(m_map, m_position, m_approximators, select) ;
break ; }
case Algo::Decimation::S_Random : {
m_selector = new Algo::Decimation::EdgeSelector_Random<PFP>(m_map, m_position, m_approximators, select) ;
case Algo::Surface::Decimation::S_Random : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_Random<PFP>(m_map, m_position, m_approximators, select) ;
break ; }
case Algo::Decimation::S_EdgeLength : {
m_selector = new Algo::Decimation::EdgeSelector_Length<PFP>(m_map, m_position, m_approximators, select) ;
case Algo::Surface::Decimation::S_EdgeLength : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_Length<PFP>(m_map, m_position, m_approximators, select) ;
break ; }
case Algo::Decimation::S_QEM : {
m_selector = new Algo::Decimation::EdgeSelector_QEM<PFP>(m_map, m_position, m_approximators, select) ;
case Algo::Surface::Decimation::S_QEM : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_QEM<PFP>(m_map, m_position, m_approximators, select) ;
break ; }
case Algo::Decimation::S_MinDetail : {
m_selector = new Algo::Decimation::EdgeSelector_MinDetail<PFP>(m_map, m_position, m_approximators, select) ;
case Algo::Surface::Decimation::S_MinDetail : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_MinDetail<PFP>(m_map, m_position, m_approximators, select) ;
break ; }
case Algo::Decimation::S_Curvature : {
m_selector = new Algo::Decimation::EdgeSelector_Curvature<PFP>(m_map, m_position, m_approximators, select) ;
case Algo::Surface::Decimation::S_Curvature : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_Curvature<PFP>(m_map, m_position, m_approximators, select) ;
break ; }
}
CGoGNout << "..done" << CGoGNendl ;
......@@ -115,17 +118,17 @@ void Map2MR_PM<PFP>::createPM(Algo::Decimation::SelectorType s, Algo::Decimation
m_initOk = true ;
CGoGNout << " initializing approximators.." << CGoGNflush ;
for(typename std::vector<Algo::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
for(typename std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
{
if(! (*it)->init())
m_initOk = false ;
if((*it)->getApproximatedAttributeName() == "position")
m_positionApproximator = reinterpret_cast<Algo::Decimation::Approximator<PFP, VEC3>*>(*it) ;
m_positionApproximator = reinterpret_cast<Algo::Surface::Decimation::Approximator<PFP, VEC3>*>(*it) ;
}
CGoGNout << "..done" << CGoGNendl ;
CGoGNout << " initializing predictors.." << CGoGNflush ;
for(typename std::vector<Algo::Decimation::PredictorGen<PFP>*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it)
for(typename std::vector<Algo::Surface::Decimation::PredictorGen<PFP>*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it)
if(! (*it)->init())
m_initOk = false ;
CGoGNout << "..done" << CGoGNendl ;
......@@ -312,6 +315,8 @@ Dart Map2MR_PM<PFP>::vertexOrigin(Dart d)
} // namespace Multiresolution
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......@@ -37,6 +37,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -180,6 +183,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -30,6 +30,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -565,6 +568,8 @@ unsigned int Map2MR<PFP>::subdivideFaceSqrt3(Dart d)
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......@@ -37,6 +37,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -91,6 +94,8 @@ public:
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -28,6 +28,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -281,6 +284,8 @@ void Map2MR<PFP>::synthesis()
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......@@ -36,6 +36,9 @@ namespace CGoGN
namespace Algo
{
namespace Volume
{
namespace MR
{
......@@ -71,7 +74,7 @@ public:
TraversorW<typename PFP::MAP> travW(m_map) ;
for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
{
typename PFP::VEC3 vc = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
vc *= 8 * m_a * m_a * m_a;
unsigned int count = 0;
......@@ -483,7 +486,7 @@ public:
TraversorW<typename PFP::MAP> travW(m_map) ;
for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
{
typename PFP::VEC3 vc = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
vc *= 8 * m_a * m_a * m_a;
unsigned int count = 0;
......@@ -799,6 +802,8 @@ public:
} // namespace MR
} // namespace Volume
} // namespace Algo
} // namespace CGoGN
......
......@@ -36,6 +36,9 @@ namespace CGoGN
namespace Algo
{
namespace Volume
{
namespace MR
{
......@@ -95,7 +98,7 @@ public:
TraversorF<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
{
typename PFP::VEC3 p = Algo::Geometry::faceCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 p = Algo::Surface::Geometry::faceCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ;
......@@ -124,11 +127,11 @@ public:
TraversorW<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
{
typename PFP::VEC3 p = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ;
if(!Algo::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d))
if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d))
{
Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
......@@ -157,7 +160,7 @@ public:
TraversorW<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
{
typename PFP::VEC3 p = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ;
......@@ -176,6 +179,8 @@ public:
} // namespace MR
} // namespace Volume
} // namespace Algo
} // namespace CGoGN
......
......@@ -35,6 +35,9 @@ namespace CGoGN
namespace Algo
{
namespace Volume
{
namespace MR
{
......@@ -112,7 +115,7 @@ public:
Traversor3VW<typename PFP::MAP> travVW(m_map, d);
for(Dart dit = travVW.begin() ; dit != travVW.end() ; dit = travVW.next())
{
Cavg += Algo::Geometry::volumeCentroid<PFP>(m_map, dit, m_position);
Cavg += Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, dit, m_position);
++degree;
}
Cavg /= degree;
......@@ -122,7 +125,7 @@ public:
Traversor3VF<typename PFP::MAP> travVF(m_map, d);
for(Dart dit = travVF.begin() ; dit != travVF.end() ; dit = travVF.next())
{
Aavg += Algo::Geometry::faceCentroid<PFP>(m_map, dit, m_position);
Aavg += Algo::Surface::Geometry::faceCentroid<PFP>(m_map, dit, m_position);
++degree;
}
Aavg /= degree;
......@@ -208,7 +211,7 @@ public:
Traversor3EW<typename PFP::MAP> travEW(m_map, d);
for(Dart dit = travEW.begin() ; dit != travEW.end() ; dit = travEW.next())
{
Cavg += Algo::Geometry::volumeCentroid<PFP>(m_map, dit, m_position);
Cavg += Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, dit, m_position);
++degree;
}
Cavg /= degree;
......@@ -218,7 +221,7 @@ public:
Traversor3EF<typename PFP::MAP> travEF(m_map, d);
for(Dart dit = travEF.begin() ; dit != travEF.end() ; dit = travEF.next())
{
Aavg += Algo::Geometry::faceCentroid<PFP>(m_map, dit, m_position);
Aavg += Algo::Surface::Geometry::faceCentroid<PFP>(m_map, dit, m_position);
++degree;
}
Aavg /= degree;
......@@ -282,10 +285,10 @@ public:
else
{
//face points
typename PFP::VEC3 C0 = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 C1 = Algo::Geometry::volumeCentroid<PFP>(m_map, m_map.phi3(d), m_position);
typename PFP::VEC3 C0 = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 C1 = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, m_map.phi3(d), m_position);
typename PFP::VEC3 A = Algo::Geometry::faceCentroid<PFP>(m_map, m_map.phi3(d), m_position);
typename PFP::VEC3 A = Algo::Surface::Geometry::faceCentroid<PFP>(m_map, m_map.phi3(d), m_position);
typename PFP::VEC3 fp = C0 + A * 2 + C1;
fp /= 4;
......@@ -319,11 +322,11 @@ public:
{
//cell points : these points are the average of the
//vertices of the lattice that bound the cell
typename PFP::VEC3 p = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ;
if(!Algo::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d))
if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d))
{
Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
m_position[midV] = p ;
......@@ -341,6 +344,8 @@ public:
} // namespace MR
} // namespace Volume
} // namespace Algo