Commit d34d4c53 authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'master' of cgogn:~jund/CGoGN

parents 9f19494f cc8261af
......@@ -51,6 +51,7 @@ void mergeVertex(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC
ee = map.phi2_1(ee);
} while(ee != e);
map.insertEdgeInVertex(ee,dd);
} while(dd!=d);
}
......
......@@ -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;
}
}
......
......@@ -42,6 +42,12 @@ namespace Import
*/
bool checkXmlNode(xmlNodePtr node, const std::string& name);
template <typename PFP>
void readCoordAndStyle(xmlNode* cur_path,
std::vector<std::vector<VEC3 > >& allPoly,
std::vector<std::vector<VEC3 > >& allBrokenLines,
std::vector<float>& allBrokenLinesWidth);
template <typename PFP>
bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& polygons, CellMarker<FACE>& polygonsFaces);
......
This diff is collapsed.
......@@ -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]);
......
......@@ -222,14 +222,14 @@ public:
// * @param d dart of the vertex
// * @param e dart of the edge
// */
// virtual void insertEdgeInVertex(Dart d, Dart e);
virtual void insertEdgeInVertex(Dart d, Dart e);
//
// //! Remove an edge from a vertex orbit
// /*! \pre Dart d must be phi2 sewed
// * @param d the dart of the edge to remove from the vertex
// * @return true if the removal has been executed, false otherwise
// */
// virtual bool removeEdgeFromVertex(Dart d);
virtual bool removeEdgeFromVertex(Dart d);
//! Sew two oriented faces along oriented edges
/*! \pre Edges of darts d & e MUST be boundary edges
......
......@@ -340,21 +340,22 @@ void Map2::swapEdges(Dart d, Dart e)
//phi2sew(d2, e2);
}
//void Map2::insertEdgeInVertex(Dart d, Dart e)
//{
// assert(!sameVertex(d,e) && phi2(e) == phi_1(e));
// phi1sew(phi_1(d), phi_1(e));
//}
//
//bool Map2::removeEdgeFromVertex(Dart d)
//{
// if (!isBoundaryEdge(d))
// {
// phi1sew(phi_1(d), phi2(d)) ;
// return true ;
// }
// return false ;
//}
void Map2::insertEdgeInVertex(Dart d, Dart e)
{
assert(!sameVertex(d,e));
assert(phi2(e) == phi_1(e));
phi1sew(phi_1(d), phi_1(e));
}
bool Map2::removeEdgeFromVertex(Dart d)
{
if (!isBoundaryEdge(d))
{
phi1sew(phi_1(d), phi2(d)) ;
return true ;
}
return false ;
}
void Map2::sewFaces(Dart d, Dart e, bool withBoundary)
{
......
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