Commit 55462258 authored by Pierre Kraemer's avatar Pierre Kraemer

traversor with thread

parent 58858e5a
......@@ -24,6 +24,9 @@
#include "Algo/Geometry/basic.h"
#include "Algo/Geometry/area.h"
#include "Topology/generic/traversor2.h"
#include <cmath>
namespace CGoGN
......@@ -53,20 +56,22 @@ typename PFP::VEC3 triangleNormal(typename PFP::MAP& map, Dart d, const typename
template<typename PFP>
typename PFP::VEC3 newellNormal(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position)
{
Dart e = d;
typename PFP::VEC3 normal(0);
Dart it = d;
typename PFP::VEC3 N(0);
Traversor2FV<typename PFP::MAP> t(map, d) ;
do
{
const typename PFP::VEC3& P = position[e];
e = map.phi1(e);
const typename PFP::VEC3& Q = position[e];
normal[0] += (P[1] - Q[1]) * (P[2] + Q[2]);
normal[1] += (P[2] - Q[2]) * (P[0] + Q[0]);
normal[2] += (P[0] - Q[0]) * (P[1] + Q[1]);
} while (e != d);
normal.normalize();
return normal;
const typename PFP::VEC3& P = position[it];
it = map.phi1(it);
const typename PFP::VEC3& Q = position[it];
N[0] += (P[1] - Q[1]) * (P[2] + Q[2]);
N[1] += (P[2] - Q[2]) * (P[0] + Q[0]);
N[2] += (P[0] - Q[0]) * (P[1] + Q[1]);
} while (it != d);
N.normalize();
return N;
}
template <typename PFP>
......
......@@ -297,7 +297,6 @@ inline void MapRender::addTri(typename PFP::MAP& map, Dart d, std::vector<GLuint
if (map.phi1(c) != a)
{
std::cout << "non triangle face" << std::endl ;
addEarTri<PFP>(map, d, tableIndices);
return;
}
......
......@@ -40,7 +40,7 @@ private:
Dart current ;
public:
TraversorCell(MAP& map) : m(map), mark(map)
TraversorCell(MAP& map, unsigned int thread = 0) : m(map), mark(map, thread)
{}
Dart begin()
......@@ -77,28 +77,28 @@ template <typename MAP>
class TraversorV : public TraversorCell<MAP, VERTEX>
{
public:
TraversorV(MAP& m) : TraversorCell<MAP, VERTEX>(m) {}
TraversorV(MAP& m, unsigned int thread = 0) : TraversorCell<MAP, VERTEX>(m, thread) {}
};
template <typename MAP>
class TraversorE : public TraversorCell<MAP, EDGE>
{
public:
TraversorE(MAP& m) : TraversorCell<MAP, EDGE>(m) {}
TraversorE(MAP& m, unsigned int thread = 0) : TraversorCell<MAP, EDGE>(m, thread) {}
};
template <typename MAP>
class TraversorF : public TraversorCell<MAP, FACE>
{
public:
TraversorF(MAP& m) : TraversorCell<MAP, FACE>(m) {}
TraversorF(MAP& m, unsigned int thread = 0) : TraversorCell<MAP, FACE>(m, thread) {}
};
template <typename MAP>
class TraversorW : public TraversorCell<MAP, VOLUME>
{
public:
TraversorW(MAP& m) : TraversorCell<MAP, VOLUME>(m) {}
TraversorW(MAP& m, unsigned int thread = 0) : TraversorCell<MAP, VOLUME>(m, thread) {}
};
} // namespace CGoGN
......
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