diff --git a/include/Algo/ImplicitHierarchicalMesh/ihm.h b/include/Algo/ImplicitHierarchicalMesh/ihm.h index 7d7974bdcdd834f319778a5f98d5d09ae8ad30dc..a00e077e6f792b85177190103df5305590c9ad65 100644 --- a/include/Algo/ImplicitHierarchicalMesh/ihm.h +++ b/include/Algo/ImplicitHierarchicalMesh/ihm.h @@ -193,6 +193,12 @@ public: */ Dart faceOldestDart(Dart d) ; + //! Test if dart d and e belong to the same face + /*! @param d a dart + * @param e a dart + */ + bool sameFace(Dart d, Dart e) ; + /** * Return true if the edge of d in the current level map * has already been subdivided to the next level diff --git a/include/Algo/MovingObjects/particle_cell_2D.hpp b/include/Algo/MovingObjects/particle_cell_2D.hpp index 0563077098077ba3738eb2802a33f9ef8e32dd35..62b45b42b8edef75186a57c4fa9daaf365c850ed 100644 --- a/include/Algo/MovingObjects/particle_cell_2D.hpp +++ b/include/Algo/MovingObjects/particle_cell_2D.hpp @@ -21,6 +21,7 @@ * Contact information: cgogn@unistra.fr * * * *******************************************************************************/ +//#define DEBUG namespace CGoGN { @@ -137,7 +138,8 @@ void ParticleCell2D::vertexState(const VEC3& goal) { if(Geometry::isPointOnHalfEdge(m,d,positionAttribut,goal) && Geometry::isPointOnHalfEdge(m,this->m.phi2(d),positionAttribut,goal) - && this->getOrientationEdge(goal, this->d) == Geom::ALIGNED) + ) +// && this->getOrientationEdge(goal, this->d) == Geom::ALIGNED) //TODO to check / alignment orientation test pb ? { edgeState(goal) ; return; @@ -145,7 +147,6 @@ void ParticleCell2D::vertexState(const VEC3& goal) this->d = this->m.phi2_1(this->d) ; } while (this->getOrientationEdge(goal, this->m.phi2_1(this->d)) != Geom::RIGHT && dd_vert != this->d) ; - this->setState(VERTEX) ; this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ; return ; @@ -180,6 +181,17 @@ void ParticleCell2D::edgeState(const VEC3& goal, Geom::Orientation2D sideOf { #ifdef DEBUG CGoGNout << "edgeState" << d << CGoGNendl ; + + VEC3 P(goal); + VEC3 Pa(positionAttribut[d]); + VEC3 Pb(positionAttribut[m.phi2(d)]); + float p = (P[0] - Pa[0]) * (Pb[1] - Pa[1]) - (Pb[0] - Pa[0]) * (P[1] - Pa[1]) ; + CGoGNout<<"p :"<::faceState(const VEC3& goal) } } //namespaces } +//#undef DEBUG diff --git a/include/Algo/MovingObjects/particle_cell_2D_memo.hpp b/include/Algo/MovingObjects/particle_cell_2D_memo.hpp index 28664d364577cc3d58843d6480b765344f496a0c..49c58a187c12c304ee5b526aec4358e0a640ec2a 100644 --- a/include/Algo/MovingObjects/particle_cell_2D_memo.hpp +++ b/include/Algo/MovingObjects/particle_cell_2D_memo.hpp @@ -42,6 +42,7 @@ std::vector ParticleCell2DMemo::move(const VEC3& goal) { CellMarkerMemo memo_cross(this->m); + switch (this->getState()) { case VERTEX : @@ -139,8 +140,8 @@ void ParticleCell2DMemo::vertexState(const VEC3& current, CellMarkerMemo(this->m,this->d,this->positionAttribut,current) - && Geometry::isPointOnHalfEdge(this->m,this->m.phi2(this->d),this->positionAttribut,current) - && this->getOrientationEdge(current, this->d) == Geom::ALIGNED) + && Geometry::isPointOnHalfEdge(this->m,this->m.phi2(this->d),this->positionAttribut,current)) +// && this->getOrientationEdge(current, this->d) == Geom::ALIGNED) { this->edgeState(current,memo_cross) ; diff --git a/include/Geometry/inclusion.hpp b/include/Geometry/inclusion.hpp index 33cc898243977469e54e34796079ec5f44a86bb3..9282437041e3b85599869dec5bf4dab977827c34 100644 --- a/include/Geometry/inclusion.hpp +++ b/include/Geometry/inclusion.hpp @@ -166,7 +166,7 @@ bool arePointsEquals(const VEC& point1, const VEC& point2) { VEC v(point1 - point2); -#define PRECISION 1e-10 +#define PRECISION 1e-5 return v.norm2() <= PRECISION ; #undef PRECISION } diff --git a/include/Geometry/orientation.hpp b/include/Geometry/orientation.hpp index 0ae073141c1bb6dcc4312073f1e15cbebace62b8..ea45d04c6662b2e18f3cd8229fa5527b42364265 100644 --- a/include/Geometry/orientation.hpp +++ b/include/Geometry/orientation.hpp @@ -35,7 +35,7 @@ Orientation2D testOrientation2D(const VEC3& P, const VEC3& Pa, const VEC3& Pb) { typedef typename VEC3::DATA_TYPE T ; - const T zero = 0.00001 ; + const T zero = 0.000001 ; T p = (P[0] - Pa[0]) * (Pb[1] - Pa[1]) - (Pb[0] - Pa[0]) * (P[1] - Pa[1]) ; diff --git a/src/Algo/ImplicitHierarchicalMesh/ihm.cpp b/src/Algo/ImplicitHierarchicalMesh/ihm.cpp index b67f157a624b580f8973a5cb09bcfd20c5658414..d8ac802d7495cfa5e9e3c3429083f00d0534f3f9 100644 --- a/src/Algo/ImplicitHierarchicalMesh/ihm.cpp +++ b/src/Algo/ImplicitHierarchicalMesh/ihm.cpp @@ -227,6 +227,18 @@ Dart ImplicitHierarchicalMap::faceOldestDart(Dart d) return oldest ; } +bool ImplicitHierarchicalMap::sameFace(Dart d, Dart e) +{ + Dart it = d ; + do + { + if(it == e) + return true ; + it = phi1(it) ; + } while(it != d) ; + return false ; +} + bool ImplicitHierarchicalMap::edgeIsSubdivided(Dart d) { assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;