Commit b5d8570a authored by untereiner's avatar untereiner
Browse files

renaming a namespace for volumetric decimation

parent d5ff9c22
...@@ -37,7 +37,7 @@ namespace Algo ...@@ -37,7 +37,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
enum ApproximatorType enum ApproximatorType
...@@ -144,9 +144,9 @@ public: ...@@ -144,9 +144,9 @@ public:
}; };
} // namespace DecimationVolumes } // namespace Decimation
} } // namespace Volume
} // namespace Algo } // namespace Algo
......
...@@ -39,7 +39,7 @@ namespace Algo ...@@ -39,7 +39,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
template <typename PFP> template <typename PFP>
...@@ -51,9 +51,9 @@ void decimate( ...@@ -51,9 +51,9 @@ void decimate(
unsigned int percentWantedVertices unsigned int percentWantedVertices
); );
} //namespace DecimationVolumes } //namespace Decimation
} } //namesapce Volume
} //namespace Algo } //namespace Algo
......
...@@ -31,7 +31,7 @@ namespace Algo ...@@ -31,7 +31,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
template <typename PFP> template <typename PFP>
...@@ -56,10 +56,10 @@ void decimate(typename PFP::MAP& map, SelectorType s, ApproximatorType a, ...@@ -56,10 +56,10 @@ void decimate(typename PFP::MAP& map, SelectorType s, ApproximatorType a,
switch(s) switch(s)
{ {
case S_MapOrder : case S_MapOrder :
selector = new Algo::DecimationVolumes::EdgeSelector_MapOrder<PFP>(map, position, approximators) ; selector = new Algo::Volume::Decimation::EdgeSelector_MapOrder<PFP>(map, position, approximators) ;
break ; break ;
case S_Random : case S_Random :
selector = new Algo::DecimationVolumes::EdgeSelector_Random<PFP>(map, position, approximators) ; selector = new Algo::Volume::Decimation::EdgeSelector_Random<PFP>(map, position, approximators) ;
break ; break ;
default: default:
CGoGNout << "not yet implemented" << CGoGNendl; CGoGNout << "not yet implemented" << CGoGNendl;
...@@ -122,9 +122,9 @@ void decimate(typename PFP::MAP& map, SelectorType s, ApproximatorType a, ...@@ -122,9 +122,9 @@ void decimate(typename PFP::MAP& map, SelectorType s, ApproximatorType a,
delete (*it) ; delete (*it) ;
} }
} //namespace DecimationVolumes } //namespace Decimation
} } //namespace Volume
} //namespace Algo } //namespace Algo
......
...@@ -15,7 +15,7 @@ namespace Algo ...@@ -15,7 +15,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
/* /*
...@@ -186,9 +186,9 @@ public: ...@@ -186,9 +186,9 @@ public:
} //end namespace DecimationVolumes } //end namespace Decimation
} } //namespace Volume
} //end namespace Algo } //end namespace Algo
......
...@@ -35,7 +35,7 @@ namespace Algo ...@@ -35,7 +35,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
/************************************************************************************ /************************************************************************************
* MAP ORDER * * MAP ORDER *
...@@ -323,7 +323,7 @@ void EdgeSelector_SG98<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -323,7 +323,7 @@ void EdgeSelector_SG98<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// einfo.valid = true ; // einfo.valid = true ;
} }
} //end namespace DecimationVolumique } //end namespace Decimation
} } //namespace Volume
} //end namespace Algo } //end namespace Algo
} //end namespace CGoGN } //end namespace CGoGN
...@@ -36,7 +36,7 @@ namespace Algo ...@@ -36,7 +36,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
template <typename PFP> template <typename PFP>
...@@ -78,9 +78,9 @@ public: ...@@ -78,9 +78,9 @@ public:
} ; } ;
} //namespace DecimationVolumes } //namespace Decimation
} } //namespace Volume
} //namespace Algo } //namespace Algo
......
...@@ -34,7 +34,7 @@ namespace Algo ...@@ -34,7 +34,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
/************************************************************************************ /************************************************************************************
...@@ -122,9 +122,9 @@ void Approximator_HalfCollapse<PFP>::approximate(Dart d) ...@@ -122,9 +122,9 @@ void Approximator_HalfCollapse<PFP>::approximate(Dart d)
// } // }
} }
} //end namespace DecimationVolumes } //end namespace Decimation
} } //namespace Volume
} //end namespace Algo } //end namespace Algo
......
...@@ -37,7 +37,7 @@ namespace Algo ...@@ -37,7 +37,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
enum OperatorType enum OperatorType
...@@ -179,9 +179,9 @@ public: ...@@ -179,9 +179,9 @@ public:
}; };
} //end namespace DecimationVolumes } //end namespace Decimation
} } //namespace Volume
} //end namespace Algo } //end namespace Algo
......
...@@ -31,7 +31,7 @@ namespace Algo ...@@ -31,7 +31,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
/************************************************************************************ /************************************************************************************
...@@ -161,9 +161,9 @@ void OperatorList<PFP>::refine(VertexAttribute<typename PFP::VEC3>& position) ...@@ -161,9 +161,9 @@ void OperatorList<PFP>::refine(VertexAttribute<typename PFP::VEC3>& position)
} }
} //end namespace DecimationVolumes } //end namespace Decimation
} } //namespace Volume
} //end namespace Algo } //end namespace Algo
......
...@@ -13,7 +13,7 @@ namespace Algo ...@@ -13,7 +13,7 @@ namespace Algo
namespace Volume namespace Volume
{ {
namespace DecimationVolumes namespace Decimation
{ {
enum SelectorType enum SelectorType
...@@ -62,9 +62,9 @@ public: ...@@ -62,9 +62,9 @@ public:
virtual void updateWithoutCollapse() = 0; virtual void updateWithoutCollapse() = 0;
}; };
} //end namespace DecimationVolumes } //end namespace Decimation
} } //namespace Volume
} //end namespace Algo } //end namespace Algo
......
...@@ -65,14 +65,14 @@ private: ...@@ -65,14 +65,14 @@ private:
bool m_initOk ; bool m_initOk ;
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 ;
Algo::Decimation::Approximator<PFP, VEC3>* m_positionApproximator ; Algo::Surface::Decimation::Approximator<PFP, VEC3, EDGE>* m_positionApproximator ;
std::vector<Filter*> synthesisFilters ; std::vector<Algo::MR::Filter*> synthesisFilters ;
std::vector<Filter*> analysisFilters ; std::vector<Algo::MR::Filter*> analysisFilters ;
public: public:
Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position); Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position);
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
~Map2MR_PM(); ~Map2MR_PM();
//create a progressive mesh (a coarser level) //create a progressive mesh (a coarser level)
void createPM(Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a) ; void createPM(Algo::Surface::Decimation::SelectorType s, Algo::Surface::Decimation::ApproximatorType a) ;
void addNewLevel(unsigned int percentWantedVertices); void addNewLevel(unsigned int percentWantedVertices);
...@@ -94,8 +94,8 @@ public: ...@@ -94,8 +94,8 @@ public:
bool initOk() { return m_initOk; } bool initOk() { return m_initOk; }
void addSynthesisFilter(Filter* f) { synthesisFilters.push_back(f) ; } void addSynthesisFilter(Algo::MR::Filter* f) { synthesisFilters.push_back(f) ; }
void addAnalysisFilter(Filter* f) { analysisFilters.push_back(f) ; } void addAnalysisFilter(Algo::MR::Filter* f) { analysisFilters.push_back(f) ; }
void clearSynthesisFilters() { synthesisFilters.clear() ; } void clearSynthesisFilters() { synthesisFilters.clear() ; }
void clearAnalysisFilters() { analysisFilters.clear() ; } void clearAnalysisFilters() { analysisFilters.clear() ; }
......
...@@ -123,7 +123,7 @@ void Map2MR_PM<PFP>::createPM(Algo::Surface::Decimation::SelectorType s, Algo::S ...@@ -123,7 +123,7 @@ void Map2MR_PM<PFP>::createPM(Algo::Surface::Decimation::SelectorType s, Algo::S
if(! (*it)->init()) if(! (*it)->init())
m_initOk = false ; m_initOk = false ;
if((*it)->getApproximatedAttributeName() == "position") if((*it)->getApproximatedAttributeName() == "position")
m_positionApproximator = reinterpret_cast<Algo::Surface::Decimation::Approximator<PFP, VEC3>*>(*it) ; m_positionApproximator = reinterpret_cast<Algo::Surface::Decimation::Approximator<PFP, VEC3, EDGE>*>(*it) ;
} }
CGoGNout << "..done" << CGoGNendl ; CGoGNout << "..done" << CGoGNendl ;
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __MAP3MR_PM__
#define __MAP3MR_PM__
#include "Topology/map/embeddedMap3.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor3.h"
#include "Container/attributeContainer.h"
#include "Algo/DecimationVolumes/selector.h"
#include "Algo/DecimationVolumes/edgeSelector.h"
#include "Algo/DecimationVolumes/geometryApproximator.h"
#include "Algo/Multiresolution/filter.h"
namespace CGoGN
{
namespace Algo
{
namespace Volume
{
namespace MR
{
template <typename PFP>
class Map3MR_PM
{
public:
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ;
private:
MAP& m_map ;
VertexAttribute<VEC3>& m_position;
bool m_initOk ;
Algo::Volume::Decimation::EdgeSelector<PFP>* m_selector ;
std::vector<Algo::Volume::Decimation::ApproximatorGen<PFP>*> m_approximators ;
std::vector<Algo::Volume::Decimation::PredictorGen<PFP>*> m_predictors ;
Algo::Volume::Decimation::Approximator<PFP, VEC3>* m_positionApproximator ;
std::vector<Filter*> synthesisFilters ;
std::vector<Filter*> analysisFilters ;
public:
Map3MR_PM(MAP& map, VertexAttribute<VEC3>& position);
~Map3MR_PM();
//create a progressive mesh (a coarser level)
void createPM(Algo::Volume::Decimation::SelectorType s, Algo::Volume::Decimation::ApproximatorType a) ;
void addNewLevel(unsigned int percentWantedVertices);
void collapseEdge(Dart d);
//coarsen the mesh -> analysis
void coarsen() ;
//refine the mesh -> synthesis
void refine() ;
bool initOk() { return m_initOk; }
void addSynthesisFilter(Filter* f) { synthesisFilters.push_back(f) ; }
void addAnalysisFilter(Filter* f) { analysisFilters.push_back(f) ; }
void clearSynthesisFilters() { synthesisFilters.clear() ; }
void clearAnalysisFilters() { analysisFilters.clear() ; }
/**
* Given the vertex of d in the current level,
* return a dart of from the vertex of the current level
*/
Dart vertexOrigin(Dart d) ;
// /**
// * Return the level of the vertex of d in the current level map
// */
// unsigned int vertexLevel(Dart d);
} ;
} // namespace Multiresolution
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
#include "Algo/Multiresolution/Map3MR/map3MR_PM.hpp"
#endif
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Container/attributeMultiVector.h"
namespace CGoGN
{
namespace Algo
{
namespace Volume
{
namespace MR
{
template <typename PFP>
Map3MR_PM<PFP>::Map3MR_PM(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) : m_map(map), m_position(position)
{
}
template <typename PFP>
Map3MR_PM<PFP>::~Map3MR_PM()
{
if(m_selector)
delete m_selector ;
for(typename std::vector<Algo::Volume::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
delete (*it) ;
for(typename std::vector<Algo::Volume::Decimation::PredictorGen<PFP>*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it)
delete (*it) ;
}
template <typename PFP>
void Map3MR_PM<PFP>::createPM(Algo::Volume::Decimation::SelectorType s, Algo::Volume::Decimation::ApproximatorType a)
{
CGoGNout << " creating approximator and predictor.." << CGoGNflush ;
std::vector<VertexAttribute< typename PFP::VEC3>* > pos_v ;
pos_v.push_back(&m_position) ;
switch(a)
{
case Algo::Volume::Decimation::A_QEM : {
m_approximators.push_back(new Algo::Volume::Decimation::Approximator_QEM<PFP>(m_map, pos_v)) ;
break ; }
case Algo::Volume::Decimation::A_MidEdge : {
m_approximators.push_back(new Algo::Volume::Decimation::Approximator_MidEdge<PFP>(m_map, pos_v)) ;
break ; }
case Algo::Volume::Decimation::A_hHalfCollapse : {
Algo::Volume::Decimation::Predictor_HalfCollapse<PFP>* pred = new Algo::Volume::Decimation::Predictor_HalfCollapse<PFP>(m_map, m_position) ;
m_predictors.push_back(pred) ;
m_approximators.push_back(new Algo::Volume::Decimation::Approximator_HalfCollapse<PFP>(m_map, pos_v, pred)) ;
break ; }
}
CGoGNout << "..done" << CGoGNendl ;
CGoGNout << " creating selector.." << CGoGNflush ;
switch(s)
{
case Algo::Volume::Decimation::S_MapOrder : {
m_selector = new Algo::Volume::Decimation::EdgeSelector_MapOrder<PFP>(m_map, m_position, m_approximators) ;
break ; }
case Algo::Volume::Decimation::S_Random : {
m_selector = new Algo::Volume::Decimation::EdgeSelector_Random<PFP>(m_map, m_position, m_approximators) ;
break ; }
case Algo::Volume::Decimation::S_EdgeLength : {