Commit 0693c89c authored by CGoGN GIT Supervisor's avatar CGoGN GIT Supervisor
Browse files

Merge branch 'master' of /home/vanhoey/CGoGN

* 'master' of /home/vanhoey/CGoGN:
  qqs modifs :-)
  added new dependency to package uuid-dev in README
  added howto (in README_ECLIPSE) install CMake Editor in Eclipse
  corrections dans AHEM : _CELL et _ORBIT
  added tests to vector_gen and updated frame
  new naming convention for frames : XYZ instead of TBN
  rename localFrame -> Frame ; move from Utils to Geom namespace
  localFrame.hpp : handling cross product of orthogonal vectors
  Euler angle name conventions used in localFrame
  updated comment for localFrame
parents ab864c18 e00b0f46
Dépendences Linux: Dépendences Linux:
installer les paquets suivants: installer les paquets suivants:
cmake libXi-dev libXmu-dev freeglut3-dev libdevil-dev libglew-dev libgmp3-dev libxml2-dev libboost-dev libboost-thread-dev libzip-dev libqt4-help qt4-designer qt4-dev-tools cmake libXi-dev libXmu-dev freeglut3-dev libdevil-dev libglew-dev libgmp3-dev libxml2-dev libboost-dev libboost-thread-dev libzip-dev libqt4-help qt4-designer qt4-dev-tools uuid-dev
Pour compiler CGoGN: Pour compiler CGoGN:
- aller dans ThirdParty et taper "cmake .", puis make - aller dans ThirdParty et taper "cmake .", puis make
......
...@@ -52,3 +52,8 @@ Eclipse reconnaîtra désormais les fichiers .frag et .vert. ...@@ -52,3 +52,8 @@ Eclipse reconnaîtra désormais les fichiers .frag et .vert.
Pour associer d'autres fichiers au programme GLSLeditor : Pour associer d'autres fichiers au programme GLSLeditor :
- Preferences -> General -> Editors -> File Associations - Preferences -> General -> Editors -> File Associations
Dans Preferences -> Shaders Preferences, on peut désormais configurer certaines options liées au shaders. Dans Preferences -> Shaders Preferences, on peut désormais configurer certaines options liées au shaders.
* Coloration syntaxique des fichiers CMake
- Installer CMakeEditor pour Eclipse en ajoutant l'URL dans Help -> Install New Software ... : http://cmakeed.sourceforge.net/eclipse/
- Installer et redémarrer
- Dans Preferences -> General -> Editors -> File Associations il est possible d'associer les CMakeLists.txt à ce logiciel d'édition
...@@ -149,7 +149,7 @@ void decimate( ...@@ -149,7 +149,7 @@ void decimate(
while(!finished) while(!finished)
{ {
CGoGNout << "Countdown : " ; CGoGNout << "Countdown : " ;
CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" /* flush */ ; CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" << CGoGNflush ;
if(!selector->nextEdge(d)) { if(!selector->nextEdge(d)) {
CGoGNout << CGoGNendl << "out" << CGoGNendl ; CGoGNout << CGoGNendl << "out" << CGoGNendl ;
......
...@@ -74,15 +74,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, ...@@ -74,15 +74,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
/** /**
* export the map into a PLYPTM file * export the map into a PLYPTM file
* @param the_map map to be exported * @param map map to be exported
* @param filename filename of ply file * @param filename filename of ply file
* @param position the position container * @param position the position container
* @param frame[3] table of 3 vectors representing the local frame
* @param colorPTM[6] function coefficients (6) for each color channel (3)
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const typename PFP::TREAL errL2 = AttributeHandler<typename PFP::REAL>(), const typename PFP::TREAL errLmax = AttributeHandler<typename PFP::REAL>(), const typename PFP::TREAL stdDev = AttributeHandler<typename PFP::REAL>(), const FunctorSelect& good = SelectorTrue()) ; bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good = SelectorTrue()) ;
/** /**
......
...@@ -248,10 +248,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, ...@@ -248,10 +248,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
} }
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[15], const typename PFP::TREAL errL2, const typename PFP::TREAL errLmax, const typename PFP::TREAL stdDev, const FunctorSelect& good) bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
typedef typename PFP::TVEC3 TVEC3;
typedef typename PFP::REAL REAL;
typedef typename PFP::TREAL TREAL;
std::ofstream out(filename, std::ios::out) ; std::ofstream out(filename, std::ios::out) ;
if (!out.good()) if (!out.good())
...@@ -303,6 +306,21 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -303,6 +306,21 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
} }
} }
TVEC3 frame[3] ;
TVEC3 colorPTM[15] ;
frame[0] = map.template getAttribute<VEC3>(VERTEX, "frame_T") ;
frame[1] = map.template getAttribute<VEC3>(VERTEX, "frame_B") ;
frame[2] = map.template getAttribute<VEC3>(VERTEX, "frame_N") ;
for (unsigned i = 0 ; i < 15 ; ++i)
{
std::stringstream name ;
name << "colorPTM_a" << i ;
colorPTM[i] = map.template getAttribute<VEC3>(VERTEX,name.str()) ;
}
const unsigned int degree = colorPTM[14].isValid() ? 4 : (colorPTM[9].isValid() ? 3 : 2) ;
out << "ply" << std::endl ; out << "ply" << std::endl ;
out << "format ascii 1.0" << std::endl ; out << "format ascii 1.0" << std::endl ;
out << "comment ply PTM" << std::endl ; out << "comment ply PTM" << std::endl ;
...@@ -325,45 +343,61 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -325,45 +343,61 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
out << "property float L1_a3" << std::endl ; out << "property float L1_a3" << std::endl ;
out << "property float L1_a4" << std::endl ; out << "property float L1_a4" << std::endl ;
out << "property float L1_a5" << std::endl ; out << "property float L1_a5" << std::endl ;
out << "property float L1_a6" << std::endl ; if (degree > 2) {
out << "property float L1_a7" << std::endl ; out << "property float L1_a6" << std::endl ;
out << "property float L1_a8" << std::endl ; out << "property float L1_a7" << std::endl ;
out << "property float L1_a9" << std::endl ; out << "property float L1_a8" << std::endl ;
out << "property float L1_a10" << std::endl ; out << "property float L1_a9" << std::endl ;
out << "property float L1_a11" << std::endl ; if (degree > 3) {
out << "property float L1_a12" << std::endl ; out << "property float L1_a10" << std::endl ;
out << "property float L1_a13" << std::endl ; out << "property float L1_a11" << std::endl ;
out << "property float L1_a14" << std::endl ; out << "property float L1_a12" << std::endl ;
out << "property float L1_a13" << std::endl ;
out << "property float L1_a14" << std::endl ;
}
}
out << "property float L2_a0" << std::endl ; out << "property float L2_a0" << std::endl ;
out << "property float L2_a1" << std::endl ; out << "property float L2_a1" << std::endl ;
out << "property float L2_a2" << std::endl ; out << "property float L2_a2" << std::endl ;
out << "property float L2_a3" << std::endl ; out << "property float L2_a3" << std::endl ;
out << "property float L2_a4" << std::endl ; out << "property float L2_a4" << std::endl ;
out << "property float L2_a5" << std::endl ; out << "property float L2_a5" << std::endl ;
out << "property float L2_a6" << std::endl ; if (degree > 2) {
out << "property float L2_a7" << std::endl ; out << "property float L2_a6" << std::endl ;
out << "property float L2_a8" << std::endl ; out << "property float L2_a7" << std::endl ;
out << "property float L2_a9" << std::endl ; out << "property float L2_a8" << std::endl ;
out << "property float L2_a10" << std::endl ; out << "property float L2_a9" << std::endl ;
out << "property float L2_a11" << std::endl ; if (degree > 3) {
out << "property float L2_a12" << std::endl ; out << "property float L2_a10" << std::endl ;
out << "property float L2_a13" << std::endl ; out << "property float L2_a11" << std::endl ;
out << "property float L2_a14" << std::endl ; out << "property float L2_a12" << std::endl ;
out << "property float L2_a13" << std::endl ;
out << "property float L2_a14" << std::endl ;
}
}
out << "property float L3_a0" << std::endl ; out << "property float L3_a0" << std::endl ;
out << "property float L3_a1" << std::endl ; out << "property float L3_a1" << std::endl ;
out << "property float L3_a2" << std::endl ; out << "property float L3_a2" << std::endl ;
out << "property float L3_a3" << std::endl ; out << "property float L3_a3" << std::endl ;
out << "property float L3_a4" << std::endl ; out << "property float L3_a4" << std::endl ;
out << "property float L3_a5" << std::endl ; out << "property float L3_a5" << std::endl ;
out << "property float L3_a6" << std::endl ; if (degree > 2) {
out << "property float L3_a7" << std::endl ; out << "property float L3_a6" << std::endl ;
out << "property float L3_a8" << std::endl ; out << "property float L3_a7" << std::endl ;
out << "property float L3_a9" << std::endl ; out << "property float L3_a8" << std::endl ;
out << "property float L3_a10" << std::endl ; out << "property float L3_a9" << std::endl ;
out << "property float L3_a11" << std::endl ; if (degree > 3) {
out << "property float L3_a12" << std::endl ; out << "property float L3_a10" << std::endl ;
out << "property float L3_a13" << std::endl ; out << "property float L3_a11" << std::endl ;
out << "property float L3_a14" << std::endl ; out << "property float L3_a12" << std::endl ;
out << "property float L3_a13" << std::endl ;
out << "property float L3_a14" << std::endl ;
}
}
TREAL errL2 = map.template getAttribute<REAL>(VERTEX,"errL2") ;
TREAL errLmax = map.template getAttribute<REAL>(VERTEX,"errLmax") ;
TREAL stdDev = map.template getAttribute<REAL>(VERTEX,"StdDev") ;
if (errL2.isValid()) if (errL2.isValid())
out << "property float errL2" << std::endl ; out << "property float errL2" << std::endl ;
if (errLmax.isValid()) if (errLmax.isValid())
...@@ -375,23 +409,72 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -375,23 +409,72 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
out << "property list uchar int vertex_indices" << std::endl ; out << "property list uchar int vertex_indices" << std::endl ;
out << "end_header" << std::endl ; out << "end_header" << std::endl ;
for(unsigned int i = 0; i < vertices.size(); ++i) switch (degree) {
{ case(2) :
unsigned int vi = vertices[i]; for(unsigned int i = 0; i < vertices.size(); ++i)
out << position[vi][0] << " " << position[vi][1] << " " << position[vi][2] << " " ; {
out << frame[0][vi][0] << " " << frame[0][vi][1] << " " << frame[0][vi][2] << " " ; unsigned int vi = vertices[i];
out << frame[1][vi][0] << " " << frame[1][vi][1] << " " << frame[1][vi][2] << " " ; out << position[vi][0] << " " << position[vi][1] << " " << position[vi][2] << " " ;
out << frame[2][vi][0] << " " << frame[2][vi][1] << " " << frame[2][vi][2] << " " ; out << frame[0][vi][0] << " " << frame[0][vi][1] << " " << frame[0][vi][2] << " " ;
out << colorPTM[0][vi][0] << " " << colorPTM[1][vi][0] << " " << colorPTM[2][vi][0] << " " << colorPTM[3][vi][0] << " " << colorPTM[4][vi][0] << " " << colorPTM[5][vi][0] << " " << colorPTM[6][vi][0] << " " << colorPTM[7][vi][0] << " " << colorPTM[8][vi][0] << " " << colorPTM[9][vi][0] << " " << colorPTM[10][vi][0] << " " << colorPTM[11][vi][0] << " " << colorPTM[12][vi][0] << " " << colorPTM[13][vi][0] << " " << colorPTM[14][vi][0] << " " ; out << frame[1][vi][0] << " " << frame[1][vi][1] << " " << frame[1][vi][2] << " " ;
out << colorPTM[0][vi][1] << " " << colorPTM[1][vi][1] << " " << colorPTM[2][vi][1] << " " << colorPTM[3][vi][1] << " " << colorPTM[4][vi][1] << " " << colorPTM[5][vi][1] << " " << colorPTM[6][vi][1] << " " << colorPTM[7][vi][1] << " " << colorPTM[8][vi][1] << " " << colorPTM[9][vi][1] << " " << colorPTM[10][vi][1] << " " << colorPTM[11][vi][1] << " " << colorPTM[12][vi][1] << " " << colorPTM[13][vi][1] << " " << colorPTM[14][vi][1] << " " ; out << frame[2][vi][0] << " " << frame[2][vi][1] << " " << frame[2][vi][2] << " " ;
out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << " " << colorPTM[6][vi][2] << " " << colorPTM[7][vi][2] << " " << colorPTM[8][vi][2] << " " << colorPTM[9][vi][2] << " " << colorPTM[10][vi][2] << " " << colorPTM[11][vi][2] << " " << colorPTM[12][vi][2] << " " << colorPTM[13][vi][2] << " " << colorPTM[14][vi][2] << " " ; out << colorPTM[0][vi][0] << " " << colorPTM[1][vi][0] << " " << colorPTM[2][vi][0] << " " << colorPTM[3][vi][0] << " " << colorPTM[4][vi][0] << " " << colorPTM[5][vi][0] << " " ;
if (errL2.isValid()) out << colorPTM[0][vi][1] << " " << colorPTM[1][vi][1] << " " << colorPTM[2][vi][1] << " " << colorPTM[3][vi][1] << " " << colorPTM[4][vi][1] << " " << colorPTM[5][vi][1] << " " ;
out << errL2[vi] << " " ; out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << " " ;
if (errLmax.isValid()) if (errL2.isValid())
out << errLmax[vi] << " " ; out << errL2[vi] << " " ;
if (stdDev.isValid()) if (errLmax.isValid())
out << stdDev[vi] << " " ; out << errLmax[vi] << " " ;
out << std::endl ; if (stdDev.isValid())
out << stdDev[vi] << " " ;
out << std::endl ;
}
break ;
case(3) :
for(unsigned int i = 0; i < vertices.size(); ++i)
{
unsigned int vi = vertices[i];
out << position[vi][0] << " " << position[vi][1] << " " << position[vi][2] << " " ;
out << frame[0][vi][0] << " " << frame[0][vi][1] << " " << frame[0][vi][2] << " " ;
out << frame[1][vi][0] << " " << frame[1][vi][1] << " " << frame[1][vi][2] << " " ;
out << frame[2][vi][0] << " " << frame[2][vi][1] << " " << frame[2][vi][2] << " " ;
out << colorPTM[0][vi][0] << " " << colorPTM[1][vi][0] << " " << colorPTM[2][vi][0] << " " << colorPTM[3][vi][0] << " " << colorPTM[4][vi][0] << " " << colorPTM[5][vi][0] << " " << colorPTM[6][vi][0] << " " << colorPTM[7][vi][0] << " " << colorPTM[8][vi][0] << " " << colorPTM[9][vi][0] << " " ;
out << colorPTM[0][vi][1] << " " << colorPTM[1][vi][1] << " " << colorPTM[2][vi][1] << " " << colorPTM[3][vi][1] << " " << colorPTM[4][vi][1] << " " << colorPTM[5][vi][1] << " " << colorPTM[6][vi][1] << " " << colorPTM[7][vi][1] << " " << colorPTM[8][vi][1] << " " << colorPTM[9][vi][1] << " " ;
out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << " " << colorPTM[6][vi][2] << " " << colorPTM[7][vi][2] << " " << colorPTM[8][vi][2] << " " << colorPTM[9][vi][2] << " " ;
if (errL2.isValid())
out << errL2[vi] << " " ;
if (errLmax.isValid())
out << errLmax[vi] << " " ;
if (stdDev.isValid())
out << stdDev[vi] << " " ;
out << std::endl ;
}
break ;
case (4) :
for(unsigned int i = 0; i < vertices.size(); ++i)
{
unsigned int vi = vertices[i];
out << position[vi][0] << " " << position[vi][1] << " " << position[vi][2] << " " ;
out << frame[0][vi][0] << " " << frame[0][vi][1] << " " << frame[0][vi][2] << " " ;
out << frame[1][vi][0] << " " << frame[1][vi][1] << " " << frame[1][vi][2] << " " ;
out << frame[2][vi][0] << " " << frame[2][vi][1] << " " << frame[2][vi][2] << " " ;
out << colorPTM[0][vi][0] << " " << colorPTM[1][vi][0] << " " << colorPTM[2][vi][0] << " " << colorPTM[3][vi][0] << " " << colorPTM[4][vi][0] << " " << colorPTM[5][vi][0] << " " << colorPTM[6][vi][0] << " " << colorPTM[7][vi][0] << " " << colorPTM[8][vi][0] << " " << colorPTM[9][vi][0] << " " << colorPTM[10][vi][0] << " " << colorPTM[11][vi][0] << " " << colorPTM[12][vi][0] << " " << colorPTM[13][vi][0] << " " << colorPTM[14][vi][0] << " " ;
out << colorPTM[0][vi][1] << " " << colorPTM[1][vi][1] << " " << colorPTM[2][vi][1] << " " << colorPTM[3][vi][1] << " " << colorPTM[4][vi][1] << " " << colorPTM[5][vi][1] << " " << colorPTM[6][vi][1] << " " << colorPTM[7][vi][1] << " " << colorPTM[8][vi][1] << " " << colorPTM[9][vi][1] << " " << colorPTM[10][vi][1] << " " << colorPTM[11][vi][1] << " " << colorPTM[12][vi][1] << " " << colorPTM[13][vi][1] << " " << colorPTM[14][vi][1] << " " ;
out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << " " << colorPTM[6][vi][2] << " " << colorPTM[7][vi][2] << " " << colorPTM[8][vi][2] << " " << colorPTM[9][vi][2] << " " << colorPTM[10][vi][2] << " " << colorPTM[11][vi][2] << " " << colorPTM[12][vi][2] << " " << colorPTM[13][vi][2] << " " << colorPTM[14][vi][2] << " " ;
if (errL2.isValid())
out << errL2[vi] << " " ;
if (errLmax.isValid())
out << errLmax[vi] << " " ;
if (stdDev.isValid())
out << stdDev[vi] << " " ;
out << std::endl ;
}
break ;
default :
assert(false || !"exportPlyPTM : degree not in {2,3,4} unhandled") ;
break ;
} }
std::vector<unsigned int>::iterator it = faces.begin(); std::vector<unsigned int>::iterator it = faces.begin();
......
...@@ -222,7 +222,7 @@ void AHEMImporter<PFP>::LoadTopology() ...@@ -222,7 +222,7 @@ void AHEMImporter<PFP>::LoadTopology()
{ {
// Allocate vertices // Allocate vertices
AttributeContainer& vxContainer = map->getAttributeContainer(VERTEX_CELL); AttributeContainer& vxContainer = map->getAttributeContainer(VERTEX);
verticesId = new unsigned int[hdr.meshHdr.vxCount]; verticesId = new unsigned int[hdr.meshHdr.vxCount];
...@@ -234,10 +234,10 @@ void AHEMImporter<PFP>::LoadTopology() ...@@ -234,10 +234,10 @@ void AHEMImporter<PFP>::LoadTopology()
// Ensure vertices are created by querying the position attribute // Ensure vertices are created by querying the position attribute
AttributeHandler<typename PFP::VEC3> position = map->template getAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> position = map->template getAttribute<typename PFP::VEC3>(VERTEX, "position") ;
if (!position.isValid()) if (!position.isValid())
position = map->template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; position = map->template addAttribute<typename PFP::VEC3>(VERTEX, "position") ;
...@@ -272,7 +272,7 @@ void AHEMImporter<PFP>::LoadTopology() ...@@ -272,7 +272,7 @@ void AHEMImporter<PFP>::LoadTopology()
addedHE[heId].vxIdFrom = prevVx; addedHE[heId].vxIdFrom = prevVx;
addedHE[heId].vxIdTo = verticesId[*ix]; addedHE[heId].vxIdTo = verticesId[*ix];
map->setDartEmbedding(VERTEX_ORBIT, d, prevVx); map->setDartEmbedding(VERTEX, d, prevVx);
d = map->phi1(d); d = map->phi1(d);
prevVx = *ix++; prevVx = *ix++;
...@@ -286,7 +286,7 @@ void AHEMImporter<PFP>::LoadTopology() ...@@ -286,7 +286,7 @@ void AHEMImporter<PFP>::LoadTopology()
addedHE[heId].vxIdFrom = prevVx; addedHE[heId].vxIdFrom = prevVx;
addedHE[heId].vxIdTo = firstVx; addedHE[heId].vxIdTo = firstVx;
map->setDartEmbedding(VERTEX_ORBIT, d, prevVx); map->setDartEmbedding(VERTEX, d, prevVx);
heId++; heId++;
} }
...@@ -315,10 +315,10 @@ void AHEMImporter<PFP>::LoadTopology() ...@@ -315,10 +315,10 @@ void AHEMImporter<PFP>::LoadTopology()
template <typename PFP> template <typename PFP>
void AHEMImporter<PFP>::LoadPosition(AHEMAttributeDescriptor* posDescr) void AHEMImporter<PFP>::LoadPosition(AHEMAttributeDescriptor* posDescr)
{ {
AttributeHandler<typename PFP::VEC3> position = map->template getAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; AttributeHandler<typename PFP::VEC3> position = map->template getAttribute<typename PFP::VEC3>(VERTEX, "position") ;
if (!position.isValid()) if (!position.isValid())
position = map->template addAttribute<typename PFP::VEC3>(VERTEX_ORBIT, "position") ; position = map->template addAttribute<typename PFP::VEC3>(VERTEX, "position") ;
f.seekg(posDescr->fileStartOffset, std::ios_base::beg); f.seekg(posDescr->fileStartOffset, std::ios_base::beg);
......
...@@ -78,10 +78,10 @@ void UniversalLoader<MapType, AttrTypeLoader>::ImportAttribute( MapType& map, ...@@ -78,10 +78,10 @@ void UniversalLoader<MapType, AttrTypeLoader>::ImportAttribute( MapType& map,
template<typename MapType, typename AttrTypeLoader> template<typename MapType, typename AttrTypeLoader>
void UniversalLoader<MapType, AttrTypeLoader>::UnpackOnVertex(MapType& map, const unsigned int* verticesId, const AHEMHeader* hdr, const char* attrName, const void* buffer) const void UniversalLoader<MapType, AttrTypeLoader>::UnpackOnVertex(MapType& map, const unsigned int* verticesId, const AHEMHeader* hdr, const char* attrName, const void* buffer) const
{ {
AttributeHandler<typename AttrTypeLoader::ATTR_TYPE> attr = map.template getAttribute<typename AttrTypeLoader::ATTR_TYPE>(VERTEX_ORBIT, attrName); AttributeHandler<typename AttrTypeLoader::ATTR_TYPE> attr = map.template getAttribute<typename AttrTypeLoader::ATTR_TYPE>(VERTEX, attrName);
if (!attr.isValid()) if (!attr.isValid())
attr = map.template addAttribute<typename AttrTypeLoader::ATTR_TYPE>(VERTEX_ORBIT, attrName); attr = map.template addAttribute<typename AttrTypeLoader::ATTR_TYPE>(VERTEX, attrName);
char* p = (char*)buffer; char* p = (char*)buffer;
...@@ -97,10 +97,10 @@ void UniversalLoader<MapType, AttrTypeLoader>::UnpackOnVertex(MapType& map, cons ...@@ -97,10 +97,10 @@ void UniversalLoader<MapType, AttrTypeLoader>::UnpackOnVertex(MapType& map, cons
template<typename MapType, typename AttrTypeLoader> template<typename MapType, typename AttrTypeLoader>
void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnFace(MapType& map, const Dart* facesId, const AHEMHeader* hdr, const char* attrName, const void* buffer) const void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnFace(MapType& map, const Dart* facesId, const AHEMHeader* hdr, const char* attrName, const void* buffer) const
{ {
AttributeHandler<typename AttrTypeLoader::ATTR_TYPE> attr = map.template getAttribute<typename AttrTypeLoader::ATTR_TYPE>(FACE_ORBIT, attrName); AttributeHandler<typename AttrTypeLoader::ATTR_TYPE> attr = map.template getAttribute<typename AttrTypeLoader::ATTR_TYPE>(FACE, attrName);
if (!attr.isValid()) if (!attr.isValid())
attr = map.template addAttribute<typename AttrTypeLoader::ATTR_TYPE>(FACE_ORBIT, attrName); attr = map.template addAttribute<typename AttrTypeLoader::ATTR_TYPE>(FACE, attrName);
...@@ -117,10 +117,10 @@ void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnFace(MapType& map, const ...@@ -117,10 +117,10 @@ void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnFace(MapType& map, const
template<typename MapType, typename AttrTypeLoader> template<typename MapType, typename AttrTypeLoader>
void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnHE(MapType& map, const Dart* facesId, const AHEMHeader* hdr, const char* attrName, const void* buffer) const void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnHE(MapType& map, const Dart* facesId, const AHEMHeader* hdr, const char* attrName, const void* buffer) const
{ {
AttributeHandler<typename AttrTypeLoader::ATTR_TYPE> attr = map.template getAttribute<typename AttrTypeLoader::ATTR_TYPE>(DART_ORBIT, attrName); AttributeHandler<typename AttrTypeLoader::ATTR_TYPE> attr = map.template getAttribute<typename AttrTypeLoader::ATTR_TYPE>(DART, attrName);
if (!attr.isValid()) if (!attr.isValid())
attr = map.template addAttribute<typename AttrTypeLoader::ATTR_TYPE>(DART_ORBIT, attrName); attr = map.template addAttribute<typename AttrTypeLoader::ATTR_TYPE>(DART, attrName);
...@@ -145,10 +145,10 @@ void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnHE(MapType& map, const D ...@@ -145,10 +145,10 @@ void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnHE(MapType& map, const D
template<typename MapType, typename AttrTypeLoader> template<typename MapType, typename AttrTypeLoader>
void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnHEFC(MapType& map, const Dart* facesId, const AHEMHeader* hdr, const char* attrName, const void* buffer) const void UniversalLoader<MapType, AttrTypeLoader>:: UnpackOnHEFC(MapType& map, const Dart* facesId, const AHEMHeader* hdr, const char* attrName, const void* buffer) const
{ {
AttributeHandler<typename AttrTypeLoader::ATTR_TYPE> attr = map.template getAttribute<typename AttrTypeLoader::ATTR_TYPE>(DART_ORBIT, attrName); AttributeHandler<typename AttrTypeLoader::ATTR_TYPE> attr = map.template getAttribute<typename AttrTypeLoader::ATTR_TYPE>(DART, attrName);
if (!attr.isValid()) if (!attr.isValid())
attr = map.template addAttribute<typename AttrTypeLoader::ATTR_TYPE>(DART_ORBIT, attrName); attr = map.template addAttribute<typename AttrTypeLoader::ATTR_TYPE>(DART, attrName);
char* p = (char*)buffer; char* p = (char*)buffer;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
namespace CGoGN { namespace CGoGN {
namespace Utils { namespace Geom {
/** /**
* Util for rotation of a 3D point (or vector) around a given line (going through the origin) and of a given angle * Util for rotation of a 3D point (or vector) around a given line (going through the origin) and of a given angle
...@@ -41,37 +41,79 @@ template <typename REAL> ...@@ -41,37 +41,79 @@ template <typename REAL>
Geom::Vector<3,REAL> rotate (Geom::Vector<3,REAL> axis, REAL angle, Geom::Vector<3,REAL> p) ; Geom::Vector<3,REAL> rotate (Geom::Vector<3,REAL> axis, REAL angle, Geom::Vector<3,REAL> p) ;
/** /**
* Util for conversion from spherical to carthesian coordinates. * Util for conversion from spherical to cartesian coordinates.
* The spherical coordinates are in radius-longitude-latitude * The spherical coordinates are in radius-longitude-latitude
* @param sph the spherical coordinates * @param sph the spherical coordinates
* @return the carthesian coordinates * @return the cartesian coordinates
*/ */
template<typename REAL> template<typename REAL>
Geom::Vector<3,REAL> sphericalToCarth (const Geom::Vector<3,REAL>& sph) ; Geom::Vector<3,REAL> sphericalToCart (const Geom::Vector<3,REAL>& sph) ;
/** /**
* Util for conversion from carthesian to spherical coordinates. * Util for conversion from cartesian to spherical coordinates.
* The spherical coordinates are in radius-longitude-latitude * The spherical coordinates are in radius-longitude-latitude
* @param carth the carthesian coordinates * @param cart the cartesian coordinates
* @return the spherical coordinates * @return the spherical coordinates
*/ */
template<typename REAL> template<typename REAL>
Geom::Vector<3,REAL> carthToSpherical (const Geom::Vector<3,REAL>& carth) ; Geom::Vector<3,REAL> cartToSpherical (const Geom::Vector<3,REAL>& cart) ;
/** /**
* Class for representing a direct local frame composed of 3 orthonormal vectors T (tangent), B (bitangent) and N (normal). * Tests if the frame is direct, normalized and orthogonal
* This class can compress/decompress a local frame, switching from its explicit representation (3 vectors) to its compressed representation (1 vector). * @param X the first vector of the frame
* @param Y the second vector of the frame
* @param Z the third vector of the frame
* @param epsilon tolerated error
* @return true if the frame is direct, normalized and orthogonal
*/
template<typename PFP>
bool isDirectOrthoNormalFrame(const typename PFP::VEC3& X, const typename PFP::VEC3& Y, const typename PFP::VEC3& Z, typename PFP::REAL epsilon = 1e-5) ;
/**
* Tests if the frame is direct
* @param X the first vector of the frame
* @param Y the second vector of the frame
* @param Z the third vector of the frame
* @param epsilon tolerated error
* @return true if the frame is direct
*/
template<typename PFP>
bool isDirectFrame(const typename PFP::VEC3& X, const typename PFP::VEC3& Y, const typename PFP::VEC3& Z, typename PFP::REAL epsilon = 1e-7) ;
/**
* Tests if the frame is orthogonal
* @param X the first vector of the frame
* @param Y the second vector of the frame
* @param Z the third vector of the frame
* @param epsilon tolerated error
* @return true if the frame is orthogonal
*/
template<typename PFP>
bool isOrthogonalFrame(const typename PFP::VEC3& X, const typename PFP::VEC3& Y, const typename PFP::VEC3& Z, typename PFP::REAL epsilon = 1e-5) ;
/**
* Tests if the frame is normalized
* @param X the first vector of the frame
* @param Y the second vector of the frame
* @param Z the third vector of the frame
* @param epsilon tolerated error
* @return true if the frame is normalized
*/
template<typename PFP>