Commit 0a833f69 authored by Thomas's avatar Thomas

merge Pierre (oui ce message d'info n'est pas tres utile mais je peux pas pull cgogn sinon)

parents 7f09e5bc 3619c00b
......@@ -9,6 +9,15 @@ SET(CMAKE_BUILD_TYPE Debug)
# define includes path
include_directories(
${CGoGN_ROOT_DIR}/include
/usr/include/libxml2/
${CGoGN_ROOT_DIR}/include
${CGoGN_ROOT_DIR}/ThirdParty/Numerical
${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig
${CGoGN_ROOT_DIR}/ThirdParty/gzstream
${CGoGN_ROOT_DIR}/ThirdParty/Zinri
${CGoGN_ROOT_DIR}/ThirdParty/AntTweakBar/include
${CGoGN_ROOT_DIR}/ThirdParty/OpenCTM
${CGoGN_ROOT_DIR}/ThirdParty/Assimp/include
)
# define libs path
......@@ -26,3 +35,7 @@ target_link_libraries( Geom_orientationD
add_executable( Geom_inclusionD ./Geom_inclusion.cpp)
target_link_libraries( Geom_inclusionD
${COMMON_LIBS} )
add_executable( Algo_Geom_inclusionD ./Algo_Geom_inclusion.cpp)
target_link_libraries( Algo_Geom_inclusionD
containerD topologyD utilsD algoD ${COMMON_LIBS} )
......@@ -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,99 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
break ;
}
case 'd':
{
myMap.removeAttribute<PFP::VEC3>(normal) ;
myMap.removeAttribute<PFP::VEC3>(laplacian) ;
AttributeHandler<PFP::VEC3> newPosition = myMap.addAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
Algo::Geometry::computeCentroidFaces<PFP>(myMap, position, newPosition) ;
GLint t1 = glutGet(GLUT_ELAPSED_TIME);
Algo::Modelisation::computeDual<PFP>(myMap) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "dual computation: "<< seconds << "sec" << std::endl;
newPosition = myMap.getAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
myMap.removeAttribute<PFP::VEC3>(newPosition) ;
position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ;
normal = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ;
t1 = glutGet(GLUT_ELAPSED_TIME);
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) ;
t2 = glutGet(GLUT_ELAPSED_TIME);
seconds = (t2 - t1) / 1000.0f;
std::cout << "display update: "<< seconds << "sec" << std::endl;
glutPostRedisplay() ;
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) ;
......@@ -633,6 +726,7 @@ int main(int argc, char** argv)
std::cerr << "could not import " << filename << std::endl ;
return 1 ;
}
mgw->position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ;
......
......@@ -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");
......
......@@ -73,7 +73,7 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const typename PFP::T
* @param the point
*/
template <typename PFP>
bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& positions, const typename PFP::VEC3& point, bool CCW );
bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& positions, const typename PFP::VEC3& point, bool CCW=true);
/**
* test if a point is inside a face
......
......@@ -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() ;
......@@ -211,10 +211,10 @@ public:
AttributeHandler_IHM() : AttributeHandler<T>()
{}
AttributeHandler_IHM(GenericMap* m, unsigned int idAttr) : AttributeHandler<T>(m, idAttr)
AttributeHandler_IHM(GenericMap* m, AttributeMultiVector<T>* amv) : AttributeHandler<T>(m, amv)
{}
AttribMultiVect<T>* getDataVector() const
AttributeMultiVector<T>* getDataVector() const
{
return AttributeHandler<T>::getDataVector() ;
}
......
......@@ -46,22 +46,21 @@ AttributeHandler_IHM<T> ImplicitHierarchicalMap::addAttribute(unsigned int orbit
if(addNextLevelCell)
{
AttribContainer& cellCont = m_attribs[orbit] ;
unsigned int index = cellCont.addAttribute<unsigned int>("nextLevelCell") ;
AttribMultiVect<unsigned int>& amv = cellCont.getDataVector<unsigned int>(index) ;
m_nextLevelCell[orbit] = &amv ;
AttributeContainer& cellCont = m_attribs[orbit] ;
AttributeMultiVector<unsigned int>* amv = cellCont.addAttribute<unsigned int>("nextLevelCell") ;
m_nextLevelCell[orbit] = amv ;
for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i))
amv[i] = EMBNULL ;
amv->operator[](i) = EMBNULL ;
}
return AttributeHandler_IHM<T>(this, h.id()) ;
return AttributeHandler_IHM<T>(this, h.getDataVector()) ;
}
template <typename T>
AttributeHandler_IHM<T> ImplicitHierarchicalMap::getAttribute(unsigned int orbit, const std::string& nameAttr)
{
AttributeHandler<T> h = Map2::getAttribute<T>(orbit, nameAttr) ;
return AttributeHandler_IHM<T>(this, h.id()) ;
return AttributeHandler_IHM<T>(this, h.getDataVector()) ;
}
/***************************************************
......@@ -333,6 +332,10 @@ inline unsigned int ImplicitHierarchicalMap::edgeLevel(Dart d)
return ld < ldd ? ldd : ld ; // insertion levels of its two darts
}
/***************************************************
* ATTRIBUTE HANDLER *
***************************************************/
template <typename T>
T& AttributeHandler_IHM<T>::operator[](Dart d)
{
......@@ -340,7 +343,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 = this->m_orbit ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ;
......@@ -351,7 +354,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)
{
......@@ -377,7 +380,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 = this->m_orbit ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ;
......
......@@ -149,11 +149,9 @@ void coarsenEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
unsigned int cur = map.getCurrentLevel() ;
Dart d2 = map.phi2(d) ;
map.setCurrentLevel(cur + 1) ;
map.unsewFaces(d) ;
map.unsewFaces(d2) ;
map.collapseEdge(map.phi1(d)) ;
map.collapseEdge(map.phi1(d2)) ;
map.sewFaces(d, d2) ;
unsigned int dl = map.getDartLevel(d2) ;
map.setDartLevel(map.phi1(d2), dl) ;
map.collapseEdge(d2) ;
map.setCurrentLevel(cur) ;
}
......
......@@ -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);
......
......@@ -40,7 +40,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
typedef typename PFP::VEC3 VEC3 ;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents");
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents");
unsigned nbf = mts.getNbFaces();
int index = 0;
......@@ -106,7 +106,6 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
if (good_dart != Dart::nil())
{
Dart aze = map.phi2(good_dart) ;
if (good_dart == map.phi2(good_dart))
{
map.sewFaces(d, good_dart);
......@@ -457,7 +456,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, 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)
{