Commit d944530c authored by Pierre Kraemer's avatar Pierre Kraemer

lambdas in normal computation

parent d2dd217b
......@@ -23,6 +23,7 @@
*******************************************************************************/
#include "viewer.h"
#include "Utils/chrono.h"
Viewer::Viewer() :
m_renderStyle(FLAT),
......@@ -240,7 +241,10 @@ void Viewer::importMesh(std::string& filename)
if(!normal.isValid())
normal = myMap.addAttribute<VEC3, VERTEX>("normal") ;
Utils::Chrono c;
c.start();
Algo::Surface::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ;
std::cout << "compute normals -> " << c.elapsed() << std::endl;
m_positionVBO->updateData(position) ;
m_normalVBO->updateData(normal) ;
......@@ -249,8 +253,6 @@ void Viewer::importMesh(std::string& filename)
updateGLMatrices() ;
std::cout << "#vertices -> " << Algo::Topo::getNbOrbits<VERTEX>(myMap) << std::endl;
Vertex v(myMap.begin());
unsigned int e = myMap.getEmbedding(v);
}
void Viewer::exportMesh(std::string& filename, bool askExportMode)
......
......@@ -41,19 +41,19 @@ namespace Geometry
{
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE triangleNormal(typename PFP::MAP& map, Dart d, const V_ATT& position) ;
typename V_ATT::DATA_TYPE triangleNormal(typename PFP::MAP& map, Face f, const V_ATT& position) ;
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE newellNormal(typename PFP::MAP& map, Dart d, const V_ATT& position);
typename V_ATT::DATA_TYPE newellNormal(typename PFP::MAP& map, Face f, const V_ATT& position);
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE faceNormal(typename PFP::MAP& map, Dart d, const V_ATT& position) ;
typename V_ATT::DATA_TYPE faceNormal(typename PFP::MAP& map, Face f, const V_ATT& position) ;
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexNormal(typename PFP::MAP& map, Dart d, const V_ATT& position) ;
typename V_ATT::DATA_TYPE vertexNormal(typename PFP::MAP& map, Vertex v, const V_ATT& position) ;
template<typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexBorderNormal(typename PFP::MAP& map, Dart d, const V_ATT& position) ;
typename V_ATT::DATA_TYPE vertexBorderNormal(typename PFP::MAP& map, Vertex v, const V_ATT& position) ;
template <typename PFP, typename V_ATT, typename F_ATT>
void computeNormalFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_normal, unsigned int thread = 0) ;
......@@ -79,6 +79,9 @@ void computeNormalVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT&
template <typename PFP, typename V_ATT, typename F_ATT>
void computeNormalFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_normal, unsigned int nbth = 0) ;
template <typename PFP, typename V_ATT, typename E_ATT>
void computeAnglesBetweenNormalsOnEdges(typename PFP::MAP& map, const V_ATT& position, E_ATT& angles, unsigned int nbth = 0) ;
}
......
This diff is collapsed.
......@@ -175,7 +175,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const V_ATT& posi
{
// compute normals
VEC3 centerFace = Algo::Surface::Geometry::faceCentroidELW<PFP>(map, d.dart, positions);
VEC3 centerNormalFace = Algo::Surface::Geometry::newellNormal<PFP>(map,d,positions);
VEC3 centerNormalFace = Algo::Surface::Geometry::newellNormal<PFP>(map, d.dart, positions);
computeFace<PFP>(map,d,positions,centerFace,centerNormalFace,vertices,normals);
......
......@@ -451,7 +451,7 @@ public:
/**
* Functor class for parallel::foreach_orbit/cell/dart
* Overload run
* Overload run
* Overload duplicate if necessary (no sharing of functors)
*/
template<typename MAP>
......@@ -468,7 +468,7 @@ public:
/**
* @return a pointer on a copy of the object.
*/
virtual FunctorMapThreaded<MAP>* duplicate() const { return NULL;}
virtual FunctorMapThreaded<MAP>* duplicate() const { return NULL; }
/**
* insert your code here:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment