Commit 50dba34d authored by Sylvain Thery's avatar Sylvain Thery

MAJ MC

rm vieux Viewer.cpp
MAJ ear Algo
parent 1262e060
......@@ -42,6 +42,8 @@
#include "Algo/Render/SVG/mapSVGRender.h"
#include "Algo/Modelisation/triangulation.h"
using namespace CGoGN ;
......@@ -156,7 +158,7 @@ void MyQT::cb_initGL()
void MyQT::cb_redraw()
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_CULL_FACE);
glDisable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
if (m_shader)
{
......@@ -170,7 +172,7 @@ void MyQT::cb_redraw()
m_render->draw(m_shader, Algo::Render::GL2::LINES);
glPolygonOffset(0.8f, 0.8f);
m_shader->setColor(Geom::Vec4f(1.0,0.,0.,0.));
m_shader->setColor(Geom::Vec4f(0.0,0.,0.,0.));
glLineWidth(1.0f);
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
m_render->drawSub(m_shader, Algo::Render::GL2::TRIANGLES, nb_ears);
......@@ -185,32 +187,58 @@ void MyQT::cb_redraw()
void MyQT::cb_keyPress(int code)
{
if (code == '+')
switch(code)
{
case '+':
nb_ears++;
// born sup dans drawing
updateGL();
}
if (code == '-')
{
break;
case '-':
if (nb_ears>=1)
nb_ears--;
updateGL();
}
if (code == 'n')
{
break;
case 'n':
nb_ears=0;
updateGL();
}
break;
if (code == 'a')
{
case 'a':
nb_ears=99999999;
updateGL();
break;
case 't':
{
Algo::Modelisation::EarTriangulation<PFP> triangulation(myMap);
triangulation.triangule();
SelectorTrue allDarts;
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES);
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::LINES);
updateGL();
}
break;
// case 'u':
// {
// Dart d=myMap.begin();
// while (d != myMap.end())
// {
// if (myMap.phi2(d) != d)
// {
// Dart e = d;
// myMap.next(d);
// if (d== myMap.phi2(e))
// myMap.next(d);
// myMap.mergeFaces(e);
// }
// else
// myMap.next(d);
// }
// }
// break;
}
}
int main(int argc, char **argv)
......@@ -218,7 +246,6 @@ int main(int argc, char **argv)
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
Dart d0 = myMap.newFace(12);
position[d0] = PFP::VEC3(0, 20, 0);
d0 = myMap.phi1(d0);
......@@ -241,7 +268,7 @@ int main(int argc, char **argv)
position[d0] = PFP::VEC3(5, 30, 0);
d0 = myMap.phi1(d0);
position[d0] = PFP::VEC3(0, 30, 0);
d0 = myMap.phi1(d0);
d0 = myMap.newFace(4);
......@@ -382,7 +409,6 @@ int main(int argc, char **argv)
for (int i=0; i<174;++i)
{
float a = float(rand()-RAND_MAX/2)/float(RAND_MAX) * 0.25f;
position[d9] = PFP::VEC3(60.0,60.0,0.0f) + Gfont[2*i] * V1 + Gfont[2*i+1]*V2 + a*V3;
d9 = myMap.phi1(d9);
}
......@@ -417,8 +443,10 @@ int main(int argc, char **argv)
SelectorTrue allDarts;
sqt.m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES);
sqt.m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::LINES);
sqt.m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS);
// show final pour premier redraw
// show final pour premier redraw
sqt.show();
// et on attend la fin.
......
This diff is collapsed.
......@@ -38,7 +38,7 @@ Viewer::Viewer() :
m_pointSprite(NULL)
{
normalScaleFactor = 1.0f ;
vertexScaleFactor = 1.0f ;
vertexScaleFactor = 0.1f ;
faceShrinkage = 1.0f ;
colClear = Geom::Vec4f(0.2f, 0.2f, 0.2f, 0.1f) ;
......@@ -121,7 +121,7 @@ void Viewer::cb_redraw()
{
if(m_drawVertices)
{
float size = vertexBaseSize * vertexScaleFactor ;
float size = vertexScaleFactor ;
m_pointSprite->setSize(size) ;
m_pointSprite->predraw(Geom::Vec3f(0.0f, 0.0f, 1.0f)) ;
m_render->draw(m_pointSprite, Algo::Render::GL2::POINTS) ;
......@@ -189,7 +189,8 @@ void Viewer::importMesh(std::string& filename)
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
normalBaseSize = bb.diagSize() / 100.0f ;
vertexBaseSize = normalBaseSize * 2.0f ;
// vertexBaseSize = normalBaseSize /5.0f ;
if(!normal.isValid())
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal") ;
......@@ -211,7 +212,7 @@ void Viewer::slot_drawVertices(bool b)
void Viewer::slot_verticesSize(int i)
{
vertexScaleFactor = i / 50.0f ;
vertexScaleFactor = i / 500.0f ;
updateGL() ;
}
......
......@@ -26,10 +26,10 @@
#define IMAGE_H
#include <gmtl/Vec.h>
#include "Geometry/vector_gen.h"
#include "Algo/MC/type.h"
#include "img3D_IO.h"
#include "Utils/img3D_IO.h"
#include "Zinrimage.h"
......@@ -228,7 +228,7 @@ public:
* get the origin
* @return a vector with origin
*/
gmtl::Vec3i getOrigin() const { return gmtl::Vec3i(m_OX, m_OY, m_OZ);}
Geom::Vec3i getOrigin() const { return Geom::Vec3i(m_OX, m_OY, m_OZ);}
/**
* get the data const version
......@@ -287,7 +287,7 @@ public:
* @param _Vec vector of voxel position
* @return the value of the voxel
*/
DataType getVoxel( const gmtl::Vec3i &_Vec);
DataType getVoxel( const Geom::Vec3i &_Vec);
/**
......@@ -308,13 +308,13 @@ public:
* Get the lower corner of bounding AABB
*/
// gmtl::Vec3f boundMin() const { return gmtl::Vec3f(0.0f, 0.0f, 0.0f);}
gmtl::Vec3f boundMin() const { return gmtl::Vec3f(m_SX*m_OX, m_SY*m_OY, m_SZ*m_OZ);}
Geom::Vec3f boundMin() const { return Geom::Vec3f(m_SX*m_OX, m_SY*m_OY, m_SZ*m_OZ);}
/**
* Get the upper corner of bounding AABB
*/
// gmtl::Vec3f boundMax() const { return gmtl::Vec3f(m_SX*(m_WX-2*m_OX), m_SY*(m_WY-2*m_OY), m_SZ*(m_WZ-2*m_OZ));}
gmtl::Vec3f boundMax() const { return gmtl::Vec3f(m_SX*(m_WX-m_OX), m_SY*(m_WY-m_OY), m_SZ*(m_WZ-m_OZ));}
Geom::Vec3f boundMax() const { return Geom::Vec3f(m_SX*(m_WX-m_OX), m_SY*(m_WY-m_OY), m_SZ*(m_WZ-m_OZ));}
/**
* Compute the volume in cm3
* @param wind the windowing function
......@@ -322,7 +322,10 @@ public:
template< typename Windowing >
float computeVolume(const Windowing& wind) const;
void Blur3();
/**
* local (3x3) blur of image
*/
Image<DataType>* Blur3();
void createMaskOffsetSphere(std::vector<int>& table, int _i32radius);
......@@ -336,7 +339,7 @@ public:
} // end namespace
} // end namespace
#include "image.hpp"
#include "Algo/MC/image.hpp"
......
......@@ -29,7 +29,7 @@
#include <math.h>
#include <typeinfo>
#include "img3D_IO.h"
#include "Utils/img3D_IO.h"
#include "Zinrimage.h"
namespace CGoGN
......@@ -205,8 +205,6 @@ bool Image<DataType>::loadPNG3D(const char* filename)
template< typename DataType >
bool Image<DataType>::loadInrgz(const char* filename)
{
mImage = readZInrimage(filename);
// A modifier en verifiant le type de donne
......@@ -309,7 +307,7 @@ Image<DataType>* Image<DataType>::addFrame(int frameMax)
float realFS = static_cast<float>(frameMax) * minVS;
// real frame size for anisotropic images
int32 lFX = static_cast<int32>( ceilf( realFS / m_SX) );
int32 lFX = static_cast<int32>( ceilf( realFS / m_SX) );
int32 lFY = static_cast<int32>( ceilf( realFS / m_SY) );
int32 lFZ = static_cast<int32>( ceilf( realFS / m_SZ) );
......@@ -418,45 +416,37 @@ float Image<DataType>::computeVolume(const Windowing& wind) const
}
template< typename DataType >
void Image<DataType>::Blur3()
Image<DataType>* Image<DataType>::Blur3()
{
int txm = m_WX-1;
int tym = m_WY-1;
int tzm = m_WZ-1;
DataType* data2 = new DataType[m_WX*m_WY*m_WZ];
Image<DataType>* newImg = new Image<DataType>(data2,m_WX,m_WY,m_WZ,getVoxSizeX(),getVoxSizeY(),getVoxSizeZ());
newImg->m_Alloc=true;
// set origin of real data in image ??
// coef sur le mask 3x3: 8/4/2/1 pour vox/6-vois/18-vois/26-vois
// for frame
for(int y=0; y<=tym; ++y)
for(int x=0; x<=txm; ++x)
*(newImg->getVoxelPtr(x,y,0)) = *(getVoxelPtr(x,y,0));
for(int x=1; x<txm; ++x)
for(int z=1; z<tzm; ++z)
{
for(int x=0; x<=txm; ++x)
*(newImg->getVoxelPtr(x,0,z)) = *(getVoxelPtr(x,0,z));
for(int y=1; y<tym; ++y)
{
for(int z=1; z<tzm; ++z)
*(newImg->getVoxelPtr(0,y,z)) = *(getVoxelPtr(0,y,z));
#pragma omp parallel for // OpenMP
for(int x=1; x<txm; ++x)
{
DataType* ptr = getVoxelPtr(x,y,z) - m_WXY - m_WX -1;
DataType* ori = ptr;
double val=0;
// for (int i=0; i<3;++i)
// {
// double coef=1.0f;
// if (i%2)
// coef=2.0f;
//
// val += coef*(*ptr++);
// val += 2.0*coef*(*ptr++);
// val += coef*(*ptr);
// ptr += m_WX;
// val += 2.0*coef*(*ptr--);
// val += 4.0*coef*(*ptr--);
// val += 2.0*coef*(*ptr);
// ptr += m_WX;
// val += coef*(*ptr++);
// val += 2.0*coef*(*ptr++);
// val += coef*(*ptr);
// ptr += m_WXY -( 2+m_WX*2);
// }
// val /= 64.0;
DataType* ori = getVoxelPtr(x,y,z);
DataType* dest = newImg->getVoxelPtr(x,y,z);
DataType* ptr = ori - m_WXY - m_WX -1;
double val=0.0;
for (int i=0; i<3;++i)
{
val += (*ptr++);
......@@ -472,12 +462,24 @@ void Image<DataType>::Blur3()
val += (*ptr);
ptr += m_WXY -( 2+m_WX*2);
}
val /= 27.0;
*ori= DataType(val);
val += 3.0 * (*ori);
val /= (27.0 + 3.0);
DataType res(val);
*dest= res;
}
*(newImg->getVoxelPtr(txm,y,z)) = *(getVoxelPtr(txm,y,z));
}
for(int x=0; x<=txm; ++x)
*(newImg->getVoxelPtr(x,tym,z)) = *(getVoxelPtr(x,tym,z));
}
for(int y=0; y<=tym; ++y)
for(int x=1; x<txm; ++x)
*(newImg->getVoxelPtr(x,y,tzm)) = *(getVoxelPtr(x,y,tzm));
return newImg;
}
template<typename DataType>
......@@ -501,8 +503,8 @@ void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32ra
{
for (int x = -_i32radius; x<=_i32radius; x++)
{
gmtl::Vec3f v((float)x,(float)y,(float)z);
float fLength = gmtl::lengthSquared(v);
Geom::Vec3f v((float)x,(float)y,(float)z);
float fLength = v.norm2();
// if inside the sphere
if (fLength<=fRad2)
{
......@@ -518,9 +520,10 @@ void Image<DataType>::createMaskOffsetSphere(std::vector<int>& table, int _i32ra
template<typename DataType>
float Image<DataType>::computeCurvatureCount(const DataType *ptrVox, const std::vector<int>& sphere, DataType val)
{
int noir =0;
int noir = 0;
int blanc = 0;
for (std::vector<int>::const_iterator it=sphere.begin(); it!=sphere.end();it++)
{
const DataType *data = ptrVox + *it;
......@@ -534,7 +537,7 @@ float Image<DataType>::computeCurvatureCount(const DataType *ptrVox, const std::
}
}
if (blanc > noir)
if (blanc >= noir)
{
return 1.0f - ((float)noir) / ((float)blanc);
}
......
......@@ -30,8 +30,7 @@
#include "Algo/MC/buffer.h"
#include "Algo/MC/tables.h"
#include <gmtl/Vec.h>
#include <gmtl/VecOps.h>
#include "Geometry/vector_gen.h"
namespace CGoGN
{
......@@ -193,9 +192,10 @@ protected:
L_DART createTriEmb(unsigned int e1, unsigned int e2, unsigned int e3) {
L_DART d = m_map->newFace(3);
m_map->setSingleVertexEmb(d,e1); d = m_map->phi1(d);
m_map->setSingleVertexEmb(d,e2); d = m_map->phi1(d);
m_map->setSingleVertexEmb(d,e3); d = m_map->phi1(d);
//TODO change this which work only with 2-maps
m_map->setDartEmbedding(VERTEX,d,e1); d = m_map->phi1(d);
m_map->setDartEmbedding(VERTEX,d,e2); d = m_map->phi1(d);
m_map->setDartEmbedding(VERTEX,d,e3); d = m_map->phi1(d);
return d;
}
......@@ -222,7 +222,7 @@ public:
* @param wind the windowing class (for inside/outside distinguish)
* @param boundRemoved true is bound is going to be removed
*/
MarchingCube(Image<DataType>* img, L_MAP* map, unsigned int idPos, Windowing<DataType> wind, bool boundRemoved);
MarchingCube(Image<DataType>* img, L_MAP* map, const typename PFP::TVEC3& position, Windowing<DataType> wind, bool boundRemoved);
/**
* destructor
......@@ -267,5 +267,5 @@ public:
} // end namespace
} // end namespace
#include "marchingcube.hpp"
#include "Algo/MC/marchingcube.hpp"
#endif
......@@ -60,12 +60,12 @@ MarchingCube<DataType, Windowing, PFP>::MarchingCube(Image<DataType>* img, Windo
}
template< typename DataType, template < typename D2 > class Windowing, typename PFP >
MarchingCube<DataType, Windowing, PFP>::MarchingCube(Image<DataType>* img, L_MAP* map, unsigned int idPos, Windowing<DataType> wind, bool boundRemoved):
MarchingCube<DataType, Windowing, PFP>::MarchingCube(Image<DataType>* img, L_MAP* map, const typename PFP::TVEC3& position, Windowing<DataType> wind, bool boundRemoved):
m_Image(img),
m_windowFunc(wind),
m_Buffer(NULL),
m_map(map),
m_positions(idPos,*map),
m_positions(position),
m_fOrigin(typename PFP::VEC3(0.0,0.0,0.0)),
m_fScal(typename PFP::VEC3(1.0,1.0,1.0)),
m_brem(boundRemoved)
......@@ -102,7 +102,6 @@ template< typename DataType, template < typename D2 > class Windowing, typename
void MarchingCube<DataType, Windowing, PFP>::simpleMeshing()
{
// create the mesh if needed
if (m_map==NULL)
{
......@@ -208,7 +207,7 @@ void MarchingCube<DataType, Windowing, PFP>::simpleMeshing()
m_Buffer->nextSlice();
}
// CGoGNout << "Taille 2-carte:"<<m_map->size()<<" brins"<<CGoGNendl;
CGoGNout << "Taille 2-carte:"<<m_map->getNbDarts()<<" brins"<<CGoGNendl;
}
......
......@@ -205,7 +205,7 @@ public:
* @return true if voxel is inside the object
*/
bool inside(DataType val) const {
return (val>=this->m_value);
return (val >= this->m_value);
}
/**
......
......@@ -56,7 +56,7 @@ Polyhedron<PFP>* revolution_prim(typename PFP::MAP& the_map, typename PFP::TVEC3
for(int i=0; i< nbSides; ++i)
{
float alpha = float(2.0*M_PI/nbSides*i);
VEC3 P = circCenter + cosf(alpha)*V + sinf(alpha)*U;
VEC3 P = circCenter + cos(alpha)*V + sin(alpha)*U;
path.push_back(P);
}
// do the extrusion with good parameters
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* 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 *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* 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.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef _CGOGN_TRIANGULATION_H_
#define _CGOGN_TRIANGULATION_H_
#include <math.h>
#include <vector>
#include <list>
#include <set>
#include <utility>
namespace CGoGN
{
namespace Algo
{
namespace Modelisation
{
template <typename PFP>
class EarTriangulation
{
protected:
// forward declaration
class VertexPoly;
// multiset typedef for simple writing
typedef std::multiset< VertexPoly,VertexPoly> VPMS;
typedef typename VPMS::iterator VMPSITER;
typedef NoMathIONameAttribute<VMPSITER> EarAttr ;
class VertexPoly
{
public:
Dart dart;
float angle;
float length;
VertexPoly() {}
VertexPoly(Dart d, float v, float l): dart(d),angle(v),length(l) {}
bool operator()(const VertexPoly& vp1, const VertexPoly& vp2)
{
if (fabs(vp1.angle - vp2.angle)<0.2f)
return vp1.length < vp2.length;
return vp1.angle < vp2.angle;
}
};
protected:
typename PFP::MAP& m_map;
AutoAttributeHandler<EarAttr> m_dartEars;
AttributeHandler<typename PFP::VEC3> m_position;
VPMS m_ears;
bool inTriangle(const typename PFP::VEC3& P, const typename PFP::VEC3& normal, const typename PFP::VEC3& Ta, const typename PFP::VEC3& Tb, const typename PFP::VEC3& Tc);
void recompute2Ears( Dart d, const typename PFP::VEC3& normalPoly, bool convex);
float computeEarInit(Dart d, const typename PFP::VEC3& normalPoly, float& val);
public:
EarTriangulation(typename PFP::MAP& map):
m_map(map), m_dartEars(map,VERTEX)
{
m_position = map.template getAttribute<typename PFP::VEC3>(VERTEX,"position");
}
void trianguleFace( Dart d, DartMarker& mark);
void triangule(const FunctorSelect& good = SelectorTrue(), unsigned int thread=0);
};
}
}
}
#include "Algo/Modelisation/triangulation.hpp"
#endif /* _CGOGN_TRIANGULATION_H_ */
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* 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 *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* 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.u-strasbg.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace CGoGN
{
namespace Algo
{
namespace Modelisation
{
template<typename PFP>
bool EarTriangulation<PFP>::inTriangle(const typename PFP::VEC3& P, const typename PFP::VEC3& normal, const typename PFP::VEC3& Ta, const typename PFP::VEC3& Tb, const typename PFP::VEC3& Tc)
{
typedef typename PFP::VEC3 VECT ;
typedef typename VECT::DATA_TYPE T ;
if (Geom::tripleProduct(P-Ta, (Tb-Ta), normal) >= T(0))
return false;
if (Geom::tripleProduct(P-Tb, (Tc-Tb), normal) >= T(0))
return false;
if (Geom::tripleProduct(P-Tc, (Ta-Tc), normal) >= T(0))
return false;
return true;
}
template<typename PFP>
void EarTriangulation<PFP>::recompute2Ears( Dart d, const typename PFP::VEC3& normalPoly, bool convex)
{
Dart d2 = m_map.phi_1(d);
Dart d_p = m_map.phi_1(d2);
Dart d_n = m_map.phi1(d);
const typename PFP::VEC3& Ta = m_position[d2];
const typename PFP::VEC3& Tb = m_position[d];
const typename PFP::VEC3& Tc = m_position[d_p];
const typename PFP::VEC3& Td = m_position[d_n];
// compute angle
typename PFP::VEC3 v1= Tb - Ta;
typename PFP::VEC3 v2= Tc - Ta;
typename PFP::VEC3 v3= Td - Tb;
v1.normalize();
v2.normalize();
v3.normalize();
// float dotpr1 = 1.0f - (v1*v2);
// float dotpr2 = 1.0f + (v1*v3);
float dotpr1 = acos(v1*v2) / (M_PI/2.0f);
float dotpr2 = acos(-(v1*v3)) / (M_PI/2.0f);
if (!convex) // if convex no need to test if vertex is an ear (yes)
{
typename PFP::VEC3 nv1 = v1^v2;
typename PFP::VEC3 nv2 = v1^v3;
if (nv1*normalPoly < 0.0)
dotpr1 = 10.0f - dotpr1;// not an ears (concave)
if (nv2*normalPoly < 0.0)
dotpr2 = 10.0f - dotpr2;// not an ears (concave)
bool finished = (dotpr1>=5.0f) && (dotpr2>=5.0f);
for (typename VPMS::reverse_iterator it = m_ears.rbegin(); (!finished)&&(it != m_ears.rend())&&(it->angle > 5.0f); ++it)
{
Dart dx = it->dart;
const typename PFP::VEC3& P = m_position[dx];
if ((dotpr1 < 5.0f) && (d != d_p))
if (inTriangle(P, normalPoly,Tb,Tc,Ta))
dotpr1 = 5.0f;// not an ears !
if ((dotpr2 < 5.0f) && (d != d_n) )
if (inTriangle(P, normalPoly,Td,Ta,Tb))
dotpr2 = 5.0f;// not an ears !
finished = ((dotpr1 >= 5.0f)&&(dotpr2 >= 5.0f));
}
}
float length = (Tb-Tc).norm2();
m_dartEars[d2] = m_ears.insert(VertexPoly(d2,dotpr1,length));
length = (Td-Ta).norm2();
m_dartEars[d] = m_ears.insert(VertexPoly(d,dotpr2,length));
}
template<typename PFP>
float EarTriangulation<PFP>::computeEarInit(Dart d, const typename PFP::VEC3& normalPoly, float& val)
{
Dart e = m_map.phi1(d);
Dart f = m_map.phi1(e);
const typename PFP::VEC3& Ta = m_position[e];
const typename PFP::VEC3& Tb = m_position[f];
const typename PFP::VEC3& Tc = m_position[d];
typename PFP::VEC3 v1 = Tc-Ta;
typename PFP::VEC3 v2 = Tb-Ta;
v1.normalize();
v2.normalize();
// val = 1.0f - (v1*v2);