Commit 911bd5a6 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

Merge cgogn:~jund/CGoGN

parents 244f3699 4d1c5303
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "Topology/generic/traversorCell.h" #include "Topology/generic/traversorCell.h"
#include "Algo/Geometry/centroid.h" #include "Algo/Geometry/centroid.h"
#include "Algo/Modelisation/tetrahedralization.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -61,7 +62,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const ...@@ -61,7 +62,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
{ {
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
if(map.isVolumeTetrahedron(d)) if(Modelisation::Tetrahedralization::isTetrahedron<PFP>(map,d))
return tetrahedronVolume<PFP>(map,d,position) ; return tetrahedronVolume<PFP>(map,d,position) ;
else else
{ {
......
...@@ -57,8 +57,7 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d) ...@@ -57,8 +57,7 @@ void hexahedronToTetrahedron(typename PFP::MAP& map, Dart d)
template <typename PFP> template <typename PFP>
bool isTetrahedron(typename PFP::MAP& the_map, Dart d) bool isTetrahedron(typename PFP::MAP& the_map, Dart d)
{ {
DartMarkerStore mark(*the_map); // Lock a marker DartMarkerStore mark(the_map); // Lock a marker
bool isTetrahedron = true; // Last return value
std::list<Dart> visitedFaces; // Faces that are traversed std::list<Dart> visitedFaces; // Faces that are traversed
visitedFaces.push_back(d); visitedFaces.push_back(d);
...@@ -67,50 +66,38 @@ bool isTetrahedron(typename PFP::MAP& the_map, Dart d) ...@@ -67,50 +66,38 @@ bool isTetrahedron(typename PFP::MAP& the_map, Dart d)
int nbFaces = 0; // Count the faces int nbFaces = 0; // Count the faces
//Test the number of faces end its valency //Test the number of faces end its valency
for(faces = visitedFaces.begin() ; isTetrahedron && faces != visitedFaces.end() ; ++faces) for(faces = visitedFaces.begin() ; faces != visitedFaces.end() ; ++faces)
{ {
Dart dc = *faces; Dart dc = *faces;
//if this dart is not marked //if this dart is not marked
if(!mark.isMarked(dc)) if(!mark.isMarked(dc))
{ {
//increase the number of faces
nbFaces++;
if(nbFaces > 4) //too much faces
return false;
//test the valency of this face //test the valency of this face
if(dc != the_map.phi1(the_map.phi1(the_map.phi1(dc)))) if(dc != the_map.phi1(the_map.phi1(the_map.phi1(dc))))
isTetrahedron = false; return false;
else
//mark the face and push adjacent faces
Dart d1 = dc;
for(unsigned int i = 0; i <3 ; ++i)
{ {
//mark them mark.mark(d1);
mark.markOrbit(DART,dc);
//if phi2 not marked //if phi2 not marked
if(!mark.markOrbit(DART, the_map.phi2(dc))) Dart d2 = the_map.phi2(d1);
visitedFaces.push_back(the_map.phi2(dc)); if(!mark.isMarked(d2))
visitedFaces.push_back(d2);
//increase the number of faces
nbFaces++; d1 = the_map.phi1(dc);
//too much faces
if(nbFaces > 4)
isTetrahedron = false;
// or count the size of the face
else
{
mark.markOrbit(DART, the_map.phi1(dc));
//if phi12 not marked
if(!mark.markOrbit(DART, the_map.phi2(the_map.phi1(dc))))
visitedFaces.push_back(the_map.phi2(the_map.phi1(dc)));
mark.markOrbit(DART, the_map.phi_1(dc));
//if phi_12 not marked
if(!mark.markOrbit(DART, the_map.phi2(the_map.phi_1(dc))))
visitedFaces.push_back(the_map.phi2(the_map.phi_1(dc)));
}
} }
} }
} }
//nettoyage return true;
mark.unmarkAll();
return isTetrahedron;
} }
/************************************************************************************************ /************************************************************************************************
...@@ -272,8 +259,8 @@ void swap4To4(typename PFP::MAP& map, Dart d) ...@@ -272,8 +259,8 @@ void swap4To4(typename PFP::MAP& map, Dart d)
map.unsewVolumes(d); map.unsewVolumes(d);
map.unsewVolumes(map.phi2(map.phi3(dd))); map.unsewVolumes(map.phi2(map.phi3(dd)));
Algo::Modelisation::Tetrahedron::swap2To2<PFP>(map, dd); Algo::Modelisation::Tetrahedralization::swap2To2<PFP>(map, dd);
Algo::Modelisation::Tetrahedron::swap2To2<PFP>(map, e); Algo::Modelisation::Tetrahedralization::swap2To2<PFP>(map, e);
//sew middle darts so that they do not cross //sew middle darts so that they do not cross
map.sewVolumes(d,map.phi2(map.phi3(e))); map.sewVolumes(d,map.phi2(map.phi3(e)));
......
...@@ -39,12 +39,17 @@ class ParticleBase ...@@ -39,12 +39,17 @@ class ParticleBase
/** /**
* @param newPosition new position to reach * @param newPosition new position to reach
*/ */
bool move(VEC3 position) virtual bool move(VEC3 position)
{ {
m_position = position; m_position = position;
return true; return true;
} }
virtual unsigned int getState()
{
return 0;
}
VEC3 getPosition() { return m_position; } VEC3 getPosition() { return m_position; }
}; };
......
...@@ -80,7 +80,7 @@ public : ...@@ -80,7 +80,7 @@ public :
{ {
return state; return state;
} }
void move(const VEC3& newCurrent) void move(const VEC3& newCurrent)
{ {
crossCell = NO_CROSS ; crossCell = NO_CROSS ;
......
...@@ -74,7 +74,7 @@ public : ...@@ -74,7 +74,7 @@ public :
{ {
return state; return state;
} }
void move(const VEC3& newCurrent) void move(const VEC3& newCurrent)
{ {
crossCell = NO_CROSS ; crossCell = NO_CROSS ;
......
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