Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

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:
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:
- aller dans ThirdParty et taper "cmake .", puis make
......
......@@ -52,3 +52,8 @@ Eclipse reconnaîtra désormais les fichiers .frag et .vert.
Pour associer d'autres fichiers au programme GLSLeditor :
- Preferences -> General -> Editors -> File Associations
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(
while(!finished)
{
CGoGNout << "Countdown : " ;
CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" /* flush */ ;
CGoGNout << std::setprecision(8) << (nbVertices - nbWantedVertices) << "\r" << CGoGNflush ;
if(!selector->nextEdge(d)) {
CGoGNout << CGoGNendl << "out" << CGoGNendl ;
......
......@@ -74,15 +74,13 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
/**
* 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 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
*/
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,
}
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::VEC3 VEC3;
typedef typename PFP::TVEC3 TVEC3;
typedef typename PFP::REAL REAL;
typedef typename PFP::TREAL TREAL;
std::ofstream out(filename, std::ios::out) ;
if (!out.good())
......@@ -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 << "format ascii 1.0" << std::endl ;
out << "comment ply PTM" << std::endl ;
......@@ -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_a4" << std::endl ;
out << "property float L1_a5" << std::endl ;
out << "property float L1_a6" << std::endl ;
out << "property float L1_a7" << std::endl ;
out << "property float L1_a8" << std::endl ;
out << "property float L1_a9" << std::endl ;
out << "property float L1_a10" << std::endl ;
out << "property float L1_a11" << std::endl ;
out << "property float L1_a12" << std::endl ;
out << "property float L1_a13" << std::endl ;
out << "property float L1_a14" << std::endl ;
if (degree > 2) {
out << "property float L1_a6" << std::endl ;
out << "property float L1_a7" << std::endl ;
out << "property float L1_a8" << std::endl ;
out << "property float L1_a9" << std::endl ;
if (degree > 3) {
out << "property float L1_a10" << std::endl ;
out << "property float L1_a11" << 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_a1" << std::endl ;
out << "property float L2_a2" << std::endl ;
out << "property float L2_a3" << std::endl ;
out << "property float L2_a4" << std::endl ;
out << "property float L2_a5" << std::endl ;
out << "property float L2_a6" << std::endl ;
out << "property float L2_a7" << std::endl ;
out << "property float L2_a8" << std::endl ;
out << "property float L2_a9" << std::endl ;
out << "property float L2_a10" << std::endl ;
out << "property float L2_a11" << std::endl ;
out << "property float L2_a12" << std::endl ;
out << "property float L2_a13" << std::endl ;
out << "property float L2_a14" << std::endl ;
if (degree > 2) {
out << "property float L2_a6" << std::endl ;
out << "property float L2_a7" << std::endl ;
out << "property float L2_a8" << std::endl ;
out << "property float L2_a9" << std::endl ;
if (degree > 3) {
out << "property float L2_a10" << std::endl ;
out << "property float L2_a11" << 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_a1" << std::endl ;
out << "property float L3_a2" << std::endl ;
out << "property float L3_a3" << std::endl ;
out << "property float L3_a4" << std::endl ;
out << "property float L3_a5" << std::endl ;
out << "property float L3_a6" << std::endl ;
out << "property float L3_a7" << std::endl ;
out << "property float L3_a8" << std::endl ;
out << "property float L3_a9" << std::endl ;
out << "property float L3_a10" << std::endl ;
out << "property float L3_a11" << std::endl ;
out << "property float L3_a12" << std::endl ;
out << "property float L3_a13" << std::endl ;
out << "property float L3_a14" << std::endl ;
if (degree > 2) {
out << "property float L3_a6" << std::endl ;
out << "property float L3_a7" << std::endl ;
out << "property float L3_a8" << std::endl ;
out << "property float L3_a9" << std::endl ;
if (degree > 3) {
out << "property float L3_a10" << std::endl ;
out << "property float L3_a11" << 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())
out << "property float errL2" << std::endl ;
if (errLmax.isValid())
......@@ -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 << "end_header" << std::endl ;
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 ;
switch (degree) {
case(2) :
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] << " " ;
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 << 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 (errL2.isValid())
out << errL2[vi] << " " ;
if (errLmax.isValid())
out << errLmax[vi] << " " ;
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();
......
......@@ -222,7 +222,7 @@ void AHEMImporter<PFP>::LoadTopology()
{
// Allocate vertices
AttributeContainer& vxContainer = map->getAttributeContainer(VERTEX_CELL);
AttributeContainer& vxContainer = map->getAttributeContainer(VERTEX);
verticesId = new unsigned int[hdr.meshHdr.vxCount];
......@@ -234,10 +234,10 @@ void AHEMImporter<PFP>::LoadTopology()
// 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())
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()
addedHE[heId].vxIdFrom = prevVx;
addedHE[heId].vxIdTo = verticesId[*ix];
map->setDartEmbedding(VERTEX_ORBIT, d, prevVx);
map->setDartEmbedding(VERTEX, d, prevVx);
d = map->phi1(d);
prevVx = *ix++;
......@@ -286,7 +286,7 @@ void AHEMImporter<PFP>::LoadTopology()
addedHE[heId].vxIdFrom = prevVx;
addedHE[heId].vxIdTo = firstVx;
map->setDartEmbedding(VERTEX_ORBIT, d, prevVx);
map->setDartEmbedding(VERTEX, d, prevVx);
heId++;
}
......@@ -315,10 +315,10 @@ void AHEMImporter<PFP>::LoadTopology()
template <typename PFP>
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())
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);
......
......@@ -78,10 +78,10 @@ void UniversalLoader<MapType, AttrTypeLoader>::ImportAttribute( MapType& map,
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
{
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())
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;
......@@ -97,10 +97,10 @@ void UniversalLoader<MapType, AttrTypeLoader>::UnpackOnVertex(MapType& map, cons
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
{
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())
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
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
{
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())
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
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
{
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())
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;
......
......@@ -29,7 +29,7 @@
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
......@@ -41,37 +41,79 @@ template <typename REAL>
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
* @param sph the spherical coordinates
* @return the carthesian coordinates
* @return the cartesian coordinates
*/
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
* @param carth the carthesian coordinates
* @param cart the cartesian coordinates
* @return the spherical coordinates
*/
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).
* This class can compress/decompress a local frame, switching from its explicit representation (3 vectors) to its compressed representation (1 vector).
* Tests if the frame is direct, normalized and 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 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>
bool isNormalizedFrame(const typename PFP::VEC3& X, const typename PFP::VEC3& Y, const typename PFP::VEC3& Z, typename PFP::REAL epsilon = 1e-5) ;
/**
* Class for representing a direct right-handed local frame composed of 3 orthonormal vectors T (tangent), B (bitangent) and N (normal).
* This class can compress/decompress a local frame, switching from its explicit representation (3 vectors) to its compressed representation (1 vector composed of the Euler angles).
* Usage :
* VEC3 T,B,N ; // current set of orthonormal vectors composing the direct frame.
* LocalFrame<PFP> lf(T,B,N) ; // Constructor from explicit expression.
* VEC3 X,Y,Z ; // current set of orthonormal vectors composing the direct frame.
* Frame<PFP> lf(X,Y,Z) ; // Constructor from explicit expression.
* if (lf.isOrthoNormalDirect()) // test if the frame is Orthogonal, Normalized and Direct
* VEC3 compressed = lf.getCompressed() ; // Extract compressed frame
* LocalFrame<PFP> decompressed(compressed) ; // Constructor from implicit (compressed) expression.
*
* All formulae were provided by "Représentation compacte d'un repère local", june 14th, 2011 by K. Vanhoey
* Frame<PFP> newLf(compressed) ; // Constructor from implicit (compressed) expression.
*/
template <typename PFP>
class LocalFrame
class Frame
{
typedef typename PFP::REAL REAL ;
typedef typename Geom::Vector<2,REAL> VEC2 ;
......@@ -79,32 +121,40 @@ class LocalFrame
private: // fields
/**
* The three explicit vectors
* The Euler angles
*/
VEC3 m_T,m_B,m_N ;
VEC3 m_EulerAngles ;
public: // methods
/**
* Constructor from explicit data
* @param T the tangent vector
* @param B the bitangent vector
* @param N the normal vector
* @param X the tangent vector
* @param Y the bitangent vector
* @param Z the normal vector
*/
LocalFrame(const VEC3& T, const VEC3& B, const VEC3& N) ;
Frame(const VEC3& X, const VEC3& Y, const VEC3& Z) ;
/**
* Constructor from implicit (compressed representation)
* @param compressedFrame an implicit (compressed) version of the local frame (can be produced by localFrame.getCompressed())
* @param compressedFrame an implicit (compressed) version of the local frame (can be produced by Frame.getCompressed())
*/
LocalFrame(const VEC3& compressedFrame) ;
Frame(const VEC3& compressedFrame) ;
~LocalFrame() {} ;
~Frame() {} ;
/**
* Returns a compressed version of the current local frame
* A VEC3 is not sufficient to completely define a local frame (if phiN=0, the decompression is not unique).
*/
VEC3 getCompressed() const ;
const VEC3& getCompressed() const { return m_EulerAngles ; } ;
/**
* Returns a decompressed frame (set of 3 VEC3)
* @param X : the X vector
* @param Y : the Y vector
* @param Z : the Z vector
*/
void getFrame(VEC3& X, VEC3& Y, VEC3& Z) const ;
/**
* Tests if the frames are identical
......@@ -112,100 +162,61 @@ public: // methods
* @param epsilon the authorized deviation
* @return true if frames are identical (or deviate less than epsilon)
*/
bool equals(const LocalFrame<PFP>& lf, REAL epsilon = 1e-6) const ;
bool equals(const Frame<PFP>& lf, REAL epsilon = 1e-6) const ;
/**
* Equality of frames
* Identical to calling equals with default epsilon
* @return true if frames are identical
*/
bool operator==(const LocalFrame<PFP>& lf) const ;
bool operator==(const Frame<PFP>& lf) const ;
/**
* Inequality of frames
* Identical to calling !equals with default epsilon
* @return false if frames are identical
*/
bool operator!=(const LocalFrame<PFP>& lf) const ;
/**
* Tests if the frame is direct
* @return true if the frame is direct
*/
bool isDirect(REAL epsilon = 1e-7) const ;
/**
* Tests if the frame is orthogonal
* @return true if the frame is orthogonal
*/
bool isOrthogonal(REAL epsilon = 1e-5) const ;
/**
* Tests if the frame is normalized
* @return true if the frame is normalized
*/
bool isNormalized(REAL epsilon = 1e-5) const ;
/**
* Tests if the frame is direct, normalized and orthogonal