Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit e017aa7e authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

presque fini la passe sur Map1 et Map2

parent d7cd1625
...@@ -51,7 +51,7 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Dart d, const typename ...@@ -51,7 +51,7 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Dart d, const typename
{ {
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
if(map.isFaceTriangle(d)) if(map.faceDegree(d) == 3)
return triangleArea<PFP>(map, d, position) ; return triangleArea<PFP>(map, d, position) ;
else else
{ {
......
...@@ -69,7 +69,7 @@ typename PFP::VEC3 newellNormal(typename PFP::MAP& map, Dart d, const typename P ...@@ -69,7 +69,7 @@ typename PFP::VEC3 newellNormal(typename PFP::MAP& map, Dart d, const typename P
template <typename PFP> template <typename PFP>
typename PFP::VEC3 faceNormal(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position) typename PFP::VEC3 faceNormal(typename PFP::MAP& map, Dart d, const typename PFP::TVEC3& position)
{ {
if(map.isFaceTriangle(d)) if(map.faceDegree(d) == 3)
return triangleNormal<PFP>(map, d, position) ; return triangleNormal<PFP>(map, d, position) ;
else else
return newellNormal<PFP>(map, d, position) ; return newellNormal<PFP>(map, d, position) ;
......
...@@ -423,7 +423,7 @@ Dart Polyhedron<PFP>::cylinder_topo(int n, int z, bool top_closed, bool bottom_c ...@@ -423,7 +423,7 @@ Dart Polyhedron<PFP>::cylinder_topo(int n, int z, bool top_closed, bool bottom_c
if(m_map.closeHole(d,false)) if(m_map.closeHole(d,false))
{ {
d = m_map.phi2(d); d = m_map.phi2(d);
if(!m_map.isFaceTriangle(d)) if(m_map.faceDegree(d) > 3)
{ {
Algo::Modelisation::trianguleFace<PFP>(m_map,d); Algo::Modelisation::trianguleFace<PFP>(m_map,d);
...@@ -452,7 +452,7 @@ Dart Polyhedron<PFP>::cylinder_topo(int n, int z, bool top_closed, bool bottom_c ...@@ -452,7 +452,7 @@ Dart Polyhedron<PFP>::cylinder_topo(int n, int z, bool top_closed, bool bottom_c
if(m_map.closeHole(d,true)) if(m_map.closeHole(d,true))
{ {
d = m_map.phi2(d); d = m_map.phi2(d);
if(!m_map.isFaceTriangle(d)) if(m_map.faceDegree(d) > 3)
{ {
Algo::Modelisation::trianguleFace<PFP>(m_map,d); Algo::Modelisation::trianguleFace<PFP>(m_map,d);
......
...@@ -50,12 +50,6 @@ public: ...@@ -50,12 +50,6 @@ public:
*/ */
virtual bool deleteVertex(Dart d) ; virtual bool deleteVertex(Dart d) ;
/**
* No attribute is attached to the new edge
* The attributes attached to the face of dart d are kept on the resulting face
*/
virtual void linkVertices(Dart d, Dart e) ;
/** /**
* No attribute is attached to the new vertex * No attribute is attached to the new vertex
* The attributes attached to the old edge are duplicated on both resulting edges * The attributes attached to the old edge are duplicated on both resulting edges
...@@ -91,23 +85,23 @@ public: ...@@ -91,23 +85,23 @@ public:
*/ */
virtual bool flipBackEdge(Dart d) ; virtual bool flipBackEdge(Dart d) ;
/** // /**
* The attributes attached to the vertex of dart d are kept on the resulting vertex // * The attributes attached to the vertex of dart d are kept on the resulting vertex
* The attributes attached to the face of dart d are overwritten on the face of dart e // * The attributes attached to the face of dart d are overwritten on the face of dart e
*/ // */
virtual void insertEdgeInVertex(Dart d, Dart e); // virtual void insertEdgeInVertex(Dart d, Dart e);
//
/** // /**
* The attributes attached to the vertex of dart d are kept on the resulting vertex // * The attributes attached to the vertex of dart d are kept on the resulting vertex
* The attributes attached to the face of dart d are overwritten on the face of dart e // * The attributes attached to the face of dart d are overwritten on the face of dart e
*/ // */
virtual void removeEdgeFromVertex(Dart d); // virtual void removeEdgeFromVertex(Dart d);
/** /**
* The attributes attached to the vertices of the edge of d are kept on the vertices of the resulting edge * The attributes attached to the vertices of the edge of d are kept on the vertices of the resulting edge
* The attributes attached to the edge of d are kept on the resulting edge * The attributes attached to the edge of d are kept on the resulting edge
*/ */
virtual void sewFaces(Dart d, Dart e, bool withBoundary=true) ; virtual void sewFaces(Dart d, Dart e, bool withBoundary = true) ;
/** /**
* The attributes attached to the vertices of the old edge of d are duplicated on the vertices of both resulting edges * The attributes attached to the vertices of the old edge of d are duplicated on the vertices of both resulting edges
......
...@@ -111,7 +111,7 @@ public: ...@@ -111,7 +111,7 @@ public:
/*! @param nbEdges the number of edges /*! @param nbEdges the number of edges
* @return return a dart of the face * @return return a dart of the face
*/ */
Dart newBoundaryCycle(unsigned nbEdges); Dart newBoundaryCycle(unsigned int nbEdges);
//! Delete an oriented face erasing all its darts //! Delete an oriented face erasing all its darts
/*! @param d a dart of the face /*! @param d a dart of the face
...@@ -125,44 +125,43 @@ public: ...@@ -125,44 +125,43 @@ public:
*************************************************************************/ *************************************************************************/
//@{ //@{
//! Cut an edge inserting a new dart between d and its successor in the face //! Cut an edge inserting a new dart between d and its successor in the cycle
/*! @param d the edge to cut /*! @param d the edge to cut
* \image hmtl map1_cutEdge.png * \image hmtl map1_cutEdge.png
*/ */
void cutEdge(Dart d); void cutEdge(Dart d);
//! Collapse an edge of a face //! Collapse an edge of a cycle
/*! \warning Dart d no longer exists after the call /*! \warning Dart d no longer exists after the call
* @param d the edge * @param d the edge
*/ */
void collapseEdge(Dart d); void collapseEdge(Dart d);
//! Split a face between vertices d and e //! Split a cycle between vertices d and e
/*! \pre Dart d and e MUST be different and belong to the same face /*! \pre Dart d and e MUST be different and belong to the same face
* @param d first dart in the face * @param d first dart in the face
* @param e second dart in the face * @param e second dart in the face
*/ */
void splitFace(Dart d, Dart e); void splitCycle(Dart d, Dart e);
//! Link two vertices belonging to distinct faces (add an edge between the two vertices) //! Merge two cycles on vertices d and e
/*! \pre Dart d and e MUST be different and belong to distinct face
* @param d first dart in the face
* @param e second dart in the face
*/
void linkVertices(Dart d, Dart e);
//! Merge the two faces of d and e, darts d & e disappear
/*! \pre Dart d and e MUST belong to distinct faces /*! \pre Dart d and e MUST belong to distinct faces
* \warning Darts d and e no longer exist after the call
* @param d a dart in the first face * @param d a dart in the first face
* @param e a dart in the second face * @param e a dart in the second face
*/ */
void mergeFaces(Dart d, Dart e); void mergeCycles(Dart d, Dart e);
//! Link two vertices belonging to distinct cycles (add an edge between the two vertices)
/*! \pre Dart d and e MUST be different and belong to distinct face
* @param d first dart in the face
* @param e second dart in the face
*/
void linkCycles(Dart d, Dart e);
//! reverse a face (phi1 become phi_1 and ...) //! reverse a face (phi1 become phi_1 and ...)
/*! @param d a dart of face /*! @param d a dart of face
*/ */
void reverseFace(Dart d) ; void reverseCycle(Dart d) ;
//@} //@}
/*! @name Topological Queries /*! @name Topological Queries
...@@ -170,29 +169,23 @@ public: ...@@ -170,29 +169,23 @@ public:
*************************************************************************/ *************************************************************************/
//@{ //@{
//! Test if dart d and e belong to the same oriented face //! Test if darts d and e belong to the same cycle
/*! @param d a dart /*! @param d a dart
* @param e a dart * @param e a dart
*/ */
bool sameOrientedFace(Dart d, Dart e) ; bool sameCycle(Dart d, Dart e) ;
//! Test if dart d and e belong to the same face //! Length of a cycle (its number of oriented edges)
/*! @param d a dart /*! @param d a dart of the cycle
* @param e a dart * @return the length of the cycle
*/ */
bool sameFace(Dart d, Dart e) ; unsigned int cycleDegree(Dart d) ;
//! Length of a face (its number of oriented edges)
/*! @param d a dart of the face
* @return the length of the face
*/
unsigned int faceDegree(Dart d) ;
/** /**
* check if the face of d is a triangle * check if the cycle of d is a triangle
* @return a boolean indicating if the face is a triangle * @return a boolean indicating if the cycle is a triangle
*/ */
bool isFaceTriangle(Dart d); bool isCycleTriangle(Dart d);
//@} //@}
/*! @name Cell Functors /*! @name Cell Functors
...@@ -204,33 +197,37 @@ public: ...@@ -204,33 +197,37 @@ public:
/*! @param d a dart of the vertex /*! @param d a dart of the vertex
* @param f the functor to apply * @param f the functor to apply
*/ */
bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread=0); bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0);
//! Apply a functor on every dart of an edge //! Apply a functor on every dart of an edge
/*! @param d a dart of the edge /*! @param d a dart of the edge
* @param f the functor to apply * @param f the functor to apply
*/ */
bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread=0); bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread = 0);
//! Apply a functor on every dart of an oriented face //! Apply a functor on every dart of an oriented face
/*! @param d a dart of the face /*! @param d a dart of the face
* @param f the functor to apply * @param f the functor to apply
*/ */
bool foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int thread=0) ; bool foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int thread = 0) ;
bool foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread=0); //! Apply a functor on every dart of a face
/*! @param d a dart of the face
* @param f the functor to apply
*/
bool foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread = 0);
//! Apply a functor on every dart of a volume //! Apply a functor on every dart of a volume
/*! @param d a dart of the volume /*! @param d a dart of the volume
* @param f the functor to apply * @param f the functor to apply
*/ */
bool foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread=0); bool foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread = 0);
//! Apply a functor on every dart of a connected component //! Apply a functor on every dart of a connected component
/*! @param d a dart of the onnected component /*! @param d a dart of the connected component
* @param f the functor to apply * @param f the functor to apply
*/ */
bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread=0); bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread = 0);
//@} //@}
} ; } ;
......
...@@ -151,37 +151,57 @@ inline void Map1::collapseEdge(Dart d) ...@@ -151,37 +151,57 @@ inline void Map1::collapseEdge(Dart d)
deleteDart(d) ; // Dart d is erased deleteDart(d) ; // Dart d is erased
} }
inline void Map1::splitFace(Dart d, Dart e) inline void Map1::splitCycle(Dart d, Dart e)
{ {
assert(d != e && sameOrientedFace(d, e)) ; assert(d != e && sameCycle(d, e)) ;
Map1::cutEdge(phi_1(d)); // cut the edge before d (insert a new dart before d) phi1sew(phi_1(d), phi_1(e)) ;
Map1::cutEdge(phi_1(e)); // cut the edge before e (insert a new dart before e)
phi1sew(phi_1(d), phi_1(e)) ; // phi1sew between the 2 new inserted darts
} }
inline void Map1::linkVertices(Dart d, Dart e) inline void Map1::mergeCycles(Dart d, Dart e)
{ {
assert(d != e && !sameOrientedFace(d, e)) ; assert(!sameCycle(d, e)) ;
Map1::cutEdge(phi_1(d)); // cut the edge before d (insert a new dart before d) phi1sew(phi_1(d), phi_1(e)) ;
Map1::cutEdge(phi_1(e)); // cut the edge before e (insert a new dart before e)
phi1sew(phi_1(d), phi_1(e)) ; // phi1sew between the 2 new inserted darts
} }
inline void Map1::mergeFaces(Dart d, Dart e) inline void Map1::linkCycles(Dart d, Dart e)
{ {
assert(!sameOrientedFace(d, e)) ; assert(d != e && !sameCycle(d, e)) ;
phi1sew(d, phi_1(e)) ; Map1::cutEdge(phi_1(d)); // cut the edge before d (insert a new dart before d)
phi1sew(e, phi_1(d)) ; Map1::cutEdge(phi_1(e)); // cut the edge before e (insert a new dart before e)
deleteCycle(d) ; phi1sew(phi_1(d), phi_1(e)) ; // phi1sew between the 2 new inserted darts
} }
/*! @name Topological Queries /*! @name Topological Queries
* Return or set various topological information * Return or set various topological information
*************************************************************************/ *************************************************************************/
inline bool Map1::sameFace(Dart d, Dart e) inline bool Map1::sameCycle(Dart d, Dart e)
{ {
return sameOrientedFace(d, e) ; Dart it = d ;
do
{
if(it == e)
return true ;
it = phi1(it) ;
} while(it != d) ;
return false ;
}
inline unsigned int Map1::cycleDegree(Dart d)
{
unsigned int count = 0 ;
Dart it = d ;
do
{
++count ;
it = phi1(it) ;
} while (it != d) ;
return count ;
}
inline bool Map1::isCycleTriangle(Dart d)
{
return (phi1(d) != d) && (phi1(phi1(phi1(d))) == d) ;
} }
/*! @name Cell Functors /*! @name Cell Functors
...@@ -198,6 +218,18 @@ inline bool Map1::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thre ...@@ -198,6 +218,18 @@ inline bool Map1::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thre
return f(d) ; return f(d) ;
} }
inline bool Map1::foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int thread)
{
Dart it = d ;
do
{
if (f(it))
return true ;
it = phi1(it) ;
} while (it != d) ;
return false ;
}
inline bool Map1::foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread) inline bool Map1::foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread)
{ {
return foreach_dart_of_oriented_face(d, f, thread) ; return foreach_dart_of_oriented_face(d, f, thread) ;
......
...@@ -99,15 +99,15 @@ protected: ...@@ -99,15 +99,15 @@ protected:
* Function used to merge boundary faces properly * Function used to merge boundary faces properly
*************************************************************************/ *************************************************************************/
//! merge a face that has been tag as boundary with existing boundary if needed // /**
/* @param d a dart of the face // * merge two faces of boundary
*/ // */
void mergeFaceWithBoundary(Dart d); // void mergeBoundaryFaces(Dart dd, Dart ee);
/** // //! merge a face that has been tag as boundary with existing boundary if needed
* merge two faces of boundary // /* @param d a dart of the face
*/ // */
void mergeBoundaryFaces(Dart dd, Dart ee); // void mergeFaceWithBoundary(Dart d);
/*! @name Generator and Deletor /*! @name Generator and Deletor
* To generate or delete faces in a 2-map * To generate or delete faces in a 2-map
...@@ -122,14 +122,18 @@ public: ...@@ -122,14 +122,18 @@ public:
* @param withBoudary create the face and its boundary (default true) * @param withBoudary create the face and its boundary (default true)
* @return return a dart of the face * @return return a dart of the face
*/ */
virtual Dart newFace(unsigned int nbEdges, bool withBoundary=true) ; virtual Dart newFace(unsigned int nbEdges, bool withBoundary = true) ;
//! Delete an oriented face erasing all its darts (not really tags as boundary). //! Delete the face of d
/*! The phi2-links around the face are removed /*! @param d a dart of the face
* @param d a dart of the face
*/ */
virtual void deleteFace(Dart d) ; virtual void deleteFace(Dart d) ;
//! Fill a hole with a face
/*! \pre Dart d is boundary marked
* @param d a dart of the face to fill
*/
virtual void fillHole(Dart d) ;
//@} //@}
/*! @name Topological Operators /*! @name Topological Operators
...@@ -152,13 +156,6 @@ public: ...@@ -152,13 +156,6 @@ public:
*/ */
virtual bool deleteVertex(Dart d); virtual bool deleteVertex(Dart d);
//! Link two vertices belonging to distinct faces (add an edge between the two vertices)
/*! \pre Dart d and e MUST be different and belong to distinct face
* @param d first dart in the face
* @param e second dart in the face
*/
virtual void linkVertices(Dart d, Dart e); //TODO remove ??
//! Cut the edge of d by inserting a new vertex //! Cut the edge of d by inserting a new vertex
/*! @param d a dart of the edge to cut /*! @param d a dart of the edge to cut
*/ */
...@@ -198,27 +195,28 @@ public: ...@@ -198,27 +195,28 @@ public:
*/ */
virtual bool flipBackEdge(Dart d); virtual bool flipBackEdge(Dart d);
//! Insert an edge after a dart in the vertex orbit // //! Insert an edge after a dart in the vertex orbit
/*! \pre Dart d and e MUST be different and belong to distinct face // /*! \pre Dart d and e MUST be different and belong to distinct face
* \pre Dart e must be phi2-linked with its phi_1 dart // * \pre Dart e must be phi2-linked with its phi_1 dart
* @param d dart of the vertex // * @param d dart of the vertex
* @param e dart of the edge // * @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 // //! Remove an edge from a vertex orbit
/*! \pre Dart d must be phi2 sewn // /*! \pre Dart d must be phi2 sewed
* @param d the dart of the edge to remove from the vertex // * @param d the dart of the edge to remove from the vertex
*/ // * @return true if the removal has been executed, false otherwise
virtual void removeEdgeFromVertex(Dart d); // */
// virtual bool removeEdgeFromVertex(Dart d);
//! Sew two oriented faces along oriented edges //! Sew two oriented faces along oriented edges
/*! \pre Edges of darts d & e MUST be boundary edges /*! \pre Edges of darts d & e MUST be boundary edges
* @param d a dart of the first face * @param d a dart of the first face
* @param e a dart of the second face * @param e a dart of the second face
* @param withBoundary: face have no fixed points (false only for construction: import/primitives) * @param withBoundary: if false, faces have phi2 fixed points (only for construction: import/primitives)
*/ */
virtual void sewFaces(Dart d, Dart e, bool withBoundary=true); virtual void sewFaces(Dart d, Dart e, bool withBoundary = true);
//! Unsew two oriented faces along oriented edges //! Unsew two oriented faces along oriented edges
/*! @param d a dart of one face /*! @param d a dart of one face
...@@ -262,19 +260,11 @@ public: ...@@ -262,19 +260,11 @@ public:
void insertTrianglePair(Dart d, Dart v1, Dart v2) ; void insertTrianglePair(Dart d, Dart v1, Dart v2) ;
/** /**
* Unsew the faces consisting of the umbrella of a vertex * Unsew the faces of the umbrella of the vertex of d
* \warning Darts may have
* @param d a dart from the vertex * @param d a dart from the vertex
*/ */
void unsewAroundVertex(Dart d) ; void unsewAroundVertex(Dart d) ;
/**
* Unsew the Umbrella aroud a vertex, close the hole and then
* create a symetric to construct a polyedron
* @param d a dart from the vertex
*/
// void explodPolyhedron(Dart d); //TODO modification for new boundary managing method ???
//! Merge two volumes along two faces. //! Merge two volumes along two faces.
/*! Works only if the two faces have the same number of edges. /*! Works only if the two faces have the same number of edges.
* The faces adjacent to the two given faces are pairwise phi2-linked * The faces adjacent to the two given faces are pairwise phi2-linked
...@@ -311,11 +301,22 @@ public: ...@@ -311,11 +301,22 @@ public:
*/ */
bool sameVertex(Dart d, Dart e) ; bool sameVertex(Dart d, Dart e) ;
//! 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) ;
/** /**
* compute the number of edges of the vertex of d * compute the number of edges of the vertex of d
*/ */
unsigned int vertexDegree(Dart d) ; unsigned int vertexDegree(Dart d) ;
/**