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)
case 's':
{
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);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "catmull-clark: "<< seconds << "sec" << std::endl;
......@@ -259,11 +259,11 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int)
case 'l':
{
GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP, AttributeHandler<PFP::VEC3>, PFP::VEC3>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
Algo::Modelisation::LoopSubdivision<PFP>(myMap, position);
GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "loop: "<< seconds << "sec" << std::endl;
......@@ -276,7 +276,7 @@ void myGlutWin::myKeyboard(unsigned char keycode, int, int)
case 'd':
{
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);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "dual: "<< seconds << "sec" << std::endl;
......
......@@ -433,7 +433,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'l':
{
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);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "loop: "<< seconds << "sec" << std::endl;
......@@ -454,7 +454,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'c':
{
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);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "catmull-clark: "<< seconds << "sec" << std::endl;
......@@ -475,7 +475,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 't':
{
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);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "triangulation: "<< seconds << "sec" << std::endl;
......@@ -495,7 +495,7 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'q':
{
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);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "quadrangulation: "<< seconds << "sec" << std::endl;
......@@ -534,6 +534,64 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
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':
{
Algo::Geometry::computeLaplacianVertices<PFP>(myMap, Algo::Geometry::TOPOLOGICAL, position, laplacian) ;
......
......@@ -74,7 +74,7 @@ int main(int argc, char **argv)
AttributeHandler<PFP::VEC3> position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]);
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");
......
......@@ -51,7 +51,7 @@ private:
AttributeHandler<unsigned int> m_dartLevel ;
AttributeHandler<unsigned int> m_edgeId ;
AttribMultiVect<unsigned int>* m_nextLevelCell[NB_ORBITS] ;
AttributeMultiVector<unsigned int>* m_nextLevelCell[NB_ORBITS] ;
public:
ImplicitHierarchicalMap() ;
......@@ -214,7 +214,7 @@ public:
AttributeHandler_IHM(GenericMap* m, unsigned int idAttr) : AttributeHandler<T>(m, idAttr)
{}
AttribMultiVect<T>* getDataVector() const
AttributeMultiVector<T>* getDataVector() const
{
return AttributeHandler<T>::getDataVector() ;
}
......
......@@ -46,9 +46,9 @@ AttributeHandler_IHM<T> ImplicitHierarchicalMap::addAttribute(unsigned int orbit
if(addNextLevelCell)
{
AttribContainer& cellCont = m_attribs[orbit] ;
AttributeContainer& cellCont = m_attribs[orbit] ;
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 ;
for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i))
amv[i] = EMBNULL ;
......@@ -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->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 index = m->getEmbedding(d, orbit) ;
......@@ -355,7 +355,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
return this->m_attrib->operator[](index);
}
AttribContainer& cont = m->getAttributeContainer(orbit) ;
AttributeContainer& cont = m->getAttributeContainer(orbit) ;
unsigned int step = 0 ;
while(step < nbSteps)
{
......@@ -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->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 index = m->getEmbedding(d, orbit) ;
......
......@@ -83,7 +83,7 @@ protected:
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:
typedef typename PFP::VEC3 VEC3 ;
......
......@@ -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") ;
attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file
std::ifstream fp(filename.c_str(), std::ios::in);
......@@ -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") ;
attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file
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<
AttributeHandler<typename PFP::VEC3> positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file
std::ifstream fp(filename.c_str(), std::ios::in);
......@@ -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") ;
attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
// open file
std::ifstream fp(filename.c_str(), std::ios::binary);
......@@ -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") ;
attrNames.push_back(positions.name()) ;
AttribContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
AttributeContainer& container = m_map.getAttributeContainer(VERTEX_CELL) ;
PlyImportData pid;
......@@ -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") ;
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);
if (!fp.good())
......@@ -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") ;
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
CTMimporter ctm;
......@@ -665,7 +665,7 @@ bool MeshTablesSurface<PFP>::importCTM(const std::string& filename, std::vector<
}
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;
......@@ -720,7 +720,7 @@ void MeshTablesSurface<PFP>::extractMeshRec(AttribContainer& container, Attribut
template <typename PFP>
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") ;
attrNames.push_back(positions.name()) ;
......
......@@ -73,7 +73,7 @@ bool MeshTablesVolume<PFP>::importMesh(const std::string& filename, std::vector<
template <typename PFP>
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") ;
attrNames.push_back(positions.name()) ;
......
......@@ -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") ;
attrNames.push_back(position.name()) ;
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
AttributeContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
// open file
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
//
//
// // Attributes container for vertex orbit
// AttribContainer& vertexContainer = map.getAttributeContainer(VERTEX_ORBIT);
// AttributeContainer& vertexContainer = map.getAttributeContainer(VERTEX_ORBIT);
//
// AttributeHandler<VEC3> positions(idPositions,map);
//
......
......@@ -42,7 +42,7 @@ bool importOFFWithELERegions(typename PFP::MAP& map, const std::string& filename
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
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;
......
......@@ -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") ;
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;
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
AttributeHandler<REAL> scalaire = map.template addAttribute<REAL>(VERTEX_ORBIT, "scalar");
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;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents");
......
......@@ -22,8 +22,8 @@
* *
*******************************************************************************/
#ifndef _SUBDIVISION_H_
#define _SUBDIVISION_H_
#ifndef __SUBDIVISION_H__
#define __SUBDIVISION_H__
#include <math.h>
#include <vector>
......@@ -51,6 +51,9 @@ Dart trianguleFace(typename PFP::MAP& map, Dart d);
template <typename PFP, typename EMBV, typename EMB>
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
* warning: edges are considered here as already cut !!
......@@ -67,29 +70,40 @@ Dart quadranguleFace(typename PFP::MAP& map, Dart d);
template <typename PFP, typename EMBV, typename EMB>
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
*/
template <typename PFP, typename EMBV, typename EMB>
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
*/
template <typename PFP, typename EMBV, typename EMB>
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
*/
template <typename PFP, typename EMBV, typename EMB>
void computeDual(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ;
template <typename PFP>
void computeDual(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;
/**
* Sqrt(3) subdivision scheme
*/
template <typename PFP, typename EMBV, typename EMB>
void Sqrt3Subdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue()) ;
template <typename PFP>
void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;
/*
* TODO quadrangule volume
......@@ -111,7 +125,6 @@ void hexaCutVolume(typename PFP::MAP& map, Dart d, EMBV& attributs);
template <typename PFP, typename EMBV, typename EMB>
void quadranguleVolumes(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected = SelectorTrue());
//double betaF(unsigned int n) ;
// TODO a mettre ailleurs ?
//
......
......@@ -78,6 +78,12 @@ void trianguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect
}
}
template <typename PFP>
void trianguleFaces(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected)
{
trianguleFaces<PFP, typename PFP::TVEC3, typename PFP::VEC3>(map, position, selected) ;
}
template <typename PFP>
Dart quadranguleFace(typename PFP::MAP& map, Dart d)
{
......@@ -140,8 +146,14 @@ void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSele
}
}
template <typename PFP>
void quadranguleFaces(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected)
{
quadranguleFaces<PFP, typename PFP::TVEC3, typename PFP::VEC3>(map, position, selected) ;
}
template <typename PFP, typename EMBV, typename EMB>
void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
{
std::vector<Dart> l_middles;
std::vector<Dart> l_verts;
......@@ -261,6 +273,12 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Fun
}
}
template <typename PFP>
void CatmullClarkSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected)
{
CatmullClarkSubdivision<PFP, typename PFP::TVEC3, typename PFP::VEC3>(map, position, selected) ;
}
inline double betaF(unsigned int n)
{
switch(n)
......@@ -410,50 +428,48 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
}
}
template <typename PFP, typename EMBV, typename EMB>
void computeDual(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
template <typename PFP>
void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected)
{
LoopSubdivision<PFP, typename PFP::TVEC3, typename PFP::VEC3>(map, position, selected) ;
}
template <typename PFP>
void computeDual(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected)
{
// std::vector<EMB> lstEmbs;
// lstEmbs.reserve(map.getNbDarts()/3);
// typedef typename PFP::MAP MAP ;
// typedef typename PFP::VEC3 VEC3 ;
// typedef typename PFP::REAL REAL ;
//
// DartMarker m(map);
// for (Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if (!m.isMarked(d))
// {
// EMB center = Algo::Geometry::faceCentroidGen<PFP,EMBV,EMB>(map, d, attributs);
// m.markOrbit(FACE_ORBIT, d);
// lstEmbs.push_back(center);
// }
// }
// AutoAttributeHandler<VEC3> faceCentroid(map, FACE_ORBIT, "faceCentroid") ;
// Algo::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, selected) ;
//
// typename std::vector<EMB>::iterator itEmb = lstEmbs.begin();
// for (Dart d = map.begin(); d != map.end(); map.next(d))
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if (m.isMarked(d))
// if(m.isMarked(d))
// {
// unsigned int em = map.newCell(VERTEX_ORBIT);
// Dart dd = d;
// unsigned int em = map.newCell(VERTEX_ORBIT) ;
// Dart dd = d ;
// do
// {
// map.setDartEmbedding(map.phi2(dd),VERTEX_ORBIT,em);
// m.unmark(dd);
// dd = map.phi1(dd);
// map.setDartEmbedding(map.phi2(dd), VERTEX_ORBIT, em) ;
// m.unmark(dd) ;
// dd = map.phi1(dd) ;
// }
// while (dd != d);
// attributs[map.phi2(d)] = *itEmb;
// ++itEmb;
// while (dd != d) ;
// attributs[map.phi2(d)] = *itEmb ;
// ++itEmb ;
// }
// }
//
// map.computeDual();
// map.computeDual() ;
}
template <typename PFP, typename EMBV, typename EMB>
void Sqrt3Subdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
template <typename PFP>
void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected)
{
computeDual<PFP,EMBV,EMB>(map, attributs, selected);
trianguleFaces<PFP,EMBV,EMB>(map, attributs, selected);
computeDual<PFP>(map, position, selected);
trianguleFaces<PFP>(map, position, selected);
}
template <typename PFP, typename EMBV, typename EMB>
......
......@@ -56,7 +56,7 @@ public:
{}
~VSplit()
{
AttribContainer& cont = map.getAttributeContainer(VERTEX_ORBIT) ;
AttributeContainer& cont = map.getAttributeContainer(VERTEX_ORBIT) ;
if(approxVertexId != EMBNULL) cont.unrefLine(approxVertexId) ;
}
......@@ -68,7 +68,7 @@ public:
void setApproxV(unsigned int id)
{
if(approxVertexId == id) return ;
AttribContainer& cont = map.getAttributeContainer(VERTEX_ORBIT) ;
AttributeContainer& cont = map.getAttributeContainer(VERTEX_ORBIT) ;
if(approxVertexId != EMBNULL)
cont.unrefLine(approxVertexId) ;
if(id != EMBNULL) cont.refLine(id) ;
......@@ -79,7 +79,7 @@ public:
void setApproxE1(unsigned int id)
{
if(approxEdgeId1 == id) return ;
AttribContainer& cont = map.getAttributeContainer(EDGE_ORBIT) ;
AttributeContainer& cont = map.getAttributeContainer(EDGE_ORBIT) ;
if(approxEdgeId1 != EMBNULL)
cont.unrefLine(approxEdgeId1) ;
if(id != EMBNULL) cont.refLine(id) ;
......@@ -90,7 +90,7 @@ public:
void setApproxE2(unsigned int id)
{
if(approxEdgeId2 == id) return ;
AttribContainer& cont = map.getAttributeContainer(EDGE_ORBIT) ;
AttributeContainer& cont = map.getAttributeContainer(EDGE_ORBIT) ;
if(approxEdgeId2 != EMBNULL)
cont.unrefLine(approxEdgeId2) ;
if(id != EMBNULL) cont.refLine(id) ;
......
......@@ -69,7 +69,7 @@ void MapRender_VBO::updateData(int upType, const ATTR_HANDLER& attrib, ConvertAt
template <typename ATTR_HANDLER>
void MapRender_VBO::fillBufferDirect(unsigned int indexVBO, const ATTR_HANDLER& attrib)
{
AttribMultiVect<typename ATTR_HANDLER::DATA_TYPE>* mv = attrib.getDataVector() ;
AttributeMultiVector<typename ATTR_HANDLER::DATA_TYPE>* mv = attrib.getDataVector() ;
std::vector<void*> addr;
unsigned int byteTableSize;
......@@ -92,7 +92,7 @@ void MapRender_VBO::fillBufferDirect(unsigned int indexVBO, const ATTR_HANDLER&
template <typename ATTR_HANDLER>
void MapRender_VBO::fillBufferConvert(unsigned int indexVBO, const ATTR_HANDLER& attrib, ConvertAttrib* conv)
{
AttribMultiVect<typename ATTR_HANDLER::DATA_TYPE>* mv = attrib.getDataVector() ;
AttributeMultiVector<typename ATTR_HANDLER::DATA_TYPE>* mv = attrib.getDataVector() ;
std::vector<void*> addr;
unsigned int byteTableSize;
......
......@@ -22,12 +22,12 @@
* *
*******************************************************************************/
#ifndef __ATTRIB_CONTAINER__
#define __ATTRIB_CONTAINER__
#ifndef __ATTRIBUTE_CONTAINER__
#define __ATTRIBUTE_CONTAINER__
#include "Container/sizeblock.h"
#include "Container/holeblockref.h"
#include "Container/attribmv.h"
#include "Container/attributeMultiVector.h"
#include <vector>
#include <map>
......@@ -48,17 +48,12 @@ class RegisteredBaseAttribute;
* trous (et les indices) sont les mêmes pour tous les attributs
* On peut ajouter et enlever des attributs a la volée
*/
class AttribContainer
class AttributeContainer
{
protected:
typedef std::map<std::string, unsigned int> MapNameId;
/**
* counter for attributes without name
*/
unsigned int m_nbunknown;
/**
* vecteur des blocs qui gerent les cases libres
*/
......@@ -74,7 +69,7 @@ protected:
/**
* vecteur de pointeur sur les gestionnaires d'attributs
*/
std::vector<AttribMultiVectGen*> m_tableAttribs;
std::vector<AttributeMultiVectorGen*> m_tableAttribs;
/**
* map de correspondance string / indice pour les attributs
......@@ -88,6 +83,11 @@ protected:
*/
unsigned int m_nbAttributes;
/**
* counter for attributes without name
*/
unsigned int m_nbUnknown;
/**
* size (number of elts) of the container
*/
......@@ -142,12 +142,12 @@ public:
/**
* constructor
*/
AttribContainer();
AttributeContainer();
/**
* destructor
*/
~AttribContainer();
~AttributeContainer();
/**
* is the line used in the container
......@@ -162,12 +162,12 @@ public:
/**
* swapping
*/
void swap(AttribContainer&);
void swap(AttributeContainer&);
/**
* merge
*/
void merge(AttribContainer& cont);
void merge(AttributeContainer& cont);
/**
* extract orbit from code (orbit & id)
......@@ -331,9 +331,9 @@ public:
* @param codeAttrib code de l'attribut
*/
template<typename T>
AttribMultiVect<T>& getDataVector(unsigned int codeAttrib);