Commit 6d4091ee authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

Merge cgogn.unistra.fr:~kraemer/CGoGN

parents 91c76a9d 8e0ed488
......@@ -138,7 +138,7 @@ int main(int argc, char **argv)
}
// extrusion
Dart d = Algo::Modelisation::extrusion_scale<PFP>(myMap, position, objV, PFP::VEC3(0.0,0.0,0.0), PFP::VEC3(0.0,1.0,0.0),true, pathV, false, pathRadius);
Algo::Modelisation::extrusion_scale<PFP>(myMap, position, objV, PFP::VEC3(0.0,0.0,0.0), PFP::VEC3(0.0,1.0,0.0),true, pathV, false, pathRadius);
// bounding box
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
......
......@@ -54,7 +54,7 @@ SimpleGMap3::SimpleGMap3()
SelectorMarked sm(markOrient);
std::cout << "AAA"<< std::endl;
Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
//Algo::Modelisation::catmullClarkVol<PFP,PFP::TVEC3,PFP::VEC3>(myMap, position, sm);
for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
position[i] += VEC3(2,0,0);
......
......@@ -266,8 +266,8 @@ void MyQT::cb_keyPress(int code)
if(code == 'c')
{
SelectorDartNoBoundary<PFP::MAP> nb(myMap);
Algo::Modelisation::catmullClarkVol<PFP>(myMap, position, nb);
//SelectorDartNoBoundary<PFP::MAP> nb(myMap);
Algo::Modelisation::catmullClarkVol<PFP>(myMap, position);
m_positionVBO->updateData(position);
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES);
......@@ -275,7 +275,7 @@ void MyQT::cb_keyPress(int code)
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS);
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f, 0.9f, nb);
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f, 0.9f, allDarts);
}
}
......
......@@ -76,7 +76,37 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch
* @return true
*/
template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good = allDarts) ;
bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
/**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format).
*
* exports position + any attribute named : "frame_T" (frame tangent : VEC3), "frame_B" (frame binormal : VEC3), "frame_N" (frame normal : VEC3),
* "colorPTM_a<i> : VEC3" (coefficient number i of the 3 polynomials - one per channel - ; the max i depends on the degree of the PTM polynomial),
* "errL2 : REAL" (L2 fitting error), "errLmax : REAL" (maximal fitting error), "stdDev : REAL" (standard deviation of the L2 fitting errors).
*
* @param map map to be exported
* @param filename filename of ply file
* @param position the position container
* @return true
*/
template <typename PFP>
bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
/**
* export the map into a PLYSLF file (K. Vanhoey generic format).
*
* exports position + any attribute named : "frame_T" (frame tangent : VEC3), "frame_B" (frame binormal : VEC3), "frame_N" (frame normal : VEC3),
* "SLF_<i> : VEC3" (coefficient number i of the 3 - one per channel - ; the max i is nbCoefs),
*
* @param map map to be exported
* @param filename filename of ply file
* @param position the position container
* @param nbCoefs the number of coefficients of the representation
* @return true
*/
template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
/**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format)
......@@ -88,7 +118,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ
* @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 FunctorSelect& good) ;
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 FunctorSelect& good = allDarts) ;
} // namespace Export
......
......@@ -180,7 +180,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
}
template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good)
bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good)
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
......@@ -263,11 +263,11 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ
out << "property float ny" << std::endl ;
out << "property float nz" << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float L1_a" << coefI << std::endl ;
out << "property float C0_a" << coefI << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float L2_a" << coefI << std::endl ;
out << "property float C1_a" << coefI << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float L3_a" << coefI << std::endl ;
out << "property float C2_a" << coefI << std::endl ;
TREAL errL2 = map.template getAttribute<REAL>(VERTEX,"errL2") ;
TREAL errLmax = map.template getAttribute<REAL>(VERTEX,"errLmax") ;
......@@ -321,6 +321,283 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ
return true ;
}
template <typename PFP>
bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, 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())
{
CGoGNerr << "Unable to open file " << filename << CGoGNendl ;
return false ;
}
AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX);
unsigned int nbDarts = map.getNbDarts() ;
std::vector<unsigned int> vertices;
std::vector<unsigned int> faces;
vertices.reserve(nbDarts/5); // TODO non optimal reservation
faces.reserve(nbDarts/3);
CellMarker markV(map, VERTEX);
TraversorF<MAP> t(map, good) ;
unsigned int lab = 0;
unsigned int nbf = 0;
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
std::vector<unsigned int> face ;
Traversor2FV<typename PFP::MAP> tfv(map, d) ;
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{
if (!markV.isMarked(it))
{
markV.mark(it);
tableVertLab[it] = lab++;
vertices.push_back(map.getEmbedding(VERTEX, it));
}
face.push_back(tableVertLab[it]);
}
faces.push_back(face.size()) ;
for (unsigned int i = 0 ; i < face.size() ; ++i)
faces.push_back(face.at(i)) ;
++nbf;
}
TVEC3 frame[3] ;
std::vector<TVEC3> coefs ;
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") ;
unsigned int i = 0 ;
do {
std::stringstream name ;
name << "SLFcoefs_" << i++ ;
coefs.push_back(map.template getAttribute<VEC3>(VERTEX, name.str())) ;
} while (coefs[i-1].isValid()) ;
const unsigned int nbCoefs = i - 1 ; // last valid one is i-2
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
assert(coefs[coefI].isValid()) ;
std::string file(filename) ;
size_t pos = file.rfind(".") ; // position of "." in filename
std::string extension = file.substr(pos) ;
out << "ply" << std::endl ;
out << "format ascii 1.0" << std::endl ;
out << "comment ply SLF (K. Vanhoey generic format): SLF_" << (((extension == ".plyPTMext") || extension == ".plyPTMextBin" ) ? "PTMext" : "SHreal") << std::endl ;
out << "element vertex " << vertices.size() << std::endl ;
out << "property float x" << std::endl ;
out << "property float y" << std::endl ;
out << "property float z" << std::endl ;
out << "property float tx" << std::endl ;
out << "property float ty" << std::endl ;
out << "property float tz" << std::endl ;
out << "property float bx" << std::endl ;
out << "property float by" << std::endl ;
out << "property float bz" << std::endl ;
out << "property float nx" << std::endl ;
out << "property float ny" << std::endl ;
out << "property float nz" << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float C0_" << coefI << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float C1_" << coefI << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float C2_" << coefI << std::endl ;
out << "element face " << nbf << std::endl ;
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];
// position
for(unsigned int coord = 0 ; coord < 3 ; ++coord)
out << position[vi][coord] << " " ;
// frame
for(unsigned int axis = 0 ; axis < 3 ; ++axis)
for (unsigned int coord = 0 ; coord < 3 ; ++coord)
out << frame[axis][vi][coord] << " " ;
// coefficients
for (unsigned int channel = 0 ; channel < 3 ; ++channel)
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << coefs[coefI][vi][channel] << " " ;
out << std::endl ;
}
std::vector<unsigned int>::iterator it = faces.begin();
while (it != faces.end())
{
unsigned int nbe = *it++;
out << nbe ;
for(unsigned int j = 0; j < nbe; ++j)
out << " " << *it++;
out << std::endl ;
}
out.close() ;
return true ;
}
template <typename PFP>
bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, 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())
{
CGoGNerr << "Unable to open file " << filename << CGoGNendl ;
return false ;
}
AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX);
unsigned int nbDarts = map.getNbDarts() ;
std::vector<unsigned int> vertices;
std::vector<unsigned int> faces;
vertices.reserve(nbDarts/5); // TODO non optimal reservation
faces.reserve(nbDarts/3);
CellMarker markV(map, VERTEX);
TraversorF<MAP> t(map, good) ;
unsigned int lab = 0;
unsigned int nbf = 0;
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
std::vector<unsigned int> face ;
Traversor2FV<typename PFP::MAP> tfv(map, d) ;
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{
if (!markV.isMarked(it))
{
markV.mark(it);
tableVertLab[it] = lab++;
vertices.push_back(map.getEmbedding(VERTEX, it));
}
face.push_back(tableVertLab[it]);
}
faces.push_back(face.size()) ;
for (unsigned int i = 0 ; i < face.size() ; ++i)
faces.push_back(face.at(i)) ;
++nbf;
}
TVEC3 frame[3] ;
std::vector<TVEC3> coefs ;
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") ;
unsigned int i = 0 ;
do {
std::stringstream name ;
name << "SLFcoefs_" << i++ ;
coefs.push_back(map.template getAttribute<VEC3>(VERTEX, name.str())) ;
} while (coefs[i-1].isValid()) ;
const unsigned int nbCoefs = i - 1 ; // last valid one is i-2
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
assert(coefs[coefI].isValid()) ;
std::string file(filename) ;
size_t pos = file.rfind(".") ; // position of "." in filename
std::string extension = file.substr(pos) ;
out << "ply" << std::endl ;
out << "format ascii 1.0" << std::endl ;
out << "comment ply SLF (K. Vanhoey generic format): SLF_" << ((extension == ".plyPTMext") ? "PTMext" : "SHreal") << std::endl ;
out << "element vertex " << vertices.size() << std::endl ;
out << "property float x" << std::endl ;
out << "property float y" << std::endl ;
out << "property float z" << std::endl ;
out << "property float tx" << std::endl ;
out << "property float ty" << std::endl ;
out << "property float tz" << std::endl ;
out << "property float bx" << std::endl ;
out << "property float by" << std::endl ;
out << "property float bz" << std::endl ;
out << "property float nx" << std::endl ;
out << "property float ny" << std::endl ;
out << "property float nz" << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float C0_" << coefI << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float C1_" << coefI << std::endl ;
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
out << "property float C2_" << coefI << std::endl ;
out << "element face " << nbf << std::endl ;
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];
// position
for(unsigned int coord = 0 ; coord < 3 ; ++coord)
{
const float& floatofdouble = position[vi][coord] ;
out.write((char*)(&floatofdouble), sizeof(float)) ;
}
// frame
for(unsigned int axis = 0 ; axis < 3 ; ++axis)
for (unsigned int coord = 0 ; coord < 3 ; ++coord)
{
const float& floatofdouble = frame[axis][vi][coord] ;
out.write((char*)(&floatofdouble), sizeof(float)) ;
}
// coefficients
for (unsigned int channel = 0 ; channel < 3 ; ++channel)
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
{
const float& floatofdouble = coefs[coefI][vi][channel] ;
out.write((char*)(&floatofdouble), sizeof(float)) ;
}
}
std::vector<unsigned int>::iterator it = faces.begin();
while (it != faces.end())
{
unsigned int nbe = *it++;
out.write((char*)&nbe, sizeof(unsigned int)) ;
for(unsigned int j = 0; j < nbe; ++j)
{
unsigned int index = *it++ ;
out.write((char*)(&index), sizeof(unsigned int)) ;
}
}
out.close() ;
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 FunctorSelect& good)
{
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
......@@ -17,7 +17,7 @@
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
......@@ -37,9 +37,42 @@ namespace Geometry
template <typename PFP>
void featureEdgeDetection(typename PFP::MAP& map, const typename PFP::TVEC3& position, CellMarker& featureEdge) ;
template <typename PFP>
void computeArea(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TREAL& area, const FunctorSelect& select = allDarts, unsigned int thread = 0) ;
template <typename PFP>
void computeFaceGradient(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& face_gradient, const typename PFP::TVEC3& face_normal, const typename PFP::TREAL& kmax, const typename PFP::TREAL& area, const FunctorSelect& select = allDarts, unsigned int thread = 0) ;
template <typename PFP>
void computeGradient(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& gradient, typename PFP::TVEC3& face_gradient, const typename PFP::TREAL& area, const FunctorSelect& select = allDarts, unsigned int thread = 0) ;
template <typename PFP>
void computeTriangleType(typename PFP::MAP& map, const typename PFP::TVEC3& position, CellMarker& regularMarker, const FunctorSelect& select = allDarts, unsigned int thread = 0) ;
template <typename PFP>
void computeCurvatureSign(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& triangle_type, typename PFP::TVEC3& k, const FunctorSelect& select = allDarts, unsigned int thread = 0) ;
template <typename PFP>
std::vector<typename PFP::VEC3> occludingContoursDetection(typename PFP::MAP& map, const typename PFP::VEC3& cameraPosition, const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal) ;
template <typename PFP>
typename PFP::TREAL faceArea(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position) ;
template <typename PFP>
typename PFP::VEC3 faceGradient(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position, const typename PFP::TVEC3& face_normal, const typename PFP::TREAL& kmax, const typename PFP::TREAL& area) ;
template <typename PFP>
bool triangleType(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position) ;
template <typename PFP>
bool isInSameOctant(const typename PFP::VEC3& pos1, const typename PFP::VEC3& pos2) ;
template <typename PFP>
void curvatureSign(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position, typename PFP::TVEC3& triangle_type, typename PFP::TVEC3& k) ;
template <typename PFP>
typename PFP::TVEC3 vertexGradient(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position, const typename PFP::TVEC3& face_gradient, const typename PFP::TREAL& area) ;
} // namespace Geometry
} // namespace Algo
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
......@@ -17,7 +17,7 @@
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Web site: http://cgogn.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
......@@ -58,6 +58,53 @@ void featureEdgeDetection(typename PFP::MAP& map, typename PFP::TVEC3& position,
// map.template removeAttribute<VEC3>(fNormal) ;
}
template <typename PFP>
void computeArea(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TREAL& area, const FunctorSelect& select = allDarts, unsigned int thread = 0)
{
TraversorF<typename PFP::MAP> trav(map, select, thread);
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
area[d] = faceArea<PFP>(map, d, position)[1] ;
}
template <typename PFP>
void computeFaceGradient(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& face_gradient, const typename PFP::TVEC3& face_normal, const typename PFP::TREAL& kmax, const typename PFP::TREAL& area, const FunctorSelect& select = allDarts, unsigned int thread = 0)
{
TraversorF<typename PFP::MAP> trav(map, select, thread);
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
face_gradient[d] = faceGradient<PFP>(map, d, position, face_normal, kmax, area) ;
}
template <typename PFP>
void computeGradient(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& gradient, typename PFP::TVEC3& face_gradient, const typename PFP::TREAL& area, const FunctorSelect& select = allDarts, unsigned int thread = 0)
{
TraversorV<typename PFP::MAP> trav(map, select, thread);
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
gradient[d] = vertexGradient<PFP>(map, d, position, face_gradient, area) ;
}
template <typename PFP>
void computeTriangleType(typename PFP::MAP& map, const typename PFP::TVEC3& position, CellMarker& regularMarker, const FunctorSelect& select = allDarts, unsigned int thread = 0)
{
TraversorF<typename PFP::MAP> trav(map, select, thread);
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
if(triangleType<PFP>(map, d, position))
regularMarker.mark(d) ;
}
template <typename PFP>
void computeCurvatureSign(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& triangle_type, typename PFP::TVEC3& k, const FunctorSelect& select = allDarts, unsigned int thread = 0)
{
CellMarker mv(map, VERTEX, thread);
TraversorV<typename PFP::MAP> trav(map, select, thread);
for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
{
if (!mv.isMarked(d))
{
curvatureSign<PFP>(map, d, position, triangle_type, k) ;
}
}
}
template <typename PFP>
std::vector<typename PFP::VEC3> occludingContoursDetection(typename PFP::MAP& map, const typename PFP::VEC3& cameraPosition, const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal)
{
......@@ -112,6 +159,188 @@ std::vector<typename PFP::VEC3> occludingContoursDetection(typename PFP::MAP& ma
return occludingContours ;
}
template <typename PFP>
float faceArea(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position)
{
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
float A [1] ;
VEC3 pos1(0) ;
VEC3 pos2(0) ;
VEC3 pos3(0) ;
Traversor2FV<typename PFP::MAP> t(map, d) ;
Dart it = t.begin() ;
pos1 += position[it] ;
it = t.next ;
pos2 += position[it] ;
it = t.next ;
pos3 += position[it] ;
A = 1/2 * abs(
( (pos2.x - pos1.x) * (pos3.y - pos1.y) )
-
( (pos3.x - pos1.x) * (pos2.y - pos1.y) )
) ;
return A ;
}
template <typename PFP>
typename PFP::VEC3 faceGradient(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position, const typename PFP::TVEC3& face_normal, const typename PFP::TREAL& kmax, const typename PFP::TREAL& area)
{
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
VEC3 G(0) ;
VEC3 pos1(0) ;