Commit 70b2a513 authored by Pierre Kraemer's avatar Pierre Kraemer

orbit as template -> viewer OK

parent cb1ede68
...@@ -201,7 +201,7 @@ void Viewer::importMesh(std::string& filename) ...@@ -201,7 +201,7 @@ void Viewer::importMesh(std::string& filename)
if (extension == std::string(".map")) if (extension == std::string(".map"))
{ {
myMap.loadMapBin(filename); myMap.loadMapBin(filename);
position = myMap.getAttribute<PFP::VEC3>(VERTEX, "position") ; position = myMap.getAttribute<PFP::VEC3, VERTEX>("position") ;
} }
else else
{ {
...@@ -211,7 +211,7 @@ void Viewer::importMesh(std::string& filename) ...@@ -211,7 +211,7 @@ void Viewer::importMesh(std::string& filename)
CGoGNerr << "could not import " << filename << CGoGNendl ; CGoGNerr << "could not import " << filename << CGoGNendl ;
return; return;
} }
position = myMap.getAttribute<PFP::VEC3>(VERTEX, attrNames[0]) ; position = myMap.getAttribute<PFP::VEC3, VERTEX>(attrNames[0]) ;
} }
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS) ;
...@@ -224,9 +224,9 @@ void Viewer::importMesh(std::string& filename) ...@@ -224,9 +224,9 @@ void Viewer::importMesh(std::string& filename)
normalBaseSize = bb.diagSize() / 100.0f ; normalBaseSize = bb.diagSize() / 100.0f ;
// vertexBaseSize = normalBaseSize / 5.0f ; // vertexBaseSize = normalBaseSize / 5.0f ;
normal = myMap.getAttribute<PFP::VEC3>(VERTEX, "normal") ; normal = myMap.getAttribute<PFP::VEC3, VERTEX>("normal") ;
if(!normal.isValid()) if(!normal.isValid())
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal") ; normal = myMap.addAttribute<PFP::VEC3, VERTEX>("normal") ;
Algo::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ; Algo::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ;
...@@ -246,7 +246,7 @@ void Viewer::exportMesh(std::string& filename) ...@@ -246,7 +246,7 @@ void Viewer::exportMesh(std::string& filename)
Algo::Export::exportOFF<PFP>(myMap, position, filename.c_str(), allDarts) ; Algo::Export::exportOFF<PFP>(myMap, position, filename.c_str(), allDarts) ;
else if (extension.compare(0, 4, std::string(".ply")) == 0) else if (extension.compare(0, 4, std::string(".ply")) == 0)
{ {
std::vector<PFP::TVEC3*> attributes ; std::vector<AttributeHandler<VEC3, VERTEX>*> attributes ;
attributes.push_back(&position) ; attributes.push_back(&position) ;
Algo::Export::exportPLYnew<PFP>(myMap, attributes, filename.c_str(), true, allDarts) ; Algo::Export::exportPLYnew<PFP>(myMap, attributes, filename.c_str(), true, allDarts) ;
} }
......
...@@ -59,6 +59,7 @@ struct PFP: public PFP_STANDARD ...@@ -59,6 +59,7 @@ struct PFP: public PFP_STANDARD
}; };
typedef PFP::MAP MAP ; typedef PFP::MAP MAP ;
typedef PFP::VEC3 VEC3 ;
class Viewer : public Utils::QT::SimpleQT class Viewer : public Utils::QT::SimpleQT
{ {
...@@ -92,8 +93,8 @@ public: ...@@ -92,8 +93,8 @@ public:
bool m_drawNormals ; bool m_drawNormals ;
bool m_drawTopo ; bool m_drawTopo ;
PFP::TVEC3 position ; AttributeHandler<VEC3, VERTEX> position ;
PFP::TVEC3 normal ; AttributeHandler<VEC3, VERTEX> normal ;
Algo::Render::GL2::MapRender* m_render ; Algo::Render::GL2::MapRender* m_render ;
Algo::Render::GL2::TopoRender* m_topoRender ; Algo::Render::GL2::TopoRender* m_topoRender ;
......
...@@ -46,7 +46,7 @@ namespace Export ...@@ -46,7 +46,7 @@ namespace Export
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const bool binary, const FunctorSelect& good = allDarts) ; bool exportPLY(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const bool binary, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a PLY file * export the map into a PLY file
...@@ -57,7 +57,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -57,7 +57,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* >& attributeHandlers, const char* filename, const bool binary, const FunctorSelect& good = allDarts) ; bool exportPLYnew(typename PFP::MAP& map, const std::vector<AttributeHandler<typename PFP::VEC3, VERTEX>* >& attributeHandlers, const char* filename, const bool binary, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a OFF file * export the map into a OFF file
...@@ -66,7 +66,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* ...@@ -66,7 +66,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ; bool exportOFF(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a Trian file * export the map into a Trian file
...@@ -75,7 +75,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -75,7 +75,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, char* filename, const FunctorSelect& good = allDarts) ; bool exportTrian(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, char* filename, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format). * export the map into a PLYPTMgeneric file (K. Vanhoey generic format).
...@@ -90,7 +90,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch ...@@ -90,7 +90,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch
* @return true * @return true
*/ */
//template <typename PFP> //template <typename PFP>
//bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ; //bool exportPlySLFgeneric(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format). * export the map into a PLYPTMgeneric file (K. Vanhoey generic format).
...@@ -105,7 +105,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch ...@@ -105,7 +105,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch
* @return true * @return true
*/ */
//template <typename PFP> //template <typename PFP>
//bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ; //bool exportPlySLFgenericBin(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a PLYSLF file (K. Vanhoey generic format). * export the map into a PLYSLF file (K. Vanhoey generic format).
...@@ -120,7 +120,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch ...@@ -120,7 +120,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ; bool exportPlyPTMgeneric(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format) * export the map into a PLYPTMgeneric file (K. Vanhoey generic format)
...@@ -132,7 +132,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -132,7 +132,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good = allDarts) ; bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const AttributeHandler<typename PFP::VEC3, VERTEX> frame[3], const AttributeHandler<typename PFP::VEC3, VERTEX> colorPTM[6], const FunctorSelect& good = allDarts) ;
} // namespace Export } // namespace Export
......
...@@ -38,7 +38,7 @@ namespace Export ...@@ -38,7 +38,7 @@ namespace Export
{ {
template <typename PFP> template <typename PFP>
bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, bool binary, const FunctorSelect& good) bool exportPLY(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, bool binary, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
...@@ -67,7 +67,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -67,7 +67,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
vertices.reserve(nbDarts/6) ; vertices.reserve(nbDarts/6) ;
// Go over all faces // Go over all faces
CellMarker markV(map, VERTEX) ; CellMarker<VERTEX> markV(map) ;
TraversorF<MAP> t(map, good) ; TraversorF<MAP> t(map, good) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Dart d = t.begin(); d != t.end(); d = t.next())
{ {
...@@ -78,7 +78,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -78,7 +78,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next()) for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{ {
++degree ; ++degree ;
unsigned int vNum = map.getEmbedding<VERTEX>(it) ; unsigned int vNum = map.template getEmbedding<VERTEX>(it) ;
if(!markV.isMarked(it)) if(!markV.isMarked(it))
{ {
markV.mark(it) ; markV.mark(it) ;
...@@ -165,7 +165,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -165,7 +165,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
} }
template <typename PFP> template <typename PFP>
bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*>& attributeHandlers, const char* filename, bool binary, const FunctorSelect& good) bool exportPLYnew(typename PFP::MAP& map, const std::vector<AttributeHandler<typename PFP::VEC3, VERTEX>*>& attributeHandlers, const char* filename, bool binary, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
...@@ -194,7 +194,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* ...@@ -194,7 +194,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*
vertices.reserve(nbDarts/6) ; vertices.reserve(nbDarts/6) ;
// Go over all faces // Go over all faces
CellMarker markV(map, VERTEX) ; CellMarker<VERTEX> markV(map) ;
TraversorF<MAP> t(map, good) ; TraversorF<MAP> t(map, good) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Dart d = t.begin(); d != t.end(); d = t.next())
{ {
...@@ -205,7 +205,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* ...@@ -205,7 +205,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next()) for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{ {
++degree ; ++degree ;
unsigned int vNum = map.getEmbedding<VERTEX>(it) ; unsigned int vNum = map.template getEmbedding<VERTEX>(it) ;
if(!markV.isMarked(it)) if(!markV.isMarked(it))
{ {
markV.mark(it) ; markV.mark(it) ;
...@@ -241,7 +241,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* ...@@ -241,7 +241,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*
out << "comment or contact : cgogn@unistra.fr" << std::endl ; out << "comment or contact : cgogn@unistra.fr" << std::endl ;
// Vertex elements // Vertex elements
out << "element vertex " << vertices.size() << std::endl ; out << "element vertex " << vertices.size() << std::endl ;
for (typename std::vector<typename PFP::TVEC3* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) for (typename std::vector<AttributeHandler<typename PFP::VEC3, VERTEX>* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler)
{ {
if ((*attrHandler)->isValid() && ((*attrHandler)->getOrbit() == VERTEX) ) if ((*attrHandler)->isValid() && ((*attrHandler)->getOrbit() == VERTEX) )
{ {
...@@ -281,7 +281,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* ...@@ -281,7 +281,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*
{ {
// ascii vertices // ascii vertices
for(unsigned int i = 0; i < vertices.size(); ++i) for(unsigned int i = 0; i < vertices.size(); ++i)
for (typename std::vector<typename PFP::TVEC3* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) for (typename std::vector<AttributeHandler<typename PFP::VEC3, VERTEX>* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler)
if ((*attrHandler)->isValid() && (*attrHandler)->getOrbit() == VERTEX) if ((*attrHandler)->isValid() && (*attrHandler)->getOrbit() == VERTEX)
out << (*(*attrHandler))[vertices[i]] << std::endl ; out << (*(*attrHandler))[vertices[i]] << std::endl ;
...@@ -298,7 +298,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* ...@@ -298,7 +298,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*
{ {
// binary vertices // binary vertices
for(unsigned int i = 0; i < vertices.size(); ++i) for(unsigned int i = 0; i < vertices.size(); ++i)
for (typename std::vector<typename PFP::TVEC3*>::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) for (typename std::vector<AttributeHandler<typename PFP::VEC3, VERTEX>*>::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler)
if ((*attrHandler)->isValid() && (*attrHandler)->getOrbit() == VERTEX) if ((*attrHandler)->isValid() && (*attrHandler)->getOrbit() == VERTEX)
{ {
const typename PFP::VEC3& v = (*(*attrHandler))[vertices[i]] ; const typename PFP::VEC3& v = (*(*attrHandler))[vertices[i]] ;
...@@ -320,7 +320,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* ...@@ -320,7 +320,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*
} }
template <typename PFP> template <typename PFP>
bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good) bool exportOFF(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
...@@ -342,7 +342,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -342,7 +342,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
std::vector<unsigned int> vertices ; std::vector<unsigned int> vertices ;
vertices.reserve(nbDarts/6) ; vertices.reserve(nbDarts/6) ;
CellMarker markV(map, VERTEX) ; CellMarker<VERTEX> markV(map) ;
TraversorF<MAP> t(map, good) ; TraversorF<MAP> t(map, good) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Dart d = t.begin(); d != t.end(); d = t.next())
{ {
...@@ -353,7 +353,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -353,7 +353,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next()) for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{ {
++degree ; ++degree ;
unsigned int vNum = map.getEmbedding<VERTEX>(it) ; unsigned int vNum = map.template getEmbedding<VERTEX>(it) ;
if(!markV.isMarked(it)) if(!markV.isMarked(it))
{ {
markV.mark(it) ; markV.mark(it) ;
...@@ -387,13 +387,11 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -387,13 +387,11 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
} }
template <typename PFP> template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good) bool exportPlyPTMgeneric(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
typedef typename PFP::TVEC3 TVEC3;
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
typedef typename PFP::TREAL TREAL;
std::ofstream out(filename, std::ios::out) ; std::ofstream out(filename, std::ios::out) ;
if (!out.good()) if (!out.good())
...@@ -402,8 +400,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -402,8 +400,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
return false ; return false ;
} }
AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX); AutoAttributeHandler<unsigned int, VERTEX> tableVertLab(map);
unsigned int nbDarts = map.getNbDarts() ; unsigned int nbDarts = map.getNbDarts() ;
...@@ -413,7 +410,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -413,7 +410,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
vertices.reserve(nbDarts/5); // TODO non optimal reservation vertices.reserve(nbDarts/5); // TODO non optimal reservation
faces.reserve(nbDarts/3); faces.reserve(nbDarts/3);
CellMarker markV(map, VERTEX); CellMarker<VERTEX> markV(map);
TraversorF<MAP> t(map, good) ; TraversorF<MAP> t(map, good) ;
unsigned int lab = 0; unsigned int lab = 0;
unsigned int nbf = 0; unsigned int nbf = 0;
...@@ -427,7 +424,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -427,7 +424,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
{ {
markV.mark(it); markV.mark(it);
tableVertLab[it] = lab++; tableVertLab[it] = lab++;
vertices.push_back(map.getEmbedding<VERTEX>(it)); vertices.push_back(map.template getEmbedding<VERTEX>(it));
} }
face.push_back(tableVertLab[it]); face.push_back(tableVertLab[it]);
} }
...@@ -439,13 +436,13 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -439,13 +436,13 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
++nbf; ++nbf;
} }
TVEC3 frame[3] ; AttributeHandler<VEC3, VERTEX> frame[3] ;
TVEC3 colorPTM[15] ; AttributeHandler<VEC3, VERTEX> colorPTM[15] ;
frame[0] = map.template getAttribute<VEC3>(VERTEX, "frame_T") ; frame[0] = map.template getAttribute<VEC3>(VERTEX, "frame_T") ;
frame[1] = map.template getAttribute<VEC3>(VERTEX, "frame_B") ; frame[1] = map.template getAttribute<VEC3>(VERTEX, "frame_B") ;
frame[2] = map.template getAttribute<VEC3>(VERTEX, "frame_N") ; frame[2] = map.template getAttribute<VEC3>(VERTEX, "frame_N") ;
for (unsigned i = 0 ; i < 15 ; ++i) for (unsigned int i = 0 ; i < 15 ; ++i)
{ {
std::stringstream name ; std::stringstream name ;
name << "colorPTM_a" << i ; name << "colorPTM_a" << i ;
...@@ -476,9 +473,9 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -476,9 +473,9 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI) for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float C2_a" << coefI << std::endl ; out << "property float C2_a" << coefI << std::endl ;
TREAL errL2 = map.template getAttribute<REAL>(VERTEX,"errL2") ; AttributeHandler<REAL, VERTEX> errL2 = map.template getAttribute<REAL>(VERTEX, "errL2") ;
TREAL errLmax = map.template getAttribute<REAL>(VERTEX,"errLmax") ; AttributeHandler<REAL, VERTEX> errLmax = map.template getAttribute<REAL>(VERTEX, "errLmax") ;
TREAL stdDev = map.template getAttribute<REAL>(VERTEX,"stdDev") ; AttributeHandler<REAL, VERTEX> stdDev = map.template getAttribute<REAL>(VERTEX, "stdDev") ;
if (errL2.isValid()) if (errL2.isValid())
out << "property float errL2" << std::endl ; out << "property float errL2" << std::endl ;
if (errLmax.isValid()) if (errLmax.isValid())
...@@ -529,13 +526,11 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -529,13 +526,11 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
} }
/* /*
template <typename PFP> template <typename PFP>
bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good) bool exportPlySLFgeneric(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
typedef typename PFP::TVEC3 TVEC3;
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
typedef typename PFP::TREAL TREAL;
std::ofstream out(filename, std::ios::out) ; std::ofstream out(filename, std::ios::out) ;
if (!out.good()) if (!out.good())
...@@ -546,7 +541,6 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -546,7 +541,6 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX); AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX);
unsigned int nbDarts = map.getNbDarts() ; unsigned int nbDarts = map.getNbDarts() ;
std::vector<unsigned int> vertices; std::vector<unsigned int> vertices;
...@@ -581,7 +575,7 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -581,7 +575,7 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
++nbf; ++nbf;
} }
TVEC3 frame[3] ; AttributeHandler<typename PFP::VEC3, VERTEX> frame[3] ;
std::vector<TVEC3> coefs ; std::vector<TVEC3> coefs ;
frame[0] = map.template getAttribute<VEC3>(VERTEX, "frame_T") ; frame[0] = map.template getAttribute<VEC3>(VERTEX, "frame_T") ;
...@@ -663,13 +657,11 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -663,13 +657,11 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
} }
template <typename PFP> template <typename PFP>
bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good) bool exportPlySLFgenericBin(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const char* filename, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
typedef typename PFP::TVEC3 TVEC3;
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
typedef typename PFP::TREAL TREAL;
std::ofstream out(filename, std::ios::out) ; std::ofstream out(filename, std::ios::out) ;
if (!out.good()) if (!out.good())
...@@ -806,7 +798,7 @@ bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& p ...@@ -806,7 +798,7 @@ bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& p
*/ */
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good) bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, const AttributeHandler<typename PFP::VEC3, VERTEX> frame[3], const AttributeHandler<typename PFP::VEC3, VERTEX> colorPTM[6], const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
...@@ -818,7 +810,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -818,7 +810,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
return false ; return false ;
} }
AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX); AutoAttributeHandler<unsigned int, VERTEX> tableVertLab(map);
unsigned int nbDarts = map.getNbDarts() ; unsigned int nbDarts = map.getNbDarts() ;
...@@ -828,7 +820,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -828,7 +820,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
vertices.reserve(nbDarts/5); // TODO non optimal reservation vertices.reserve(nbDarts/5); // TODO non optimal reservation
faces.reserve(nbDarts/3); faces.reserve(nbDarts/3);
CellMarker markV(map, VERTEX); CellMarker<VERTEX> markV(map);
TraversorF<MAP> t(map, good) ; TraversorF<MAP> t(map, good) ;
unsigned int lab = 0; unsigned int lab = 0;
unsigned int nbf = 0; unsigned int nbf = 0;
...@@ -842,7 +834,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -842,7 +834,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
{ {
markV.mark(it); markV.mark(it);
tableVertLab[it] = lab++; tableVertLab[it] = lab++;
vertices.push_back(map.getEmbedding<VERTEX>(it)); vertices.push_back(map.template getEmbedding<VERTEX>(it));
} }
face.push_back(tableVertLab[it]); face.push_back(tableVertLab[it]);
} }
......
...@@ -35,34 +35,34 @@ namespace Geometry ...@@ -35,34 +35,34 @@ namespace Geometry
{ {
template <typename PFP> template <typename PFP>
typename PFP::REAL triangleArea(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position) ; typename PFP::REAL triangleArea(typename PFP::MAP& map, Dart d, const AttributeHandler<typename PFP::VEC3, VERTEX>& position) ;
template <typename PFP> template <typename PFP>
typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position) ; typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Dart d, const AttributeHandler<typename PFP::VEC3, VERTEX>& position) ;
template <typename PFP> template <typename PFP>
typename PFP::REAL totalArea(typename PFP::MAP& map, const typename PFP::TVEC3& position, const FunctorSelect& select = allDarts, unsigned int thread = 0) ;