Commit c59d85ad authored by Pierre Kraemer's avatar Pierre Kraemer

AttribContainer -> AttributeContainer

AttribMultiVec -> AttributeMultiVector
ajout fonctions subdivision avec moins de parametres template
debut tests inverse sqrt(3)
parent 742d8e66
...@@ -246,7 +246,7 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int) ...@@ -246,7 +246,7 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int)
case 's': case 's':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::CatmullClarkSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::CatmullClarkSubdivision<PFP>(myMap, position);
GLint t2 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f; GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "catmull-clark: "<< seconds << "sec" << std::endl; std::cout << "catmull-clark: "<< seconds << "sec" << std::endl;
...@@ -259,11 +259,11 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int) ...@@ -259,11 +259,11 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int)
case 'l': case 'l':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
GLint t2 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f; GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "loop: "<< seconds << "sec" << std::endl; std::cout << "loop: "<< seconds << "sec" << std::endl;
...@@ -276,7 +276,7 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int) ...@@ -276,7 +276,7 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int)
case 'd': case 'd':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::Sqrt3Subdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::Sqrt3Subdivision<PFP>(myMap, position);
GLint t2 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f; GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "dual: "<< seconds << "sec" << std::endl; std::cout << "dual: "<< seconds << "sec" << std::endl;
......
...@@ -433,7 +433,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -433,7 +433,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'l': case 'l':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
GLint t2 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f; GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "loop: "<< seconds << "sec" << std::endl; std::cout << "loop: "<< seconds << "sec" << std::endl;
...@@ -454,7 +454,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -454,7 +454,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'c': case 'c':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::CatmullClarkSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::CatmullClarkSubdivision<PFP>(myMap, position);
GLint t2 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f; GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "catmull-clark: "<< seconds << "sec" << std::endl; std::cout << "catmull-clark: "<< seconds << "sec" << std::endl;
...@@ -475,7 +475,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -475,7 +475,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 't': case 't':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::trianguleFaces<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position) ; Algo::Modelisation::trianguleFaces<PFP>(myMap, position) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f; GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "triangulation: "<< seconds << "sec" << std::endl; std::cout << "triangulation: "<< seconds << "sec" << std::endl;
...@@ -495,7 +495,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -495,7 +495,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'q': case 'q':
{ {
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::quadranguleFaces<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position) ; Algo::Modelisation::quadranguleFaces<PFP>(myMap, position) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME); GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f; GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "quadrangulation: "<< seconds << "sec" << std::endl; std::cout << "quadrangulation: "<< seconds << "sec" << std::endl;
...@@ -534,6 +534,64 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -534,6 +534,64 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
break ; break ;
} }
case '3':
{
CellMarker markVisit(myMap, VERTEX_CELL) ;
CellMarker markNoDelete(myMap, VERTEX_CELL) ;
std::vector<Dart> visited ;
visited.reserve(myMap.getNbCells(VERTEX_CELL)) ;
visited.push_back(myMap.begin()) ;
markVisit.mark(myMap.begin()) ;
for(std::vector<Dart>::iterator vertex = visited.begin(); vertex != visited.end(); ++vertex)
{
bool deleteV = true ;
if(markNoDelete.isMarked(*vertex))
deleteV = false ;
Dart vit = *vertex ;
do // add all vertex neighbors to the table
{
Dart nv = myMap.phi1(vit) ;
if(!markVisit.isMarked(nv))
{
visited.push_back(nv) ;
markVisit.mark(nv) ;
}
if(deleteV)
markNoDelete.mark(nv) ;
vit = myMap.alpha1(vit) ;
} while(vit != *vertex) ;
if(deleteV)
myMap.deleteVertex(*vertex) ;
}
// for(Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
// {
// if(!markVisit.isMarked(d))
// {
// Dart dd = myMap.phi1(d) ;
// myMap.deleteVertex(d) ;
// Dart fit = dd ;
// do
// {
// markVisit.mark(fit) ;
// fit = myMap.phi1(fit) ;
// } while(fit != dd) ;
// }
// }
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
glutPostRedisplay() ;
break ;
}
case 'a': case 'a':
{ {
Algo::Geometry::computeLaplacianVertices<PFP>(myMap, Algo::Geometry::TOPOLOGICAL, position, laplacian) ; Algo::Geometry::computeLaplacianVertices<PFP>(myMap, Algo::Geometry::TOPOLOGICAL, position, laplacian) ;
......
...@@ -74,7 +74,7 @@ int main(int argc, char **argv) ...@@ -74,7 +74,7 @@ int main(int argc, char **argv)
AttributeHandler<PFP::VEC3> position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]); AttributeHandler<PFP::VEC3> position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]);
for(unsigned int i = 0; i < nbSteps; ++i) for(unsigned int i = 0; i < nbSteps; ++i)
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position); Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Export::exportOFF<PFP>(myMap, position, "result.off"); Algo::Export::exportOFF<PFP>(myMap, position, "result.off");
......
...@@ -51,7 +51,7 @@ private: ...@@ -51,7 +51,7 @@ private:
AttributeHandler<unsigned int> m_dartLevel ; AttributeHandler<unsigned int> m_dartLevel ;
AttributeHandler<unsigned int> m_edgeId ; AttributeHandler<unsigned int> m_edgeId ;
AttribMultiVect<unsigned int>* m_nextLevelCell[NB_ORBITS] ; AttributeMultiVector<unsigned int>* m_nextLevelCell[NB_ORBITS] ;
public: public:
ImplicitHierarchicalMap() ; ImplicitHierarchicalMap() ;
...@@ -214,7 +214,7 @@ public: ...@@ -214,7 +214,7 @@ public:
AttributeHandler_IHM(GenericMap* m, unsigned int idAttr) : AttributeHandler<T>(m, idAttr) AttributeHandler_IHM(GenericMap* m, unsigned int idAttr) : AttributeHandler<T>(m, idAttr)
{} {}
AttribMultiVect<T>* getDataVector() const AttributeMultiVector<T>* getDataVector() const
{ {
return AttributeHandler<T>::getDataVector() ; return AttributeHandler<T>::getDataVector() ;
} }
......
...@@ -46,9 +46,9 @@ AttributeHandler_IHM<T> ImplicitHierarchicalMap::addAttribute(unsigned int orbit ...@@ -46,9 +46,9 @@ AttributeHandler_IHM<T> ImplicitHierarchicalMap::addAttribute(unsigned int orbit
if(addNextLevelCell) if(addNextLevelCell)
{ {
AttribContainer& cellCont = m_attribs[orbit] ; AttributeContainer& cellCont = m_attribs[orbit] ;
unsigned int index = cellCont.addAttribute<unsigned int>("nextLevelCell") ; unsigned int index = cellCont.addAttribute<unsigned int>("nextLevelCell") ;
AttribMultiVect<unsigned int>& amv = cellCont.getDataVector<unsigned int>(index) ; AttributeMultiVector<unsigned int>& amv = cellCont.getDataVector<unsigned int>(index) ;
m_nextLevelCell[orbit] = &amv ; m_nextLevelCell[orbit] = &amv ;
for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i)) for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i))
amv[i] = EMBNULL ; amv[i] = EMBNULL ;
...@@ -344,7 +344,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d) ...@@ -344,7 +344,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ; assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
unsigned int orbit = AttribContainer::orbitAttr(this->m_id) ; unsigned int orbit = AttributeContainer::orbitAttr(this->m_id) ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ; unsigned int index = m->getEmbedding(d, orbit) ;
...@@ -355,7 +355,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d) ...@@ -355,7 +355,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
return this->m_attrib->operator[](index); return this->m_attrib->operator[](index);
} }
AttribContainer& cont = m->getAttributeContainer(orbit) ; AttributeContainer& cont = m->getAttributeContainer(orbit) ;
unsigned int step = 0 ; unsigned int step = 0 ;
while(step < nbSteps) while(step < nbSteps)
{ {
...@@ -381,7 +381,7 @@ const T& AttributeHandler_IHM<T>::operator[](Dart d) const ...@@ -381,7 +381,7 @@ const T& AttributeHandler_IHM<T>::operator[](Dart d) const
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ; assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
unsigned int orbit = AttribContainer::orbitAttr(this->m_id) ; unsigned int orbit = AttributeContainer::orbitAttr(this->m_id) ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ; unsigned int index = m->getEmbedding(d, orbit) ;
......
...@@ -83,7 +83,7 @@ protected: ...@@ -83,7 +83,7 @@ protected:
static ImportSurfacique::ImportType getFileType(const std::string& filename); static ImportSurfacique::ImportType getFileType(const std::string& filename);
void extractMeshRec(AttribContainer& container, AttributeHandler<typename PFP::VEC3>& positions, const struct aiScene* scene, const struct aiNode* nd, struct aiMatrix4x4* trafo); void extractMeshRec(AttributeContainer& container, AttributeHandler<typename PFP::VEC3>& positions, const struct aiScene* scene, const struct aiNode* nd, struct aiMatrix4x4* trafo);
public: public:
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
......
...@@ -119,7 +119,7 @@ bool MeshTablesSurface<PFP>::importTrian(const std::string& filename, std::vecto ...@@ -119,7 +119,7 @@ bool MeshTablesSurface<PFP>::importTrian(const std::string& filename, std::vecto
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
std::ifstream fp(filename.c_str(), std::ios::in); std::ifstream fp(filename.c_str(), std::ios::in);
...@@ -182,7 +182,7 @@ bool MeshTablesSurface<PFP>::importTrianBinGz(const std::string& filename, std:: ...@@ -182,7 +182,7 @@ bool MeshTablesSurface<PFP>::importTrianBinGz(const std::string& filename, std::
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
igzstream fs(filename.c_str(), std::ios::in|std::ios::binary); igzstream fs(filename.c_str(), std::ios::in|std::ios::binary);
...@@ -248,7 +248,7 @@ bool MeshTablesSurface<PFP>::importOff(const std::string& filename, std::vector< ...@@ -248,7 +248,7 @@ bool MeshTablesSurface<PFP>::importOff(const std::string& filename, std::vector<
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
std::ifstream fp(filename.c_str(), std::ios::in); std::ifstream fp(filename.c_str(), std::ios::in);
...@@ -343,7 +343,7 @@ bool MeshTablesSurface<PFP>::importObj(const std::string& filename, std::vector< ...@@ -343,7 +343,7 @@ bool MeshTablesSurface<PFP>::importObj(const std::string& filename, std::vector<
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
std::ifstream fp(filename.c_str(), std::ios::binary); std::ifstream fp(filename.c_str(), std::ios::binary);
...@@ -462,7 +462,7 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector< ...@@ -462,7 +462,7 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector<
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
PlyImportData pid; PlyImportData pid;
...@@ -517,7 +517,7 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect ...@@ -517,7 +517,7 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect
AttributeHandler<typename PFP::MATRIX36> RGBfunctions = m_map.template addAttribute<typename PFP::MATRIX36>(VERTEX_ORBIT, "RGBfunctions") ; AttributeHandler<typename PFP::MATRIX36> RGBfunctions = m_map.template addAttribute<typename PFP::MATRIX36>(VERTEX_ORBIT, "RGBfunctions") ;
attrNames.push_back(RGBfunctions.name()) ; attrNames.push_back(RGBfunctions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
std::ifstream fp(filename.c_str(), std::ios::binary); std::ifstream fp(filename.c_str(), std::ios::binary);
if (!fp.good()) if (!fp.good())
...@@ -621,7 +621,7 @@ bool MeshTablesSurface<PFP>::importCTM(const std::string& filename, std::vector< ...@@ -621,7 +621,7 @@ bool MeshTablesSurface<PFP>::importCTM(const std::string& filename, std::vector<
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// Load the file using the OpenCTM API // Load the file using the OpenCTM API
CTMimporter ctm; CTMimporter ctm;
...@@ -665,7 +665,7 @@ bool MeshTablesSurface<PFP>::importCTM(const std::string& filename, std::vector< ...@@ -665,7 +665,7 @@ bool MeshTablesSurface<PFP>::importCTM(const std::string& filename, std::vector<
} }
template<typename PFP> template<typename PFP>
void MeshTablesSurface<PFP>::extractMeshRec(AttribContainer& container, AttributeHandler<typename PFP::VEC3>& positions, const struct aiScene* scene, const struct aiNode* nd, struct aiMatrix4x4* trafo) void MeshTablesSurface<PFP>::extractMeshRec(AttributeContainer& container, AttributeHandler<typename PFP::VEC3>& positions, const struct aiScene* scene, const struct aiNode* nd, struct aiMatrix4x4* trafo)
{ {
struct aiMatrix4x4 prev; struct aiMatrix4x4 prev;
...@@ -720,7 +720,7 @@ void MeshTablesSurface<PFP>::extractMeshRec(AttribContainer& container, Attribut ...@@ -720,7 +720,7 @@ void MeshTablesSurface<PFP>::extractMeshRec(AttribContainer& container, Attribut
template <typename PFP> template <typename PFP>
bool MeshTablesSurface<PFP>::importASSIMP(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importASSIMP(const std::string& filename, std::vector<std::string>& attrNames)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
......
...@@ -73,7 +73,7 @@ bool MeshTablesVolume<PFP>::importMesh(const std::string& filename, std::vector< ...@@ -73,7 +73,7 @@ bool MeshTablesVolume<PFP>::importMesh(const std::string& filename, std::vector<
template <typename PFP> template <typename PFP>
bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor=1.0f) bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<std::string>& attrNames, float scaleFactor=1.0f)
{ {
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
......
...@@ -62,7 +62,7 @@ bool importInESS(typename PFP::MAP& map, const std::string& filename, std::vecto ...@@ -62,7 +62,7 @@ bool importInESS(typename PFP::MAP& map, const std::string& filename, std::vecto
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(position.name()) ; attrNames.push_back(position.name()) ;
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
// open file // open file
std::ifstream fp(filename.c_str(), std::ios::in); std::ifstream fp(filename.c_str(), std::ios::in);
......
...@@ -457,7 +457,7 @@ bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector ...@@ -457,7 +457,7 @@ bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector
// //
// //
// // Attributes container for vertex orbit // // Attributes container for vertex orbit
// AttribContainer& vertexContainer = map.getAttributeContainer(VERTEX_ORBIT); // AttributeContainer& vertexContainer = map.getAttributeContainer(VERTEX_ORBIT);
// //
// AttributeHandler<VEC3> positions(idPositions,map); // AttributeHandler<VEC3> positions(idPositions,map);
// //
......
...@@ -42,7 +42,7 @@ bool importOFFWithELERegions(typename PFP::MAP& map, const std::string& filename ...@@ -42,7 +42,7 @@ bool importOFFWithELERegions(typename PFP::MAP& map, const std::string& filename
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(position.name()) ; attrNames.push_back(position.name()) ;
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
unsigned int m_nbVertices = 0, m_nbFaces = 0, m_nbEdges = 0, m_nbVolumes = 0; unsigned int m_nbVertices = 0, m_nbFaces = 0, m_nbEdges = 0, m_nbVolumes = 0;
......
...@@ -40,7 +40,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector< ...@@ -40,7 +40,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(position.name()) ; attrNames.push_back(position.name()) ;
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
unsigned int m_nbVertices = 0, m_nbFaces = 0, m_nbEdges = 0, m_nbVolumes = 0; unsigned int m_nbVertices = 0, m_nbFaces = 0, m_nbEdges = 0, m_nbVolumes = 0;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents"); AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents");
......
...@@ -48,7 +48,7 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s ...@@ -48,7 +48,7 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s
AttributeHandler<REAL> scalaire = map.template addAttribute<REAL>(VERTEX_ORBIT, "scalar"); AttributeHandler<REAL> scalaire = map.template addAttribute<REAL>(VERTEX_ORBIT, "scalar");
attrNames.push_back(scalaire.name()) ; attrNames.push_back(scalaire.name()) ;
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ; AttributeContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
unsigned int m_nbVertices = 0, m_nbFaces = 0, m_nbEdges = 0, m_nbVolumes = 0; unsigned int m_nbVertices = 0, m_nbFaces = 0, m_nbEdges = 0, m_nbVolumes = 0;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents"); AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents");
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#ifndef _SUBDIVISION_H_ #ifndef __SUBDIVISION_H__
#define _SUBDIVISION_H_ #define __SUBDIVISION_H__
#include <math.h> #include <math.h>
#include <vector> #include <vector>
...@@ -51,6 +51,9 @@ Dart trianguleFace(typename PFP::MAP& map, Dart d); ...@@ -51,6 +51,9 @@ Dart trianguleFace(typename PFP::MAP& map, Dart d);
template <typename PFP, typename EMBV, typename EMB> template <typename PFP, typename EMBV, typename EMB>
void trianguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ; void trianguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ;
template <typename PFP>
void trianguleFaces(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;
/** /**
* Quadrangule a face with central vertex * Quadrangule a face with central vertex
* warning: edges are considered here as already cut !! * warning: edges are considered here as already cut !!
...@@ -67,29 +70,40 @@ Dart quadranguleFace(typename PFP::MAP& map, Dart d); ...@@ -67,29 +70,40 @@ Dart quadranguleFace(typename PFP::MAP& map, Dart d);
template <typename PFP, typename EMBV, typename EMB> template <typename PFP, typename EMBV, typename EMB>
void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ; void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ;
template <typename PFP>
void quadranguleFaces(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;
/** /**
* Catmull-Clark subdivision scheme * Catmull-Clark subdivision scheme
*/ */
template <typename PFP, typename EMBV, typename EMB> template <typename PFP, typename EMBV, typename EMB>
void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ; void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ;
template <typename PFP>
void CatmullClarkSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;
/** /**
* Loop subdivision scheme * Loop subdivision scheme
*/ */
template <typename PFP, typename EMBV, typename EMB> template <typename PFP, typename EMBV, typename EMB>
void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ; void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ;
template <typename PFP>
void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;
/** /**
* Dual mesh computation * Dual mesh computation
*/ */
template <typename PFP, typename EMBV, typename EMB> template <typename PFP>
void computeDual(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ; void computeDual(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;
/** /**
* Sqrt(3) subdivision scheme * Sqrt(3) subdivision scheme
*/ */
template <typename PFP, typename EMBV, typename EMB> template <typename PFP>
void Sqrt3Subdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ; void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;