Commit 62c1194a authored by Jund Thomas's avatar Jund Thomas
Browse files

correction particle2d et particle2dmemo

parent 4b06724c
...@@ -55,10 +55,10 @@ void exportMeshPlain(std::ofstream& out, typename PFP::MAP& map, VertexAttribute ...@@ -55,10 +55,10 @@ void exportMeshPlain(std::ofstream& out, typename PFP::MAP& map, VertexAttribute
Dart dd = d; Dart dd = d;
do 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); dd = map.phi1(dd);
} while(dd!=d); } 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; out << "}" << std::endl;
} }
} }
......
...@@ -96,6 +96,19 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& goal) ...@@ -96,6 +96,19 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& goal)
} }
else else
{ {
//checking : case with 3 orthogonal darts and point on an edge
do
{
if(Algo::Geometry::isPointOnHalfEdge<PFP>(m,d,positionAttribut,goal)
&& Algo::Geometry::isPointOnHalfEdge<PFP>(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->setState(VERTEX) ;
this->ParticleBase < PFP > ::move(goal) ; this->ParticleBase < PFP > ::move(goal) ;
return ; return ;
......
...@@ -40,34 +40,41 @@ void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current) ...@@ -40,34 +40,41 @@ void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current)
else else
{ {
//orientation step //orientation step
if (this->positionAttribut[this->d][0] == this->positionAttribut[this->m.phi1(this->d)][0] 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->positionAttribut[this->d][1] this->d = this->m.phi2_1(this->d) ;
== 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) if (this->getOrientationEdge(current, this->m.phi2_1(this->d)) != Geom::RIGHT)
{ {
Dart dd_vert = this->d ; Dart dd_vert = this->d ;
do do
{ {
this->d = this->m.phi2_1(this->d) ; this->d = this->m.phi2_1(this->d) ;
if (this->positionAttribut[this->d][0] if (this->positionAttribut[this->d][0] == this->positionAttribut[this->m.phi1(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->positionAttribut[this->d][1] this->d = this->m.phi2_1(this->d) ;
== 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) ;
} while (this->getOrientationEdge(current, this->m.phi2_1(this->d)) != Geom::RIGHT
&& dd_vert != this->d) ;
if (dd_vert == this->d) if (dd_vert == this->d)
{ {
//orbit with 2 edges : point on one edge //orbit with 2 edges : point on one edge
if (this->m.phi2_1(this->m.phi2_1(this->d)) == this->d) if (this->m.phi2_1(this->m.phi2_1(this->d)) == this->d)
{ {
if (!Algo::Geometry::isPointOnHalfEdge < PFP if (!Algo::Geometry::isPointOnHalfEdge<PFP>(this->m, this->d, this->positionAttribut, current))
> (this->m, this->d, this->positionAttribut, current)) this->d = this->m.phi2_1( this->d = this->m.phi2_1(this->d) ;
this->d) ;
} }
else else
{ {
//checking : case with 3 orthogonal darts and point on an edge
do
{
if(Algo::Geometry::isPointOnHalfEdge<PFP>(this->m,this->d,this->positionAttribut,current)
&& Algo::Geometry::isPointOnHalfEdge<PFP>(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<PFP>::move(current) ; this->ParticleBase<PFP>::move(current) ;
this->setState(VERTEX) ; this->setState(VERTEX) ;
return ; return ;
...@@ -80,19 +87,17 @@ void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current) ...@@ -80,19 +87,17 @@ void ParticleCell2DMemo<PFP>::vertexState(const VEC3& current)
while (this->getOrientationEdge(current, this->d) == Geom::RIGHT && dd_vert != this->d) while (this->getOrientationEdge(current, this->d) == Geom::RIGHT && dd_vert != this->d)
{ {
this->d = this->m.phi12(this->d) ; this->d = this->m.phi12(this->d) ;
if (this->positionAttribut[this->d][0] if (this->positionAttribut[this->d][0] == this->positionAttribut[this->m.phi1(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->positionAttribut[this->d][1] this->d = this->m.phi12(this->d) ;
== this->positionAttribut[this->m.phi1(this->d)][1]) this->d = this->m.phi12(
this->d) ;
} }
} }
//displacement step //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 if (this->getOrientationEdge(current, this->d) == Geom::ALIGNED
&& Algo::Geometry::isPointOnHalfEdge < PFP && Algo::Geometry::isPointOnHalfEdge<PFP>(this->m, this->d, this->positionAttribut, current))
> (this->m, this->d, this->positionAttribut, current))
edgeState(current) ; edgeState(current) ;
else else
{ {
...@@ -108,7 +113,9 @@ void ParticleCell2DMemo<PFP>::edgeState(const VEC3& current, Geom::Orientation2D ...@@ -108,7 +113,9 @@ void ParticleCell2DMemo<PFP>::edgeState(const VEC3& current, Geom::Orientation2D
#ifdef DEBUG #ifdef DEBUG
CGoGNout << "edgeState" << d << CGoGNendl ; CGoGNout << "edgeState" << d << CGoGNendl ;
#endif #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(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2])) ;
// assert(Algo::Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position)); // assert(Algo::Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position));
......
...@@ -38,6 +38,7 @@ Orientation2D testOrientation2D(const VEC3& P, const VEC3& Pa, const VEC3& Pb) ...@@ -38,6 +38,7 @@ Orientation2D testOrientation2D(const VEC3& P, const VEC3& Pa, const VEC3& Pb)
// const T min = std::numeric_limits<T>::min()*T(100); // const T min = std::numeric_limits<T>::min()*T(100);
const T min = 0.0001; 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 = (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]); T wsof = (P[0]-Pa[0])*(Pb[1]-Pa[1])-(Pb[0]-Pa[0])*(P[1]-Pa[1]);
......
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