Commit cc9276e7 authored by Pierre Kraemer's avatar Pierre Kraemer

decimationVolumique ok

parent 7e940260
......@@ -348,12 +348,10 @@ void maillageTest()
int main(int argc, char **argv)
{
//Initilisation du plongement geometrique
position = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "position");
/*
* Chargement de maillages
*/
std::vector<std::string> attrNames ;
if(argc < 2)
{
std::cerr << "usage : " << argv[0] << " -off" << std::endl;
......@@ -371,7 +369,8 @@ int main(int argc, char **argv)
return 1;
}
Algo::Import::importOFFWithELERegions<PFP>(myMap,position,argv[2],argv[3]);
Algo::Import::importOFFWithELERegions<PFP>(myMap,argv[2],argv[3],attrNames);
position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]) ;
}
else if(std::string(argv[1]) == "-tet")
{
......@@ -380,7 +379,8 @@ int main(int argc, char **argv)
return 1;
}
Algo::Import::importTet<PFP>(myMap,position,argv[2]);
Algo::Import::importTet<PFP>(myMap,argv[2],attrNames);
position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]) ;
}
else if(std::string(argv[1]) == "-ts")
{
......@@ -389,7 +389,8 @@ int main(int argc, char **argv)
return 1;
}
Algo::Import::importTs<PFP>(myMap,position,argv[2]);
Algo::Import::importTs<PFP>(myMap,argv[2],attrNames);
position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]) ;
//scalar = myMap.getAttribute<PFP::REAL>(VERTEX_ORBIT, "scalar");
}
......
......@@ -21,6 +21,7 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __DECIMATIONVOLUMIQUE__
#define __DECIMATIONVOLUMIQUE__
......@@ -45,30 +46,25 @@
using namespace CGoGN ;
struct PFP {
// definition de la carte
struct PFP
{
// definition of the map
typedef Map3 MAP;
// definition du type de reel utilise
// definition of the type of real value
typedef float REAL;
// definition du type de vecteur (point) utilise
// other types definitions
typedef Geom::Vector<3,REAL> VEC3;
// definition du type de matrice 3x3 utilise
typedef Geom::Vector<6,REAL> VEC6;
typedef Geom::Matrix<3,3,REAL> MATRIX33;
// definition du type de matrice 4x4 utilise
typedef Geom::Matrix<4,4,REAL> MATRIX44;
typedef Geom::Matrix<3,6,REAL> MATRIX36;
// definition du type du AttributeHandler de vecteur 3D
typedef AttributeHandler<VEC3> TVEC3;
// definition du type du AttributeHandler de reels
typedef AttributeHandler<REAL> TREAL;
};
// qq initialisation cachees (car penible syntaxiquement)
INIT_STATICS_MAP();
PFP::MAP myMap;
SelectorTrue allDarts;
PFP::TVEC3 position ;
......
......@@ -21,6 +21,7 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __SQUELETTE3CARTE__
#define __SQUELETTE3CARTE__
......@@ -45,29 +46,25 @@
using namespace CGoGN ;
struct PFP {
// definition de la carte
struct PFP
{
// definition of the map
typedef Map3 MAP;
// definition du type de reel utilise
// definition of the type of real value
typedef float REAL;
// definition du type de vecteur (point) utilise
// other types definitions
typedef Geom::Vector<3,REAL> VEC3;
// definition du type de matrice 3x3 utilise
typedef Geom::Vector<6,REAL> VEC6;
typedef Geom::Matrix<3,3,REAL> MATRIX33;
// definition du type de matrice 4x4 utilise
typedef Geom::Matrix<4,4,REAL> MATRIX44;
typedef Geom::Matrix<3,6,REAL> MATRIX36;
// definition du type du AttributeHandler de vecteur 3D
typedef AttributeHandler<VEC3> TVEC3;
// definition du type du AttributeHandler de reels
typedef AttributeHandler<REAL> TREAL;
};
// qq initialisation cachees (car penible syntaxiquement)
INIT_STATICS_MAP();
PFP::MAP myMap;
SelectorTrue allDarts;
......
......@@ -49,10 +49,6 @@ namespace Import
template <typename PFP>
bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, ImportSurfacique::ImportType kind = ImportSurfacique::UNKNOWNSURFACE);
template <typename PFP>
bool importPLYPTM(typename PFP::MAP& map, const std::string& filename, typename PFP::TVEC3& positions, ImportSurfacique::ImportType kind,
typename PFP::TFRAME& frame, typename PFP::TRGBFUNCTIONS& funcs);
/**
* import a volumic mesh
*/
......@@ -63,27 +59,26 @@ bool importMesh(typename PFP::MAP& map, const std::string& filename, typename PF
//bool importObjWithTex(typename PFP::MAP& map, const std::string& filename);
//
/*
* TODO a transformer en utilisant un MeshTableVolume.
*/
template <typename PFP>
bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char* filenameOFF,char * filenameELE);
bool importOFFWithELERegions(typename PFP::MAP& the_map, char* filenameOFF,char * filenameELE, std::vector<std::string>& attrNames);
template <typename PFP>
bool importTet(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char* filename, float scaleFactor=1.0f);
bool importTet(typename PFP::MAP& the_map, char* filename, std::vector<std::string>& attrNames, float scaleFactor=1.0f);
template <typename PFP>
bool importTs(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char* filename, float scaleFactor=1.0f);
bool importTs(typename PFP::MAP& the_map, char* filename, std::vector<std::string>& attrNames, float scaleFactor=1.0f);
template <typename PFP>
bool importInESS(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char* filename);
bool importInESS(typename PFP::MAP& the_map, char* filename, std::vector<std::string>& attrNames);
}
} // namespace Import
}
} // namespace Algo
}
} // namespace CGoGN
#include "Algo/Import/importMesh.hpp"
//#include "Algo/Import/importObjTex.hpp"
......
......@@ -50,12 +50,12 @@ namespace Import
namespace ImportSurfacique
{
enum ImportType {UNKNOWNSURFACE,TRIAN,TRIANBGZ,PLY,PLYPTM,OFF,OBJ,CTM,VRML};
enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, PLY, PLYPTM, OFF, OBJ, CTM, VRML };
}
namespace ImportVolumique
{
enum ImportType {UNKNOWNVOLUME,TET,TRIANBGZ,PLY};
enum ImportType { UNKNOWNVOLUME ,TET ,TRIANBGZ ,PLY };
}
......
......@@ -45,6 +45,7 @@ ImportSurfacique::ImportType MeshTablesSurface<PFP>::getFileType(const std::stri
{
if ((filename.rfind(".trianbgz")!=std::string::npos) || (filename.rfind(".TRIANBGZ")!=std::string::npos))
return ImportSurfacique::TRIANBGZ;
if ((filename.rfind(".trian")!=std::string::npos) || (filename.rfind(".TRIAN")!=std::string::npos))
return ImportSurfacique::TRIAN;
......@@ -53,10 +54,13 @@ ImportSurfacique::ImportType MeshTablesSurface<PFP>::getFileType(const std::stri
if ((filename.rfind(".ply")!=std::string::npos) || (filename.rfind(".PLY")!=std::string::npos))
return ImportSurfacique::PLY;
if ((filename.rfind(".off")!=std::string::npos) || (filename.rfind(".OFF")!=std::string::npos))
return ImportSurfacique::OFF;
if ((filename.rfind(".obj")!=std::string::npos) || (filename.rfind(".OBJ")!=std::string::npos))
return ImportSurfacique::OBJ;
if ((filename.rfind(".ctm")!=std::string::npos) || (filename.rfind(".OBJ")!=std::string::npos))
return ImportSurfacique::CTM;
......@@ -93,6 +97,10 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector
std::cout << "TYPE: PLY" << std::endl;
return importPly(filename, attrNames);
break;
case ImportSurfacique::PLYPTM:
std::cout << "TYPE: PLYPTM" << std::endl;
return importPlyPTM(filename, attrNames);
break;
case ImportSurfacique::OBJ:
std::cout << "TYPE: OBJ" << std::endl;
return importObj(filename, attrNames);
......
......@@ -33,7 +33,7 @@ namespace Import
{
template <typename PFP>
typename PFP::VEC3 stringToEmb(std::string s)
typename PFP::VEC3 stringToEmb(std::string& s)
{
if(s[0] == '(')
s.erase(0,2);
......@@ -55,10 +55,13 @@ typename PFP::VEC3 stringToEmb(std::string s)
}
template <typename PFP>
bool importInESS(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char* filename)
bool importInESS(typename PFP::MAP& map, char* filename, std::vector<std::string>& attrNames)
{
typedef typename PFP::VEC3 VEC3;
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(position.name()) ;
// open file
std::ifstream fp(filename, std::ios::in);
......@@ -85,10 +88,8 @@ bool importInESS(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, ch
stringToEmb<PFP>(bg.substr(0,posCoord));
stringToEmb<PFP>(bg.substr(posCoord+3));
while ( std::getline( fp, line ) )
{
posData = line.find("\t");
// First column
......@@ -107,14 +108,12 @@ bool importInESS(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, ch
++count;
}
fp.close();
return true;
}
} // namespace Import
} // namespace Algo
}
} // end namespaces
}
} // namespace CGoGN
......@@ -430,8 +430,6 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
template <typename PFP>
bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, ImportSurfacique::ImportType kind)
{
// AttribContainer& vertexContainer = map.getAttributeContainer(VERTEX_ORBIT);
MeshTablesSurface<PFP> mts(map);
if(!mts.importMesh(filename, attrNames, kind))
......@@ -440,20 +438,6 @@ bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector
return importMesh<PFP>(map, mts);
}
template <typename PFP>
bool importPLYPTM(typename PFP::MAP& map, const std::string& filename, typename PFP::TVEC3& positions, ImportSurfacique::ImportType kind,
typename PFP::TFRAME& Frame, typename PFP::TRGBFUNCS& RGBfunctions)
{
AttribContainer& vertexContainer = map.getAttributeContainer(VERTEX_ORBIT);
MeshTablesSurface<PFP> mts(vertexContainer, positions);
if(!mts.importPlyPTM(filename, Frame, RGBfunctions))
return false;
return importMesh<PFP>(map, mts);
}
template <typename PFP>
bool importMesh(typename PFP::MAP& map, const std::string& filename, typename PFP::TVEC3& positions, ImportVolumique::ImportType kind)
{
......
......@@ -27,19 +27,25 @@
namespace CGoGN
{
namespace Algo
{
namespace Import
namespace Import
{
template<typename PFP>
bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char* filenameOFF, char * filenameELE)
bool importOFFWithELERegions(typename PFP::MAP& map, char* filenameOFF, char * filenameELE, std::vector<std::string>& attrNames)
{
typedef typename PFP::VEC3 VEC3;
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(position.name()) ;
unsigned int m_nbVertices=0, m_nbFaces=0, m_nbEdges=0, m_nbVolumes=0;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(the_map, VERTEX_ORBIT, "incidents");
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents");
// open files
std::ifstream foff(filenameOFF, std::ios::in);
......@@ -67,7 +73,6 @@ bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_
return false;
}
//Reading number of vertex/faces/edges in OFF file
int nbe;
{
......@@ -98,13 +103,11 @@ bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_
std::cout << "nb points = " << m_nbVertices << " / nb faces = " << m_nbFaces << " / nb edges = " << m_nbEdges << " / nb tet = " << m_nbVolumes << std::endl;
AttribContainer& m_container = the_map.getAttributeContainer(VERTEX_ORBIT);
//Reading vertices
std::vector<unsigned int> verticesID;
verticesID.reserve(m_nbVertices);
for(unsigned int i=0 ; i < m_nbVertices ; ++i)
for(unsigned int i = 0 ; i < m_nbVertices ; ++i)
{
do
{
......@@ -120,8 +123,8 @@ bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_
//we can read colors informations if exists
VEC3 pos(x,y,z);
unsigned int id = m_container.insertLine();
m_position[id] = pos;
unsigned int id = container.insertLine();
position[id] = pos;
// std::cout << "emb : " << pos << " / id = " << id << std::endl;
verticesID.push_back(id);
......@@ -142,8 +145,8 @@ bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_
oss >> nbe;
// std::cout << "tetra number : " << nbe << std::endl;
//Algo::Modelisation::Polyhedron<PFP>::createOrientedTetra(the_map);
Dart d = Algo::Modelisation::Polyhedron<PFP>::createOrientedPolyhedron(the_map,4);
//Algo::Modelisation::Polyhedron<PFP>::createOrientedTetra(map);
Dart d = Algo::Modelisation::Polyhedron<PFP>::createOrientedPolyhedron(map,4);
Geom::Vec4ui pt;
oss >> pt[0];
oss >> pt[1];
......@@ -160,33 +163,33 @@ bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_
{
// std::cout << "\t embedding number : " << pt[j];
FunctorSetEmb<typename PFP::MAP> femb(the_map,VERTEX_ORBIT,verticesID[pt[j]]);
FunctorSetEmb<typename PFP::MAP> femb(map,VERTEX_ORBIT,verticesID[pt[j]]);
Dart dd = d;
do {
femb(dd);
//vecDartPtrEmb[pt[j]].push_back(dd);
vecDartsPerVertex[pt[j]].push_back(dd);
dd = the_map.phi1(the_map.phi2(dd));
dd = map.phi1(map.phi2(dd));
} while(dd!=d);
d = the_map.phi1(d);
d = map.phi1(d);
// std::cout << " done" << std::endl;
}
//Embed the last vertex
// std::cout << "\t embedding number : " << pt[3] << std::endl;
d = the_map.phi_1(the_map.phi2(d));
d = map.phi_1(map.phi2(d));
FunctorSetEmb<typename PFP::MAP> femb(the_map,VERTEX_ORBIT,verticesID[pt[3]]);
FunctorSetEmb<typename PFP::MAP> femb(map,VERTEX_ORBIT,verticesID[pt[3]]);
Dart dd = d;
do {
femb(dd);
// std::cout << "embed" << std::endl;
//vecDartPtrEmb[pt[3]].push_back(dd);
vecDartsPerVertex[pt[3]].push_back(dd);
dd = the_map.phi1(the_map.phi2(dd));
dd = map.phi1(map.phi2(dd));
} while(dd != d);
// std::cout << "end tetra" << std::endl;
......@@ -198,21 +201,21 @@ bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_
fele.close();
//Association des phi3
for (Dart d = the_map.begin(); d != the_map.end(); the_map.next(d))
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
std::vector<Dart>& vec = vecDartsPerVertex[d];
for(typename std::vector<Dart>::iterator it = vec.begin(); it!=vec.end(); ++it)
{
if(the_map.phi3(*it)==*it)
if(map.phi3(*it)==*it)
{
bool sewn=false;
for(typename std::vector<Dart>::iterator itnext=it+1; itnext!=vec.end() && !sewn; ++itnext)
{
if(the_map.getDartEmbedding(VERTEX_ORBIT,the_map.phi1(*it))==the_map.getDartEmbedding(VERTEX_ORBIT,the_map.phi_1(*itnext))
&& the_map.getDartEmbedding(VERTEX_ORBIT,the_map.phi_1(*it))==the_map.getDartEmbedding(VERTEX_ORBIT,the_map.phi1(*itnext)))
if(map.getDartEmbedding(VERTEX_ORBIT,map.phi1(*it))==map.getDartEmbedding(VERTEX_ORBIT,map.phi_1(*itnext))
&& map.getDartEmbedding(VERTEX_ORBIT,map.phi_1(*it))==map.getDartEmbedding(VERTEX_ORBIT,map.phi1(*itnext)))
{
the_map.sewVolumes(*it,the_map.phi_1(*itnext));
map.sewVolumes(*it,map.phi_1(*itnext));
sewn = true;
}
}
......@@ -225,7 +228,8 @@ bool importOFFWithELERegions(typename PFP::MAP& the_map, typename PFP::TVEC3& m_
return true;
}
} // namespace Import
}
} // end namespaces
}
} // namespace Algo
} // namespace CGoGN
......@@ -33,12 +33,16 @@ namespace Import
{
template <typename PFP>
bool importTet(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char* filename, float scaleFactor)
bool importTet(typename PFP::MAP& map, char* filename, std::vector<std::string>& attrNames, float scaleFactor)
{
typedef typename PFP::VEC3 VEC3;
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(position.name()) ;
unsigned int m_nbVertices=0, m_nbFaces=0, m_nbEdges=0, m_nbVolumes=0;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(the_map, VERTEX_ORBIT, "incidents");
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents");
// open file
std::ifstream fp(filename, std::ios::in);
......@@ -63,8 +67,6 @@ bool importTet(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char
//std::cout << "nbT = " << nbt << std::endl;
AttribContainer& m_container = the_map.getAttributeContainer(VERTEX_ORBIT);
//lecture sommets
std::vector<unsigned int> verticesID;
verticesID.reserve(nbv);
......@@ -86,8 +88,8 @@ bool importTet(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char
//std::cout << "VEC3 = " << pos << std::endl;
unsigned int id = m_container.insertLine();
m_position[id] = pos;
unsigned int id = container.insertLine();
position[id] = pos;
verticesID.push_back(id);
}
......@@ -105,99 +107,99 @@ bool importTet(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char
std::cout << "nb points = " << m_nbVertices << " / nb faces = " << m_nbFaces << " / nb edges = " << m_nbEdges << " / nb tet = " << m_nbVolumes << std::endl;
//Read and embed tetrahedra TODO
for(unsigned i=0; i < m_nbVolumes ; ++i)
for(unsigned int i = 0; i < m_nbVolumes ; ++i)
{
int nbe;
do
{
int nbe;
do
{
std::getline(fp,ligne);
} while(ligne.size() == 0);
std::stringstream oss(ligne);
oss >> nbe;
// std::cout << "tetra number : " << nbe << std::endl;
//Algo::Modelisation::Polyhedron<PFP>::createOrientedTetra(the_map);
Dart d = Algo::Modelisation::Polyhedron<PFP>::createOrientedPolyhedron(the_map,4);
Geom::Vec4ui pt;
oss >> pt[0];
oss >> pt[1];
oss >> pt[2];
oss >> pt[3];
std::getline(fp,ligne);
} while(ligne.size() == 0);
//regions ?
oss >> nbe;
// std::cout << "\t embedding number : " << pt[0] << " " << pt[1] << " " << pt[2] << " " << pt[3] << std::endl;
// Embed three vertices
for(unsigned int j=0 ; j<3 ; ++j)
{
// std::cout << "\t embedding number : " << pt[j];
std::stringstream oss(ligne);
oss >> nbe;
// std::cout << "tetra number : " << nbe << std::endl;
FunctorSetEmb<typename PFP::MAP> femb(the_map,VERTEX_ORBIT,verticesID[pt[j]]);
//Algo::Modelisation::Polyhedron<PFP>::createOrientedTetra(map);
Dart d = Algo::Modelisation::Polyhedron<PFP>::createOrientedPolyhedron(map,4);
Geom::Vec4ui pt;
oss >> pt[0];
oss >> pt[1];
oss >> pt[2];
oss >> pt[3];
Dart dd = d;
do {
femb(dd);
//vecDartPtrEmb[pt[j]].push_back(dd);
vecDartsPerVertex[pt[j]].push_back(dd);
dd = the_map.phi1(the_map.phi2(dd));
} while(dd!=d);
//regions ?
oss >> nbe;
d = the_map.phi1(d);
// std::cout << "\t embedding number : " << pt[0] << " " << pt[1] << " " << pt[2] << " " << pt[3] << std::endl;
// std::cout << " done" << std::endl;
}
// Embed three vertices
for(unsigned int j=0 ; j<3 ; ++j)
{
// std::cout << "\t embedding number : " << pt[j];
//Embed the last vertex
// std::cout << "\t embedding number : " << pt[3] << std::endl;
d = the_map.phi_1(the_map.phi2(d));
FunctorSetEmb<typename PFP::MAP> femb(map,VERTEX_ORBIT,verticesID[pt[j]]);
FunctorSetEmb<typename PFP::MAP> femb(the_map,VERTEX_ORBIT,verticesID[pt[3]]);
Dart dd = d;
do {
femb(dd);
// std::cout << "embed" << std::endl;
//vecDartPtrEmb[pt[3]].push_back(dd);
vecDartsPerVertex[pt[3]].push_back(dd);
dd = the_map.phi1(the_map.phi2(dd));
} while(dd != d);
//vecDartPtrEmb[pt[j]].push_back(dd);
vecDartsPerVertex[pt[j]].push_back(dd);
dd = map.phi1(map.phi2(dd));
} while(dd!=d);
// std::cout << "end tetra" << std::endl;
d = map.phi1(d);
// std::cout << " done" << std::endl;
}
// std::cout << "end 1/2" << std::endl;
//Embed the last vertex
// std::cout << "\t embedding number : " << pt[3] << std::endl;
d = map.phi_1(map.phi2(d));
FunctorSetEmb<typename PFP::MAP> femb(map,VERTEX_ORBIT,verticesID[pt[3]]);
Dart dd = d;
do {
femb(dd);
// std::cout << "embed" << std::endl;
//vecDartPtrEmb[pt[3]].push_back(dd);
vecDartsPerVertex[pt[3]].push_back(dd);
dd = map.phi1(map.phi2(dd));
} while(dd != d);
// std::cout << "end tetra" << std::endl;
}
//Association des phi3
for (Dart d = the_map.begin(); d != the_map.end(); the_map.next(d))
{
std::vector<Dart>& vec = vecDartsPerVertex[d];
// std::cout << "end 1/2" << std::endl;
for(typename std::vector<Dart>::iterator it = vec.begin(); it!=vec.end(); ++it)
//Association des phi3
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
std::vector<Dart>& vec = vecDartsPerVertex[d];
for(typename std::vector<Dart>::iterator it = vec.begin(); it!=vec.end(); ++it)
{
if(map.phi3(*it)==*it)
{
if(the_map.phi3(*it)==*it)
bool sewn=false;
for(typename std::vector<Dart>::iterator itnext=it+1; itnext!=vec.end() && !sewn; ++itnext)
{
bool sewn=false;
for(typename std::vector<Dart>::iterator itnext=it+1; itnext!=vec.end() && !sewn; ++itnext)
if(map.getDartEmbedding(VERTEX_ORBIT,map.phi1(*it))==map.getDartEmbedding(VERTEX_ORBIT,map.phi_1(*itnext))
&& map.getDartEmbedding(VERTEX_ORBIT,map.phi_1(*it))==map.getDartEmbedding(VERTEX_ORBIT,map.phi1(*itnext)))
{
if(the_map.getDartEmbedding(VERTEX_ORBIT,the_map.phi1(*it))==the_map.getDartEmbedding(VERTEX_ORBIT,the_map.phi_1(*itnext))
&& the_map.getDartEmbedding(VERTEX_ORBIT,the_map.phi_1(*it))==the_map.getDartEmbedding(VERTEX_ORBIT,the_map.phi1(*itnext)))
{
the_map.sewVolumes(*it,the_map.phi_1(*itnext));
sewn = true;
}
map.sewVolumes(*it,map.phi_1(*itnext));
sewn = true;
}
}
}
}
}
fp.close();
return true;
}
}
} // end namespaces
}
} // namespace Import
} // namespace Algo
} // namespace CGoGN
......@@ -38,17 +38,19 @@ namespace Import
*
*/
template <typename PFP>
bool importTs(typename PFP::MAP& the_map, typename PFP::TVEC3& m_position, char* filename, float scaleFactor)
bool importTs(typename PFP::MAP& map, char* filename, std::vector<std::string>& attrNames, float scaleFactor)
{
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
typedef typename PFP::TREAL TREAL;
unsigned int m_nbVertices=0, m_nbFaces=0, m_nbEdges=0, m_nbVolumes=0;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(the_map, VERTEX_ORBIT, "incidents");
AttribContainer& container = map.getAttributeContainer(VERTEX_CELL) ;
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(position.name()) ;