diff --git a/include/Algo/Export/exportPov.h b/include/Algo/Export/exportPov.h index d101ad504c9bdd305034e2e6600f2eb58fdcb759..4407816566bef3efe2b4d42169ddd314e4d437c3 100644 --- a/include/Algo/Export/exportPov.h +++ b/include/Algo/Export/exportPov.h @@ -55,10 +55,10 @@ void exportMeshPlain(std::ofstream& out, typename PFP::MAP& map, VertexAttribute Dart dd = d; do { - out << "<" << position[dd][0] << "," << position[dd][1] << "," << position[dd][2] << ">," << std::endl; + out << "<" << position[dd][0] << "," << position[dd][2] << "," << position[dd][1] << ">," << std::endl; dd = map.phi1(dd); } while(dd!=d); - out << "<" << position[d][0] << "," << position[d][1] << "," << position[d][2] << ">" << std::endl; + out << "<" << position[d][0] << "," << position[d][2] << "," << position[d][1] << ">" << std::endl; out << "}" << std::endl; } } diff --git a/include/Algo/MovingObjects/particle_cell_2D.hpp b/include/Algo/MovingObjects/particle_cell_2D.hpp index 7378722757bf0b01837e9b3c5bf9d6298b20ea59..f826326a8a903ec53dffd28c31a531476feaad85 100644 --- a/include/Algo/MovingObjects/particle_cell_2D.hpp +++ b/include/Algo/MovingObjects/particle_cell_2D.hpp @@ -96,6 +96,19 @@ void ParticleCell2D::vertexState(const VEC3& goal) } else { + //checking : case with 3 orthogonal darts and point on an edge + do + { + if(Algo::Geometry::isPointOnHalfEdge(m,d,positionAttribut,goal) + && Algo::Geometry::isPointOnHalfEdge(m,this->m.phi2(d),positionAttribut,goal)) + { + edgeState(goal) ; + return; + } + 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->ParticleBase < PFP > ::move(goal) ; return ; diff --git a/include/Algo/MovingObjects/particle_cell_2D_memo.hpp b/include/Algo/MovingObjects/particle_cell_2D_memo.hpp index 70363e67ad7ab7c1f755a019065ad5e1fa83c440..5caa6c97bf580ccad2217a9e1e5a14042b912274 100644 --- a/include/Algo/MovingObjects/particle_cell_2D_memo.hpp +++ b/include/Algo/MovingObjects/particle_cell_2D_memo.hpp @@ -40,34 +40,41 @@ void ParticleCell2DMemo::vertexState(const VEC3& current) else { //orientation step - if (this->positionAttribut[this->d][0] == this->positionAttribut[this->m.phi1(this->d)][0] - && this->positionAttribut[this->d][1] - == this->positionAttribut[this->m.phi1(this->d)][1]) this->d = this->m.phi2_1( - this->d) ; + if (this->positionAttribut[this->d][0] == this->positionAttribut[this->m.phi1(this->d)][0] && this->positionAttribut[this->d][1] == this->positionAttribut[this->m.phi1(this->d)][1]) + this->d = this->m.phi2_1(this->d) ; if (this->getOrientationEdge(current, this->m.phi2_1(this->d)) != Geom::RIGHT) { Dart dd_vert = this->d ; do { this->d = this->m.phi2_1(this->d) ; - if (this->positionAttribut[this->d][0] - == this->positionAttribut[this->m.phi1(this->d)][0] - && this->positionAttribut[this->d][1] - == this->positionAttribut[this->m.phi1(this->d)][1]) this->d = this->m.phi2_1(this->d) ; - } while (this->getOrientationEdge(current, this->m.phi2_1(this->d)) != Geom::RIGHT - && dd_vert != this->d) ; + if (this->positionAttribut[this->d][0] == this->positionAttribut[this->m.phi1(this->d)][0] + && this->positionAttribut[this->d][1]== this->positionAttribut[this->m.phi1(this->d)][1]) + this->d = this->m.phi2_1(this->d) ; + } while (this->getOrientationEdge(current, this->m.phi2_1(this->d)) != Geom::RIGHT && dd_vert != this->d) ; if (dd_vert == this->d) { //orbit with 2 edges : point on one edge if (this->m.phi2_1(this->m.phi2_1(this->d)) == this->d) { - if (!Algo::Geometry::isPointOnHalfEdge < PFP - > (this->m, this->d, this->positionAttribut, current)) this->d = this->m.phi2_1( - this->d) ; + if (!Algo::Geometry::isPointOnHalfEdge(this->m, this->d, this->positionAttribut, current)) + this->d = this->m.phi2_1(this->d) ; } else { + //checking : case with 3 orthogonal darts and point on an edge + do + { + if(Algo::Geometry::isPointOnHalfEdge(this->m,this->d,this->positionAttribut,current) + && Algo::Geometry::isPointOnHalfEdge(this->m,this->m.phi2(this->d),this->positionAttribut,current)) + { + this->edgeState(current) ; + return; + } + this->d = this->m.phi2_1(this->d) ; + } while (this->getOrientationEdge(current, this->m.phi2_1(this->d)) != Geom::RIGHT && dd_vert != this->d) ; + this->ParticleBase::move(current) ; this->setState(VERTEX) ; return ; @@ -80,19 +87,17 @@ void ParticleCell2DMemo::vertexState(const VEC3& current) while (this->getOrientationEdge(current, this->d) == Geom::RIGHT && dd_vert != this->d) { this->d = this->m.phi12(this->d) ; - if (this->positionAttribut[this->d][0] - == this->positionAttribut[this->m.phi1(this->d)][0] - && this->positionAttribut[this->d][1] - == this->positionAttribut[this->m.phi1(this->d)][1]) this->d = this->m.phi12( - this->d) ; + if (this->positionAttribut[this->d][0] == this->positionAttribut[this->m.phi1(this->d)][0] + && this->positionAttribut[this->d][1] == this->positionAttribut[this->m.phi1(this->d)][1]) + this->d = this->m.phi12(this->d) ; } } //displacement step - if (detect_vertex) memo_cross.push_back(this->d) ; + if (detect_vertex) + memo_cross.push_back(this->d) ; if (this->getOrientationEdge(current, this->d) == Geom::ALIGNED - && Algo::Geometry::isPointOnHalfEdge < PFP - > (this->m, this->d, this->positionAttribut, current)) + && Algo::Geometry::isPointOnHalfEdge(this->m, this->d, this->positionAttribut, current)) edgeState(current) ; else { @@ -108,7 +113,9 @@ void ParticleCell2DMemo::edgeState(const VEC3& current, Geom::Orientation2D #ifdef DEBUG CGoGNout << "edgeState" << d << CGoGNendl ; #endif - if (detect_edge) memo_cross.push_back(this->d) ; + if (detect_edge) + memo_cross.push_back(this->d) ; + assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2])) ; // assert(Algo::Geometry::isPointOnEdge(m,d,m_positions,m_position)); diff --git a/include/Geometry/orientation.hpp b/include/Geometry/orientation.hpp index c790d2c8e9081c08438521736e6dafbad4b68e41..9b7a4c18961dbf3dcaeaecde18cbcbf4d15b9d31 100644 --- a/include/Geometry/orientation.hpp +++ b/include/Geometry/orientation.hpp @@ -38,6 +38,7 @@ Orientation2D testOrientation2D(const VEC3& P, const VEC3& Pa, const VEC3& Pb) // const T min = std::numeric_limits::min()*T(100); const T min = 0.0001; + // T wsof = (Pa[0]-P[0])*(P[1]-Pb[1])-(P[0]-Pb[0])*(Pa[1]-P[1]); T wsof = (P[0]-Pa[0])*(Pb[1]-Pa[1])-(Pb[0]-Pa[0])*(P[1]-Pa[1]);