/******************************************************************************* * CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps * * version 0.1 * * Copyright (C) 2009, 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: https://iggservis.u-strasbg.fr/CGoGN/ * * Contact information: cgogn@unistra.fr * * * *******************************************************************************/ #ifndef __PMESH__ #define __PMESH__ #include "Algo/ProgressiveMesh/vsplit.h" #include "Algo/Decimation/selector.h" #include "Algo/Decimation/edgeSelector.h" #include "Algo/Decimation/geometryApproximator.h" #include "Algo/Decimation/geometryPredictor.h" #include "Algo/Decimation/lightfieldApproximator.h" #include "Utils/quantization.h" namespace CGoGN { namespace Algo { namespace PMesh { template class ProgressiveMesh { public: typedef typename PFP::MAP MAP ; typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::REAL REAL ; private: MAP& m_map ; typename PFP::TVEC3& positionsTable ; DartMarker& inactiveMarker ; SelectorUnmarked dartSelect ; Algo::Decimation::EdgeSelector* m_selector ; std::vector*> m_approximators ; std::vector*> m_predictors ; std::vector*> m_splits ; unsigned int m_cur ; Algo::Decimation::Approximator* m_positionApproximator ; bool m_initOk ; double m_detailAmount ; bool m_localFrameDetailVectors ; std::vector originalDetailVectors ; bool quantizationInitialized, quantizationApplied ; Quantization* q ; public: ProgressiveMesh( MAP& map, DartMarker& inactive, Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a, typename PFP::TVEC3& position ) ; ~ProgressiveMesh() ; bool initOk() { return m_initOk ; } void createPM(unsigned int percentWantedVertices) ; std::vector*>& splits() { return m_splits ; } Algo::Decimation::EdgeSelector* selector() { return m_selector ; } std::vector*>& approximators() { return m_approximators ; } std::vector*>& predictors() { return m_predictors ; } void edgeCollapse(VSplit* vs) ; void vertexSplit(VSplit* vs) ; void coarsen() ; void refine() ; void gotoLevel(unsigned int goal) ; unsigned int& currentLevel() { return m_cur ; } unsigned int nbSplits() { return m_splits.size() ; } void recomputeApproxAndDetails() ; double detailAmount() { return m_detailAmount ; } void setDetailAmount(double a) ; void localizeDetailVectors() ; void globalizeDetailVectors() ; void quantizeDetailVectors(unsigned int nbClasses) ; void quantizeDetailVectors(float distortion) ; void resetDetailVectors() ; // float getDifferentialEntropy() { return q->getDifferentialEntropy() ; } // float getDiscreteEntropy() { return q->getDiscreteEntropy() ; } // void calculCourbeDebitDistortion(float distortion) ; private: void initQuantization() ; } ; } //namespace PMesh } //namespace Algo } //namespace CGoGN #include "Algo/ProgressiveMesh/pmesh.hpp" #endif