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

correction particle2d et particle2dmemo

parent 4b06724c
......@@ -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;
}
}
......
......@@ -96,6 +96,19 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& goal)
}
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->ParticleBase < PFP > ::move(goal) ;
return ;
......
......@@ -40,34 +40,41 @@ void ParticleCell2DMemo<PFP>::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<PFP>(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<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->setState(VERTEX) ;
return ;
......@@ -80,19 +87,17 @@ void ParticleCell2DMemo<PFP>::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<PFP>(this->m, this->d, this->positionAttribut, current))
edgeState(current) ;
else
{
......@@ -108,7 +113,9 @@ void ParticleCell2DMemo<PFP>::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<PFP>(m,d,m_positions,m_position));
......
......@@ -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 = 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]);
......
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