Commit 50a9f367 authored by untereiner's avatar untereiner

starting working on MR Progressive Meshes

parent 00a75e94
......@@ -120,7 +120,6 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector
CGoGNout << "TYPE: PLYSLFgenericBin" << CGoGNendl;
return importPlySLFgenericBin(filename, attrNames);
break;
case ImportSurfacique::OBJ:
CGoGNout << "TYPE: OBJ" << CGoGNendl;
return importObj(filename, attrNames);
......@@ -591,7 +590,7 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector<
CGoGNerr << "Unable to open file " << filename << CGoGNendl;
return false;
}
AttributeHandler<typename PFP::VEC3> colors = m_map.template getAttribute<typename PFP::VEC3>(VERTEX, "color") ;
if (pid.hasColors())
{
......
......@@ -268,8 +268,8 @@ bool importMeshV(typename PFP::MAP& map, const std::string& filename, std::vecto
if ((filename.rfind(".tet") != std::string::npos) || (filename.rfind(".TET") != std::string::npos))
kind = ImportVolumique::TET;
if ((filename.rfind(".ele") != std::string::npos) || (filename.rfind(".ELE") != std::string::npos))
kind = ImportVolumique::ELE;
if ((filename.rfind(".off") != std::string::npos) || (filename.rfind(".OFF") != std::string::npos))
kind = ImportVolumique::OFF;
if ((filename.rfind(".ts") != std::string::npos) || (filename.rfind(".TS") != std::string::npos))
kind = ImportVolumique::TS;
......
......@@ -323,7 +323,7 @@ public:
/**
* Traverse volumes adjacent to a volumee by a vertex
* Traverse volumes adjacent to a volume by a vertex
*/
template <typename MAP>
class Traversor3WWaV: public Traversor3XXaY<MAP>
......@@ -333,7 +333,7 @@ public:
};
/**
* Traverse volumes adjacent to a volumee by an edge
* Traverse volumes adjacent to a volume by an edge
*/
template <typename MAP>
class Traversor3WWaE: public Traversor3XXaY<MAP>
......@@ -343,7 +343,7 @@ public:
};
/**
* Traverse volumes adjacent to a volumee by a face
* Traverse volumes adjacent to a volume by a face
*/
template <typename MAP>
class Traversor3WWaF: public Traversor3XXaY<MAP>
......
/*******************************************************************************
* 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 __MAP2MR_PM__
#define __MAP2MR_PM__
#include "Topology/map/embeddedMap2.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include "Topology/map/map2MR/filters_Primal.h"
#include "Algo/Modelisation/subdivision.h"
namespace CGoGN
{
class SelectorCollapsingEdges : public FunctorSelect
{
protected:
const DartMarker& m_dm;
public:
SelectorCollapsingEdges(const DartMarker& dm): m_dm(dm) {}
bool operator()(Dart d) const { return m_dm.isMarked(d); }
FunctorSelect* copy() const { return new SelectorCollapsingEdges(m_dm);}
};
class Map2MR_PM : public EmbeddedMap2
{
protected:
bool shareVertexEmbeddings ;
std::vector<Multiresolution::MRFilter*> synthesisFilters ;
std::vector<Multiresolution::MRFilter*> analysisFilters ;
DartMarkerStore* selectedEdges;
public:
Map2MR_PM() ;
virtual std::string mapTypeName() const { return "Map2MR_PM" ; }
void addNewLevel(bool embedNewVertices = true) ;
void addSynthesisFilter(Multiresolution::MRFilter* f) { synthesisFilters.push_back(f) ; }
void addAnalysisFilter(Multiresolution::MRFilter* f) { analysisFilters.push_back(f) ; }
void clearSynthesisFilters() { synthesisFilters.clear() ; }
void clearAnalysisFilters() { analysisFilters.clear() ; }
void analysis() ;
void synthesis() ;
} ;
} ;
} // namespace CGoGN
#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 "Topology/map/map2MR/map2MR_PM.h"
namespace CGoGN
{
Map2MR_PM::Map2MR_PM() :
shareVertexEmbeddings(true)
{
initMR() ;
}
void Map2MR_PM::addNewLevel(bool embedNewVertices)
{
pushLevel() ;
//Add the current level higher
unsigned int newLevel = m_mrDarts.size() ;
std::stringstream ss ;
ss << "MRdart_"<< newLevel ;
AttributeMultiVector<unsigned int>* newAttrib = m_mrattribs.addAttribute<unsigned int>(ss.str()) ;
m_mrDarts.push_back(newAttrib) ;
m_mrNbDarts.push_back(0) ;
if(m_mrDarts.size() > 1)
{
for(unsigned int i = newLevel; i > 0 ; --i)
{
AttributeMultiVector<unsigned int>* currentAttrib = m_mrDarts[i] ;
AttributeMultiVector<unsigned int>* prevAttrib = m_mrDarts[i - 1] ; // copy the indices of
m_mrattribs.copyAttribute(currentAttrib->getIndex(), prevAttrib->getIndex()) ; // previous level into new level
}
}
popLevel() ;
setCurrentLevel(0);
//DartMarker me(*this);
selectedEdges = new DartMarkerStore(*this);
TraversorE<Map2MR_PM> travE(*this);
for (Dart d = travE.begin(); d != travE.end(); d = travE.next())
{
if(!selectedEdges->isMarked(d))
{
if(edgeCanCollapse(d))
{
//interdire la contraction d'arete partageant un meme sommet
//interdire la contraction d'arete
//interdire la contraction d'une arete d'une face incidente au sommet de d
//=> mark incident edges of vertices adjacent to the vertex of d through a common face
Traversor2VVaF<Map2MR_PM> travVVaF(*this, d);
for (Dart dit = travVVaF.begin(); dit != travVVaF.end(); dit = travVVaF.next())
{
Dart ditV = dit;
do
{
if(!selectedEdges->isMarked(ditV))
selectedEdges->markOrbit(EDGE, ditV);
ditV = phi2(phi_1(ditV));
} while(ditV != dit);
}
//=> the same for the vertex phi2(d)
Traversor2VVaF<Map2MR_PM> travVVaF2(*this, phi2(d));
for (Dart dit = travVVaF2.begin(); dit != travVVaF2.end(); dit = travVVaF2.next())
{
Dart ditV = dit;
do
{
if(!selectedEdges->isMarked(ditV))
selectedEdges->markOrbit(EDGE, ditV);
ditV = phi2(phi_1(ditV));
} while(ditV != dit);
}
}
}
}
}
void Map2MR_PM::analysis()
{
assert(getCurrentLevel() > 0 || !"analysis : called on level 0") ;
decCurrentLevel() ;
for(unsigned int i = 0; i < analysisFilters.size(); ++i)
(*analysisFilters[i])() ;
}
void Map2MR_PM::synthesis()
{
assert(getCurrentLevel() < getMaxLevel() || !"synthesis : called on max level") ;
for(unsigned int i = 0; i < synthesisFilters.size(); ++i)
(*synthesisFilters[i])() ;
incCurrentLevel() ;
}
} // namespace CGoGN
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment