Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit 981f2911 authored by Thomas Jund's avatar Thomas Jund
Browse files

Merge cgogn:~cgogn/CGoGN

parents 64657a8e 74ad6e7b
......@@ -422,6 +422,12 @@ int main(int argc, char **argv)
prim.hexaGrid_topo(nb,nb,nb);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
for (unsigned int i=position.begin(); i != position.end(); position.next(i))
{
PFP::VEC3 pert(float(double(rand())/RAND_MAX/20.0),float(double(rand())/RAND_MAX/20.0),float(double(rand())/RAND_MAX/20.0));
position[i]+= pert;
}
color = myMap.addAttribute<PFP::VEC3, VOLUME>("color");
TraversorW<PFP::MAP> tra(myMap);
for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
......
......@@ -56,16 +56,16 @@
</property>
</widget>
</item>
<item row="2" column="2" alignment="Qt::AlignRight">
<item row="2" column="2">
<widget class="QPushButton" name="button_refreshVBOs">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Refresh</string>
......@@ -75,11 +75,7 @@
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="Line" name="line"/>
</item>
<item>
<widget class="QCheckBox" name="check_renderVertices">
......
......@@ -49,7 +49,7 @@ void filterAverageAttribute_OneRing(
const FunctorSelect& select = allDarts)
{
FunctorAverage<T, VERTEX> fa(attIn) ;
Algo::Selection::Collector_OneRing<PFP> col(map) ;
Algo::Surface::Selection::Collector_OneRing<PFP> col(map) ;
TraversorV<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
......@@ -98,7 +98,7 @@ void filterAverageVertexAttribute_WithinSphere(
{
FunctorAverage<T, VERTEX> faInside(attIn) ;
FunctorAverageOnSphereBorder<PFP, T> faBorder(map, attIn, position) ;
Algo::Selection::Collector_WithinSphere<PFP> col(map, position, radius) ;
Algo::Surface::Selection::Collector_WithinSphere<PFP> col(map, position, radius) ;
TraversorV<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
......@@ -139,7 +139,7 @@ void filterAverageEdgeAttribute_WithinSphere(
const FunctorSelect& select = allDarts)
{
FunctorAverage<T, EDGE> fa(attIn) ;
Algo::Selection::Collector_WithinSphere<PFP> col(map, position, radius) ;
Algo::Surface::Selection::Collector_WithinSphere<PFP> col(map, position, radius) ;
TraversorE<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
......@@ -167,7 +167,7 @@ void filterAverageFaceAttribute_WithinSphere(
const FunctorSelect& select = allDarts)
{
FunctorAverage<T, FACE> fa(attIn) ;
Algo::Selection::Collector_WithinSphere<PFP> col(map, position, radius) ;
Algo::Surface::Selection::Collector_WithinSphere<PFP> col(map, position, radius) ;
TraversorF<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
......
......@@ -87,9 +87,9 @@ void filterAverageNormals(typename PFP::MAP& map, const VertexAttribute<typename
FaceAutoAttribute<VEC3> faceNormal(map, "faceNormal") ;
FaceAutoAttribute<VEC3> faceCentroid(map, "faceCentroid") ;
Algo::Geometry::computeAreaFaces<PFP>(map, position, faceArea, select) ;
Algo::Geometry::computeNormalFaces<PFP>(map, position, faceNormal, select) ;
Algo::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, select) ;
Algo::Surface::Geometry::computeAreaFaces<PFP>(map, position, faceArea, select) ;
Algo::Surface::Geometry::computeNormalFaces<PFP>(map, position, faceNormal, select) ;
Algo::Surface::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, select) ;
FaceAutoAttribute<VEC3> faceNewNormal(map, "faceNewNormal") ;
......@@ -131,9 +131,9 @@ void filterMMSE(typename PFP::MAP& map, float sigmaN2, const VertexAttribute<typ
FaceAutoAttribute<VEC3> faceNormal(map, "faceNormal") ;
FaceAutoAttribute<VEC3> faceCentroid(map, "faceCentroid") ;
Algo::Geometry::computeAreaFaces<PFP>(map, position, faceArea, select) ;
Algo::Geometry::computeNormalFaces<PFP>(map, position, faceNormal, select) ;
Algo::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, select) ;
Algo::Surface::Geometry::computeAreaFaces<PFP>(map, position, faceArea, select) ;
Algo::Surface::Geometry::computeNormalFaces<PFP>(map, position, faceNormal, select) ;
Algo::Surface::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, select) ;
FaceAutoAttribute<VEC3> faceNewNormal(map, "faceNewNormal") ;
......@@ -216,9 +216,9 @@ void filterTNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
FaceAutoAttribute<VEC3> faceNormal(map, "faceNormal") ;
FaceAutoAttribute<VEC3> faceCentroid(map, "faceCentroid") ;
Algo::Geometry::computeAreaFaces<PFP>(map, position, faceArea, select) ;
Algo::Geometry::computeNormalFaces<PFP>(map, position, faceNormal, select) ;
Algo::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, select) ;
Algo::Surface::Geometry::computeAreaFaces<PFP>(map, position, faceArea, select) ;
Algo::Surface::Geometry::computeNormalFaces<PFP>(map, position, faceNormal, select) ;
Algo::Surface::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, select) ;
FaceAutoAttribute<VEC3> faceNewNormal(map, "faceNewNormal") ;
......@@ -335,9 +335,9 @@ void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
FaceAutoAttribute<VEC3> faceNormal(map, "faceNormal") ;
FaceAutoAttribute<VEC3> faceCentroid(map, "faceCentroid") ;
Algo::Geometry::computeAreaFaces<PFP>(map, position, faceArea, select) ;
Algo::Geometry::computeNormalFaces<PFP>(map, position, faceNormal, select) ;
Algo::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, select) ;
Algo::Surface::Geometry::computeAreaFaces<PFP>(map, position, faceArea, select) ;
Algo::Surface::Geometry::computeNormalFaces<PFP>(map, position, faceNormal, select) ;
Algo::Surface::Geometry::computeCentroidFaces<PFP>(map, position, faceCentroid, select) ;
VertexAutoAttribute<REAL> vertexArea(map, "vertexArea") ;
FaceAutoAttribute<VEC3> faceNewNormal(map, "faceNewNormal") ;
......@@ -369,7 +369,7 @@ void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
float angle = Geom::angle(normV, neighborNormal) ;
if( angle <= SUSANthreshold )
{
REAL umbArea = Algo::Geometry::vertexOneRingArea<PFP>(map, it, position) ;
REAL umbArea = Algo::Surface::Geometry::vertexOneRingArea<PFP>(map, it, position) ;
vertexArea[it] = umbArea ;
sumArea += umbArea ;
......
......@@ -49,7 +49,7 @@ void sigmaBilateral(typename PFP::MAP& map, const VertexAttribute<typename PFP::
TraversorE<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
sumLengths += Algo::Geometry::edgeLength<PFP>(map, d, position) ;
sumLengths += Algo::Surface::Geometry::edgeLength<PFP>(map, d, position) ;
sumAngles += Geom::angle(normal[d], normal[map.phi1(d)]) ;
++nbEdges ;
}
......@@ -80,7 +80,7 @@ void filterBilateral(typename PFP::MAP& map, const VertexAttribute<typename PFP:
Traversor2VE<typename PFP::MAP> te(map, d) ;
for(Dart it = te.begin(); it != te.end(); it = te.next())
{
VEC3 vec = Algo::Geometry::vectorOutOfDart<PFP>(map, it, position) ;
VEC3 vec = Algo::Surface::Geometry::vectorOutOfDart<PFP>(map, it, position) ;
float h = normal_d * vec ;
float t = vec.norm() ;
float wcs = exp( ( -1.0f * (t * t) / (2.0f * sigmaC * sigmaC) ) + ( -1.0f * (h * h) / (2.0f * sigmaS * sigmaS) ) ) ;
......@@ -125,7 +125,7 @@ void filterSUSAN(typename PFP::MAP& map, float SUSANthreshold, const VertexAttri
float angle = Geom::angle(normal_d, neighborNormal) ;
if( angle <= SUSANthreshold )
{
VEC3 vec = Algo::Geometry::vectorOutOfDart<PFP>(map, it, position) ;
VEC3 vec = Algo::Surface::Geometry::vectorOutOfDart<PFP>(map, it, position) ;
float h = normal_d * vec ;
float t = vec.norm() ;
float wcs = exp( ( -1.0f * (t * t) / (2.0f * sigmaC * sigmaC) ) + ( -1.0f * (h * h) / (2.0f * sigmaS * sigmaS) ) );
......
......@@ -42,7 +42,7 @@ void filterTaubin(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& p
{
typedef typename PFP::VEC3 VEC3 ;
Algo::Selection::Collector_OneRing<PFP> c(map) ;
Algo::Surface::Selection::Collector_OneRing<PFP> c(map) ;
const float lambda = 0.6307 ;
const float mu = -0.6732 ;
......@@ -109,7 +109,7 @@ void filterTaubin_modified(typename PFP::MAP& map, VertexAttribute<typename PFP:
CellMarkerNoUnmark<VERTEX> mv(map) ;
FunctorAverageOnSphereBorder<PFP, VEC3> fa1(map, position, position) ;
Algo::Selection::Collector_WithinSphere<PFP> c1(map, position, radius) ;
Algo::Surface::Selection::Collector_WithinSphere<PFP> c1(map, position, radius) ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(select(d) && !mv.isMarked(d))
......@@ -133,7 +133,7 @@ void filterTaubin_modified(typename PFP::MAP& map, VertexAttribute<typename PFP:
// unshrinking step
FunctorAverageOnSphereBorder<PFP, VEC3> fa2(map, position2, position2) ;
Algo::Selection::Collector_WithinSphere<PFP> c2(map, position2, radius) ;
Algo::Surface::Selection::Collector_WithinSphere<PFP> c2(map, position2, radius) ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(select(d) && mv.isMarked(d))
......
......@@ -27,6 +27,15 @@
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
extern "C"
{
#include "C_BLAS_LAPACK/INCLUDE/f2c.h"
#include "C_BLAS_LAPACK/INCLUDE/clapack.h"
}
#undef max
#undef min
namespace CGoGN
{
......
......@@ -14,6 +14,10 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace Geometry
{
......@@ -111,6 +115,7 @@ protected :
}// end namespace Geometry
}// end namespace Surface
}// end namespace Algo
}// end namespace CGoGN
......
......@@ -4,6 +4,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace Geometry
{
......@@ -543,5 +546,6 @@ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeed(unsigned int numSeed){
}
*/
}// end namespace Geometry
} // Surface
}// end namespace Algo
}// end namespace CGoGN
......@@ -117,20 +117,12 @@ void DooSabin(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
///**
// * Reverse the orientation of the map
// * NOW IN THE MAP
// */
//template <typename PFP>
//void reverseOrientation(typename PFP::MAP& map) ;
//
///**
// * Dual mesh computation
// */
//template <typename PFP>
//void computeDual(typename PFP::MAP& map, const FunctorSelect& selected = allDarts) ;
//
//template <typename PFP>
//void computeDualV2(typename PFP::MAP& map, const FunctorSelect& selected = allDarts) ;
//
///**
// * Sqrt(3) subdivision scheme
// */
//template <typename PFP>
......
......@@ -628,114 +628,6 @@ void DooSabin(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& posit
}
}
//template <typename PFP>
//void reverseOrientation(typename PFP::MAP& map)
//{
// DartAttribute<unsigned int> emb0(&map, map.template getEmbeddingAttributeVector<VERTEX>()) ;
// if(emb0.isValid())
// {
// DartAttribute<unsigned int> new_emb0 = map.template addAttribute<unsigned int, DART>("new_EMB_0") ;
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// new_emb0[d] = emb0[map.phi1(d)] ;
// map.template swapAttributes<unsigned int>(emb0, new_emb0) ;
// map.removeAttribute(new_emb0) ;
// }
//
// DartAttribute<Dart> phi1 = map.template getAttribute<Dart, DART>("phi1") ;
// DartAttribute<Dart> phi_1 = map.template getAttribute<Dart, DART>("phi_1") ;
// map.template swapAttributes<Dart>(phi1, phi_1) ;
//}
//
//template <typename PFP>
//void computeDual(typename PFP::MAP& map, const FunctorSelect& selected)
//{
// DartAttribute<Dart> phi1 = map.template getAttribute<Dart, DART>("phi1") ;
// DartAttribute<Dart> phi_1 = map.template getAttribute<Dart, DART>("phi_1") ;
// DartAttribute<Dart> new_phi1 = map.template addAttribute<Dart, DART>("new_phi1") ;
// DartAttribute<Dart> new_phi_1 = map.template addAttribute<Dart, DART>("new_phi_1") ;
//
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// Dart dd = map.phi1(map.phi2(d));
//
// new_phi1[d] = dd ;
// new_phi_1[dd] = d ;
// }
//
// map.template swapAttributes<Dart>(phi1, new_phi1) ;
// map.template swapAttributes<Dart>(phi_1, new_phi_1) ;
//
// map.removeAttribute(new_phi1) ;
// map.removeAttribute(new_phi_1) ;
//
// map.swapEmbeddingContainers(VERTEX, FACE) ;
//
// reverseOrientation<PFP>(map) ;
//
//// //boundary management
//// for(Dart d = map.begin(); d != map.end(); map.next(d))
//// {
//// if(map.isBoundaryMarked(d))
//// {
//// map.template boundaryMarkOrbit<FACE>(map.deleteVertex(map.phi2(d))); //map.deleteCycle();
//// }
//// }
//}
//
//template <typename PFP>
//void computeDualV2(typename PFP::MAP& map, const FunctorSelect& selected)
//{
// DartAttribute<Dart> phi1 = map.template getAttribute<Dart, DART>("phi1") ;
// DartAttribute<Dart> phi_1 = map.template getAttribute<Dart, DART>("phi_1") ;
// DartAttribute<Dart> new_phi1 = map.template addAttribute<Dart, DART>("new_phi1") ;
// DartAttribute<Dart> new_phi_1 = map.template addAttribute<Dart, DART>("new_phi_1") ;
//
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// Dart dd = map.phi1(map.phi2(d));
//
// new_phi1[d] = dd ;
// new_phi_1[dd] = d ;
// }
//
// map.template swapAttributes<Dart>(phi1, new_phi1) ;
// map.template swapAttributes<Dart>(phi_1, new_phi_1) ;
//
// map.removeAttribute(new_phi1) ;
// map.removeAttribute(new_phi_1) ;
//
// //boundary management
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if(map.isBoundaryMarked(d))
// {
// Dart d1 = map.phi1(d);
// Dart dd = map.phi_1(map.phi2(d));
//
// //marquer le brin d1 et le bin dd
//
// phi1[dd] = d1 ;
// phi_1[d1] = dd ;
//
// phi1[d] = map.phi2(d);
// phi_1[map.phi2(d)] = d;
// }
// }
//
// map.swapEmbeddingContainers(VERTEX, FACE) ;
//
// reverseOrientation<PFP>(map) ;
//
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if(map.isBoundaryMarked(d))
// {
// map.deleteCycle(map.phi2(d));
// }
// }
//
// //transformer le marker des brins d1 et dd en boundaryMarker
//}
inline double sqrt3_K(unsigned int n)
......
......@@ -32,6 +32,7 @@
#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/functor.h"
#include "Utils/vbo_base.h"
#include "Utils/Shaders/shaderExplodeSmoothVolumes.h"
#include "Utils/Shaders/shaderExplodeVolumes.h"
#include "Utils/Shaders/shaderExplodeVolumesLines.h"
......@@ -54,16 +55,22 @@ protected:
Utils::ShaderExplodeVolumes* m_shader;
Utils::ShaderExplodeSmoothVolumes* m_shaderS;
bool m_cpf;
bool m_ef;
bool m_smooth;
Utils::ShaderExplodeVolumesLines* m_shaderL;
Utils::VBO* m_vboPos;
Utils::VBO* m_vboColors;
Utils::VBO* m_vboNormals;
Utils::VBO* m_vboPosLine;
/**
......@@ -75,13 +82,21 @@ protected:
Geom::Vec3f m_globalColor;
template<typename PFP>
void updateSmooth(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& positions, const VolumeAttribute<typename PFP::VEC3>& colorPerFace, const FunctorSelect& good = allDarts) ;
template<typename PFP>
void updateSmooth(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& positions, const FunctorSelect& good = allDarts) ;
public:
/**
* Constructor
* @param withColorPerFace affect a color per face
* @param withExplodeFace shrinj each face
* @param withExplodeFace shrink each face
* @param withSmoothFaces use a smooth gouraud interpolation between triangles of a faces
*/
ExplodeVolumeRender(bool withColorPerFace = false, bool withExplodeFace = false) ;
ExplodeVolumeRender(bool withColorPerFace = false, bool withExplodeFace = false, bool withSmoothFaces = false) ;
/**
* Destructor
......@@ -117,6 +132,7 @@ public:
template<typename PFP>
void updateData(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& positions, const VolumeAttribute<typename PFP::VEC3>& colorPerFace, const FunctorSelect& good = allDarts) ;
/**
* draw edges
*/
......
......@@ -29,6 +29,8 @@
#include "Algo/Geometry/centroid.h"
#include "Topology/generic/autoAttributeHandler.h"
#include "Algo/Geometry/basic.h"
namespace CGoGN
{
......@@ -41,8 +43,9 @@ namespace Render
namespace GL2
{
inline ExplodeVolumeRender::ExplodeVolumeRender(bool withColorPerFace, bool withExplodeFace):
m_cpf(withColorPerFace),m_ef(withExplodeFace),m_globalColor(0.7f,0.7f,0.7f)
inline ExplodeVolumeRender::ExplodeVolumeRender(bool withColorPerFace, bool withExplodeFace, bool withSmoothFaces):
m_cpf(withColorPerFace),m_ef(withExplodeFace),m_smooth(withSmoothFaces),
m_nbTris(0), m_nbLines(0),m_globalColor(0.7f,0.7f,0.7f)
{
m_vboPos = new Utils::VBO();
m_vboPos->setDataSize(3);
......@@ -50,19 +53,24 @@ inline ExplodeVolumeRender::ExplodeVolumeRender(bool withColorPerFace, bool with
m_vboColors = new Utils::VBO();
m_vboColors->setDataSize(3);
m_vboPosLine = new Utils::VBO();
m_vboPosLine->setDataSize(3);
m_shader = new Utils::ShaderExplodeVolumes(withColorPerFace,withExplodeFace);
m_shaderL = new Utils::ShaderExplodeVolumesLines();
// m_shader->setAmbiant(Geom::Vec4f(0.1f,0.1f,0.1f,0.0f));
// m_shader->setDiffuse(Geom::Vec4f(1.0f,1.0f,0.1f,0.0f));
//m_shaderL->setColor(Geom::Vec4f(1.0f,1.0f,1.0f,0.0f));
//m_shaderL->setColor(Geom::Vec4f(0.113f,0.337f,0.0f,0.113f));
if (m_smooth)
{
m_shaderS = new Utils::ShaderExplodeSmoothVolumes(withColorPerFace,withExplodeFace);
m_shader = NULL;
m_vboNormals = new Utils::VBO();
m_vboNormals->setDataSize(3);
}
else
{
m_shader = new Utils::ShaderExplodeVolumes(withColorPerFace,withExplodeFace);
m_shaderS = NULL;
m_vboNormals = NULL;
}
m_shaderL = new Utils::ShaderExplodeVolumesLines();
m_shaderL->setColor(Geom::Vec4f(1.0f,1.0f,1.0f,0.0f));
}
......@@ -72,19 +80,133 @@ inline ExplodeVolumeRender::~ExplodeVolumeRender()
delete m_vboPos;
delete m_vboColors;
delete m_vboPosLine;
delete m_shader;
if (m_vboNormals != NULL)
delete m_vboNormals;
if (m_shader != NULL)
delete m_shader;
if (m_shaderS != NULL)
delete m_shaderS;
delete m_shaderL;
}
template<typename PFP>
void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& positions, const FunctorSelect& good)
void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& positions, const VolumeAttribute<typename PFP::VEC3>& colorPerXXX, const FunctorSelect& good)
{
if (m_cpf)
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
VolumeAutoAttribute<VEC3> centerVolumes(map, "centerVolumes");
Algo::Volume::Geometry::Parallel::computeCentroidVolumes<PFP>(map, positions, centerVolumes, good);
std::vector<VEC3> buffer;
buffer.reserve(16384);
std::vector<VEC3> bufferColors;
bufferColors.reserve(16384);
std::vector<VEC3> bufferNormals;
bufferNormals.reserve(16384);
std::vector<VEC3> normals;
bufferNormals.reserve(20);
TraversorCell<typename PFP::MAP, PFP::MAP::FACE_OF_PARENT> traFace(map, good);
for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next())
{
CGoGNerr<< "ExplodeVolumeRender: problem wrong update fonction use the other" << CGoGNendl;
return;
// compute normals
normals.clear();
VEC3 centerFace(0);
unsigned int nbs=0;
Dart a = d;
do
{
VEC3 v1 = Algo::Surface::Geometry::vectorOutOfDart<PFP>(map,a,positions);
Dart e = map.phi1(a);
VEC3 v2 = Algo::Surface::Geometry::vectorOutOfDart<PFP>(map,e,positions);
VEC3 N = v1^v2;
N.normalize();
normals.push_back(N);
a = e;
centerFace += positions[d];
nbs++;
} while (a != d);
centerFace /= float(nbs);
typename std::vector<VEC3>::iterator in = normals.begin();
a = d;
Dart b = map.phi1(a);
Dart c = map.phi1(b);
// loop to cut a polygon in triangle on the fly (works only with convex faces)
do
{
buffer.push_back(centerVolumes[d]);
bufferColors.push_back(centerFace);
bufferNormals.push_back(centerFace); // unsused just for fill
buffer.push_back(positions[d]);
bufferColors.push_back(colorPerXXX[d]);
bufferNormals.push_back(normals.back());
buffer.push_back(positions[b]);
bufferColors.push_back(colorPerXXX[b]);
bufferNormals.push_back(*in++);
buffer.push_back(positions[c]);
bufferColors.push_back(colorPerXXX[c]);
bufferNormals.push_back(*in);
b = c;
c = map.phi1(b);
} while (c != d);