Commit 6a284f4c authored by Sylvain Thery's avatar Sylvain Thery

Merge cgogn:~pitiot/CGoGN

parents f6508c37 f656d2cc
...@@ -193,6 +193,12 @@ public: ...@@ -193,6 +193,12 @@ public:
*/ */
Dart faceOldestDart(Dart d) ; 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 * Return true if the edge of d in the current level map
* has already been subdivided to the next level * has already been subdivided to the next level
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* Contact information: cgogn@unistra.fr * * Contact information: cgogn@unistra.fr *
* * * *
*******************************************************************************/ *******************************************************************************/
//#define DEBUG
namespace CGoGN namespace CGoGN
{ {
...@@ -137,7 +138,8 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& goal) ...@@ -137,7 +138,8 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& goal)
{ {
if(Geometry::isPointOnHalfEdge<PFP>(m,d,positionAttribut,goal) if(Geometry::isPointOnHalfEdge<PFP>(m,d,positionAttribut,goal)
&& Geometry::isPointOnHalfEdge<PFP>(m,this->m.phi2(d),positionAttribut,goal) && Geometry::isPointOnHalfEdge<PFP>(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) ; edgeState(goal) ;
return; return;
...@@ -145,7 +147,6 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& goal) ...@@ -145,7 +147,6 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& goal)
this->d = this->m.phi2_1(this->d) ; this->d = this->m.phi2_1(this->d) ;
} while (this->getOrientationEdge(goal, this->m.phi2_1(this->d)) != Geom::RIGHT && dd_vert != this->d) ; } while (this->getOrientationEdge(goal, this->m.phi2_1(this->d)) != Geom::RIGHT && dd_vert != this->d) ;
this->setState(VERTEX) ; this->setState(VERTEX) ;
this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ; this->Algo::MovingObjects::ParticleBase < PFP > ::move(goal) ;
return ; return ;
...@@ -180,6 +181,17 @@ void ParticleCell2D<PFP>::edgeState(const VEC3& goal, Geom::Orientation2D sideOf ...@@ -180,6 +181,17 @@ void ParticleCell2D<PFP>::edgeState(const VEC3& goal, Geom::Orientation2D sideOf
{ {
#ifdef DEBUG #ifdef DEBUG
CGoGNout << "edgeState" << d << CGoGNendl ; 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 :"<<p<<CGoGNendl;
float p2 = (P[0] - Pb[0]) * (Pa[1] - Pb[1]) - (Pa[0] - Pb[0]) * (P[1] - Pb[1]) ;
CGoGNout<<"p2 :"<<p2<<CGoGNendl;
#endif #endif
assert(goal.isFinite()) ; assert(goal.isFinite()) ;
...@@ -445,3 +457,4 @@ void ParticleCell2D<PFP>::faceState(const VEC3& goal) ...@@ -445,3 +457,4 @@ void ParticleCell2D<PFP>::faceState(const VEC3& goal)
} }
} //namespaces } //namespaces
} }
//#undef DEBUG
...@@ -42,6 +42,7 @@ std::vector<Dart> ParticleCell2DMemo<PFP>::move(const VEC3& goal) ...@@ -42,6 +42,7 @@ std::vector<Dart> ParticleCell2DMemo<PFP>::move(const VEC3& goal)
{ {
CellMarkerMemo<FACE> memo_cross(this->m); CellMarkerMemo<FACE> memo_cross(this->m);
switch (this->getState()) switch (this->getState())
{ {
case VERTEX : case VERTEX :
...@@ -139,8 +140,8 @@ void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current, CellMarkerMemo<FA ...@@ -139,8 +140,8 @@ void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current, CellMarkerMemo<FA
do do
{ {
if(Geometry::isPointOnHalfEdge<PFP>(this->m,this->d,this->positionAttribut,current) if(Geometry::isPointOnHalfEdge<PFP>(this->m,this->d,this->positionAttribut,current)
&& Geometry::isPointOnHalfEdge<PFP>(this->m,this->m.phi2(this->d),this->positionAttribut,current) && Geometry::isPointOnHalfEdge<PFP>(this->m,this->m.phi2(this->d),this->positionAttribut,current))
&& this->getOrientationEdge(current, this->d) == Geom::ALIGNED) // && this->getOrientationEdge(current, this->d) == Geom::ALIGNED)
{ {
this->edgeState(current,memo_cross) ; this->edgeState(current,memo_cross) ;
......
...@@ -166,7 +166,7 @@ bool arePointsEquals(const VEC& point1, const VEC& point2) ...@@ -166,7 +166,7 @@ bool arePointsEquals(const VEC& point1, const VEC& point2)
{ {
VEC v(point1 - point2); VEC v(point1 - point2);
#define PRECISION 1e-10 #define PRECISION 1e-5
return v.norm2() <= PRECISION ; return v.norm2() <= PRECISION ;
#undef PRECISION #undef PRECISION
} }
......
...@@ -35,7 +35,7 @@ Orientation2D testOrientation2D(const VEC3& P, const VEC3& Pa, const VEC3& Pb) ...@@ -35,7 +35,7 @@ Orientation2D testOrientation2D(const VEC3& P, const VEC3& Pa, const VEC3& Pb)
{ {
typedef typename VEC3::DATA_TYPE T ; 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]) ; T p = (P[0] - Pa[0]) * (Pb[1] - Pa[1]) - (Pb[0] - Pa[0]) * (P[1] - Pa[1]) ;
......
...@@ -227,6 +227,18 @@ Dart ImplicitHierarchicalMap::faceOldestDart(Dart d) ...@@ -227,6 +227,18 @@ Dart ImplicitHierarchicalMap::faceOldestDart(Dart d)
return oldest ; 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) bool ImplicitHierarchicalMap::edgeIsSubdivided(Dart d)
{ {
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
......
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