Commit 6a6f9b63 authored by untereiner's avatar untereiner

debut menage dans la maison 3-carte (emb+topo)

parent 61611d16
...@@ -25,9 +25,10 @@ ...@@ -25,9 +25,10 @@
#ifndef __IMPLICIT_HIERARCHICAL_MAP3__ #ifndef __IMPLICIT_HIERARCHICAL_MAP3__
#define __IMPLICIT_HIERARCHICAL_MAP3__ #define __IMPLICIT_HIERARCHICAL_MAP3__
#include "Topology/map/map3.h" //#include "Topology/map/map3.h"
#include "Topology/generic/embeddedMap3.h" //#include "Topology/generic/embeddedMap3.h"
#include "Container/attributeContainer.h" //#include "Container/attributeContainer.h"
#include "Topology/map/embeddedMap3.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -40,7 +41,7 @@ namespace IHM ...@@ -40,7 +41,7 @@ namespace IHM
template<typename T> class AttributeHandler_IHM ; template<typename T> class AttributeHandler_IHM ;
class ImplicitHierarchicalMap3 : public EmbeddedMap3<Map3> class ImplicitHierarchicalMap3 : public EmbeddedMap3
{ {
template<typename T> friend class AttributeHandler_IHM ; template<typename T> friend class AttributeHandler_IHM ;
......
...@@ -350,71 +350,83 @@ bool EmbeddedMap3<MAP3>::check() ...@@ -350,71 +350,83 @@ bool EmbeddedMap3<MAP3>::check()
return false ; return false ;
CGoGNout << "Check: embedding begin" << CGoGNendl ; CGoGNout << "Check: embedding begin" << CGoGNendl ;
DartMarker mv(*this);
for(Dart d = MAP3::begin(); d != MAP3::end(); MAP3::next(d)) for(Dart d = MAP3::begin(); d != MAP3::end(); MAP3::next(d))
{ {
if (MAP3::isOrbitEmbedded(VERTEX)) if(MAP3::isOrbitEmbedded(VERTEX))
{
if (MAP3::phi2(MAP3::phi_1(d)) != MAP3::phi_1(d) && MAP3::getEmbedding(VERTEX, d) != MAP3::getEmbedding(VERTEX, MAP3::phi2(MAP3::phi_1(d))))
{
CGoGNout << "Check: different embeddings on vertex" << CGoGNendl ;
return false ;
}
if(MAP3::phi3(d) != d && MAP3::getEmbedding(VERTEX, d) != MAP3::getEmbedding(VERTEX, MAP3::phi1(MAP3::phi3(d))))
{
CGoGNout << "Check: different embeddings on vertex in the 2 oriented faces" << CGoGNendl ;
CGoGNout << "Dart #" << d << CGoGNendl;
CGoGNout << "Emb(d) = " << MAP3::getEmbedding(VERTEX, d) << CGoGNendl;
CGoGNout << "Emb(phi32(d)) = " << MAP3::getEmbedding(VERTEX, MAP3::phi3(MAP3::phi2(d))) << CGoGNendl;
return false ;
}
}
if (MAP3::isOrbitEmbedded(EDGE))
{
if (MAP3::getEmbedding(EDGE, d) != MAP3::getEmbedding(EDGE, MAP3::phi2(d)))
{
CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
return false ;
}
if (MAP3::getEmbedding(EDGE, d) != MAP3::getEmbedding(EDGE, MAP3::phi3(d)))
{
CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
return false ;
}
}
if (MAP3::isOrbitEmbedded(FACE))
{ {
if (MAP3::getEmbedding(FACE, d) != MAP3::getEmbedding(FACE, MAP3::phi1(d))) if(!mv.isMarked(d))
{ {
CGoGNout << "Check: different embeddings on face" << CGoGNendl ; mv.markOrbit(VERTEX, d);
return false ; unsigned int emb = MAP3::getEmbedding(VERTEX, d);
} FunctorCheckEmbedding<MAP3> fce(*this, VERTEX, emb);
MAP3::foreach_dart_of_orbit(VERTEX, d, fce);
if (MAP3::getEmbedding(FACE, d) != MAP3::getEmbedding(FACE, MAP3::phi3(d)))
{
CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
return false ;
} }
} }
if (MAP3::isOrbitEmbedded(VOLUME)) // if (MAP3::isOrbitEmbedded(VERTEX))
{ // {
if (MAP3::getEmbedding(VOLUME, d) != MAP3::getEmbedding(VOLUME, MAP3::phi1(d))) // if (MAP3::phi2(MAP3::phi_1(d)) != MAP3::phi_1(d) && MAP3::getEmbedding(VERTEX, d) != MAP3::getEmbedding(VERTEX, MAP3::phi2(MAP3::phi_1(d))))
{ // {
CGoGNout << "Check: different embeddings in volume" << CGoGNendl ; // CGoGNout << "Check: different embeddings on vertex" << CGoGNendl ;
return false ; // return false ;
} // }
//
if (MAP3::getEmbedding(VOLUME, d) != MAP3::getEmbedding(VOLUME, MAP3::phi2(d))) // if(MAP3::phi3(d) != d && MAP3::getEmbedding(VERTEX, d) != MAP3::getEmbedding(VERTEX, MAP3::phi1(MAP3::phi3(d))))
{ // {
CGoGNout << "Check: different embeddings in volume" << CGoGNendl ; // CGoGNout << "Check: different embeddings on vertex in the 2 oriented faces" << CGoGNendl ;
return false ; // CGoGNout << "Dart #" << d << CGoGNendl;
} // CGoGNout << "Emb(d) = " << MAP3::getEmbedding(VERTEX, d) << CGoGNendl;
} // CGoGNout << "Emb(phi32(d)) = " << MAP3::getEmbedding(VERTEX, MAP3::phi3(MAP3::phi2(d))) << CGoGNendl;
// return false ;
// }
//
// }
//
// if (MAP3::isOrbitEmbedded(EDGE))
// {
// if (MAP3::getEmbedding(EDGE, d) != MAP3::getEmbedding(EDGE, MAP3::phi2(d)))
// {
// CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
// return false ;
// }
//
// if (MAP3::getEmbedding(EDGE, d) != MAP3::getEmbedding(EDGE, MAP3::phi3(d)))
// {
// CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
// return false ;
// }
// }
//
// if (MAP3::isOrbitEmbedded(FACE))
// {
// if (MAP3::getEmbedding(FACE, d) != MAP3::getEmbedding(FACE, MAP3::phi1(d)))
// {
// CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
// return false ;
// }
//
// if (MAP3::getEmbedding(FACE, d) != MAP3::getEmbedding(FACE, MAP3::phi3(d)))
// {
// CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
// return false ;
// }
// }
//
// if (MAP3::isOrbitEmbedded(VOLUME))
// {
// if (MAP3::getEmbedding(VOLUME, d) != MAP3::getEmbedding(VOLUME, MAP3::phi1(d)))
// {
// CGoGNout << "Check: different embeddings in volume" << CGoGNendl ;
// return false ;
// }
//
// if (MAP3::getEmbedding(VOLUME, d) != MAP3::getEmbedding(VOLUME, MAP3::phi2(d)))
// {
// CGoGNout << "Check: different embeddings in volume" << CGoGNendl ;
// return false ;
// }
// }
} }
CGoGNout << "Check: embedding ok" << CGoGNendl ; CGoGNout << "Check: embedding ok" << CGoGNendl ;
return true ; return true ;
......
...@@ -113,6 +113,25 @@ public: ...@@ -113,6 +113,25 @@ public:
} }
}; };
// Functor Check Embedding : to check the embeddings of the given map
template <typename MAP>
class FunctorCheckEmbedding : public FunctorMap<MAP>
{
protected:
unsigned int orbit;
unsigned int emb;
public:
FunctorCheckEmbedding(MAP& map, unsigned int orb, unsigned int e) : FunctorMap<MAP>(map), orbit(orb), emb(e)
{}
bool operator()(Dart d)
{
return (this->m_map.getEmbedding(orbit, d) != emb);
}
};
// Search Functor: look for a given dart when applied // Search Functor: look for a given dart when applied
/********************************************************/ /********************************************************/
...@@ -157,6 +176,7 @@ public: ...@@ -157,6 +176,7 @@ public:
} }
}; };
// Multiple Functor: to apply several Functors in turn to a dart // Multiple Functor: to apply several Functors in turn to a dart
/********************************************************/ /********************************************************/
......
...@@ -39,69 +39,55 @@ class EmbeddedMap3 : public Map3 ...@@ -39,69 +39,55 @@ class EmbeddedMap3 : public Map3
public: public:
typedef Map3 TOPO_MAP; typedef Map3 TOPO_MAP;
//!
/*! /*!
* *
*/ */
virtual void sewVolumes(Dart d, Dart e); virtual bool deleteVertex(Dart d);
/*! No attribute is attached to the new vertex
* The attributes attached to the old edge are duplicated on both resulting edges
* @param d a dart
*/
virtual void cutEdge(Dart d);
/*! The attributes attached to the edge of d are kept on the resulting edge
* @param d a dart of the edge to cut
*/
virtual void uncutEdge(Dart d);
//!
/*! /*!
* *
*/ */
virtual void unsewVolumes(Dart d); virtual void splitFace(Dart d, Dart e);
//!
/*! /*!
* *
*/ */
virtual bool mergeVolumes(Dart d); virtual Dart cutSpike(Dart d);
//! Split a face inserting an edge between two vertices /*!
/*! \pre Dart d and e should belong to the same face and be distinct *
* @param d dart of first vertex
* @param e dart of second vertex
* @return the dart of the new edge lying in the vertex of d after the cut
*/ */
virtual void splitFace(Dart d, Dart e); virtual void sewVolumes(Dart d, Dart e);
//! Cut the edge of d /*!
/*! @param d a dart of the edge to cut *
*/ */
virtual void cutEdge(Dart d); virtual void unsewVolumes(Dart d);
//!
/*! /*!
* *
*/ */
virtual Dart cutSpike(Dart d); virtual bool mergeVolumes(Dart d);
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
* faces are build (faces with less than 3 edges). If it occurs the faces
* are deleted and the adjacencies are updated (see deleteIfDegenerated).
* \warning This may produce two distinct vertices if the edge
* was the only link between two border faces
* @param d a dart in the deleted edge
* @param delDegenerateFaces a boolean (default to true)
*/
virtual int collapseEdge(Dart d, bool delDegenerateFaces = true,
bool delDegenerateVolumes = true);
//!
/*! /*!
* *
*/ */
virtual void collapseFace(Dart d, bool delDegenerateFaces = true, virtual bool check();
bool delDegenerateVolumes = true);
//????????? fonction de 2-carte
virtual unsigned int closeHole(Dart d); virtual unsigned int closeHole(Dart d);
virtual void closeMap(DartMarker &marker);
virtual bool check();
} ; } ;
} // namespace CGoGN } // namespace CGoGN
......
...@@ -305,18 +305,18 @@ public: ...@@ -305,18 +305,18 @@ public:
*/ */
bool sameVertex(Dart d, Dart e) ; bool sameVertex(Dart d, Dart e) ;
/** //! Compute the number of edges of the vertex of d
* compute the number of edges of the vertex of d /*! @param d a dart
*/ */
unsigned int vertexDegree(Dart d) ; unsigned int vertexDegree(Dart d) ;
/** //! Compute the number of faces in the volume of d
* compute the number of faces in the volume of d /*! @param d a dart
*/ */
unsigned int volumeDegree(Dart d); unsigned int volumeDegree(Dart d);
/** //! Tell if the vertex of d is on the boundary of the map
* tell if the vertex of d is on the boundary of the map /*! @param d a dart
*/ */
bool isBoundaryVertex(Dart d) ; bool isBoundaryVertex(Dart d) ;
...@@ -373,20 +373,6 @@ public: ...@@ -373,20 +373,6 @@ public:
*/ */
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);
//!
/*! TODO Ajout a valider
* restreint aux complexes simpliciaux
* Apply a functor on the all darts in the set of the star from orbit
*/
bool foreach_dart_of_star(Dart d, unsigned int orbit, FunctorType& f, unsigned int thread=0);
//!
/*! TODO Ajout a valider
* restreint aux complexes simpliciaux
* Apply a functor on the all darts in the set of the link from orbit
*/
bool foreach_dart_of_link(Dart d, unsigned int orbit, FunctorType& f, unsigned int thread=0);
//@} //@}
}; };
......
...@@ -86,30 +86,30 @@ public: ...@@ -86,30 +86,30 @@ public:
protected: protected:
//! Link dart d with dart e by an involution //! Link dart d with dart e by an involution
/* @param d,e the darts to link /*! @param d,e the darts to link
* - Before: d->d and e->e * - Before: d->d and e->e
* - After: d->e and e->d * - After: d->e and e->d
*/ */
void phi3sew(Dart d, Dart e); void phi3sew(Dart d, Dart e);
//! Unlink the current dart by an involution //! Unlink the current dart by an involution
/* @param d the dart to unlink /*! @param d the dart to unlink
* - Before: d->e and e->d * - Before: d->e and e->d
* - After: d->d and e->e * - After: d->d and e->e
*/ */
void phi3unsew(Dart d); void phi3unsew(Dart d);
public:
/*! @name Generator and Deletor /*! @name Generator and Deletor
* To generate or delete volumes in a 3-map * To generate or delete volumes in a 3-map
*************************************************************************/ *************************************************************************/
public:
//@{ //@{
//! Delete an oriented volume //! Delete a volume erasing all its darts.
/*! @param d a dart of the volume /*! The phi3-links around the volume are removed
* @param d a dart of the volume
*/ */
virtual void deleteOrientedVolume(Dart d); virtual void deleteVolume(Dart d);
//@} //@}
/*! @name Topological Operators /*! @name Topological Operators
...@@ -117,22 +117,23 @@ public: ...@@ -117,22 +117,23 @@ public:
*************************************************************************/ *************************************************************************/
//@{ //@{
//! Sew two oriented volumes along their faces. //TODO deleteVertex : works only for boundary vertices
/*! The oriented faces should not be phi3-linked and have the same length //! Delete the vertex of d
* @param d a dart of the first volume /*! All the faces around the vertex are merged into one face
* @param e a dart of the second volume * @param d a dart of the vertex to delete
* @return true if the deletion has been executed, false otherwise
*/ */
virtual void sewVolumes(Dart d, Dart e); virtual bool deleteVertex(Dart d);
//! Unsew two oriented volumes along their faces. //! Cut the edge of d (all darts around edge orbit are cutted)
/*! @param d a dart of one volume /*! @param d a dart of the edge to cut
*/ */
virtual void unsewVolumes(Dart d); virtual void cutEdge(Dart d);
//! Merge to volume sewed by one face //! Uncut the edge of d (all darts around edge orbit are uncutted)
/*! @param d a dart of common face /*! @param d a dart of the edge to uncut
*/ */
virtual bool mergeVolumes(Dart d); virtual void uncutEdge(Dart d);
//! Split a face inserting an edge between two vertices //! Split a face inserting an edge between two vertices
/*! \pre Dart d and e should belong to the same face and be distinct /*! \pre Dart d and e should belong to the same face and be distinct
...@@ -142,93 +143,29 @@ public: ...@@ -142,93 +143,29 @@ public:
*/ */
virtual void splitFace(Dart d, Dart e); virtual void splitFace(Dart d, Dart e);
//! Cut the edge of d //! Unsew the faces from the one-ring of the vertex of d
/*! @param d a dart of the edge to cut /*! @param d a dart
*/
virtual void cutEdge(Dart d);
//! Uncut the edge of d
/*! @param d a dart of the edge to uncut
*/
virtual void uncutEdge(Dart d);
//!
/*!
*
*/ */
virtual bool deleteVertex(Dart d); virtual Dart cutSpike(Dart d);
//! //! Sew two oriented volumes along their faces.
/*! Flip the edge of d (rotation in phi1 order) /*! The oriented faces should not be phi3-linked and have the same length
* WARNING : works only if the edge is owned by exactly one or two volumes * @param d a dart of the first volume
* @param d the edge to flip * @param e a dart of the second volume
*/ */
//virtual bool flipEdge(Dart d); virtual void sewVolumes(Dart d, Dart e);
//! //! Unsew two oriented volumes along their faces.
/*! Flip the edge of d (rotation in phi_1 order) /*! @param d a dart of one volume
* WARNING : works only if the edge is owned by exactly one or two volumes
* @param d the edge to flip
*/ */
//virtual bool flipBackEdge(Dart d); virtual void unsewVolumes(Dart d);
//! //! Merge to volume along their common oriented face
/*! /*! @param d a dart of common face
*
*/
//virtual bool flipFace(Dart d);
//! Insert a face in phi2 along the orbit phi<-1,2,-1>
/*! The cardinality of <phi1>(nF) must be equal to the cardinality of <phi(-1,2,-1)>(d)
* @param d a dart where the face should be inserted
* @param e a dart from the face to insert
*/
//virtual void insertFace(Dart d, Dart e);
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
* faces are build (faces with less than 3 edges). If it occurs the faces
* are deleted and the adjacencies are updated (see deleteIfDegenerated).
* \warning This may produce two distinct vertices if the edge
* was the only link between two border faces
* @param d a dart in the deleted edge
* @param delDegenerateFaces a boolean (default to true)
*/
virtual int collapseEdge(Dart d, bool delDegenerateFaces = true, bool delDegenerateVolumes = true);
//!
/*!
*
* @param
* @param
* @param
*/
virtual void collapseFace(Dart d, bool delDegenerateFaces = true, bool delDegenerateVolumes = true);
//!
/*!
*
* @param
* @param
* @param
*/
virtual void collapseVolume(Dart d, bool delDegenerateFaces = true, bool delDegenerateVolumes = true);
/** Fusion two faces deleting the two edges after d and e
* and their respective phi3 faces
*! \pre Dart d and e should belong to distinct faces
* \pre Dart d and e should not be phi2-linked
* \pre Dart d and e should not be phi3-linked
* @param d a dart in the first face
* @param e a dart in the second face
*/ */
virtual bool mergeFaces(Dart d, Dart e); virtual bool mergeVolumes(Dart d);
//! //@}
/*!
*
*/
virtual Dart cutSpike(Dart d);
/*! @name Topological Queries /*! @name Topological Queries
* Return or set various topological information * Return or set various topological information
...@@ -247,7 +184,16 @@ public: ...@@ -247,7 +184,16 @@ public:
*/ */
bool sameVertex(Dart d, Dart e) ; bool sameVertex(Dart d, Dart e) ;
//@{ //! Compute the number of edges of the vertex of d
/*! @param d a dart
*/
unsigned int vertexDegree(Dart d) ;
//! Tell if the vertex of d is on the boundary
/*! @param d a dart
*/
bool isBoundaryVertex(Dart d);
//! Test if dart d and e belong to the same oriented edge //! Test if dart d and e belong to the same oriented edge
/*! @param d a dart /*! @param d a dart
* @param e a dart * @param e a dart
...@@ -260,28 +206,29 @@ public: ...@@ -260,28 +206,29 @@ public:
*/ */
bool sameEdge(Dart d, Dart e) ; bool sameEdge(Dart d, Dart e) ;
//! //! Compute the number of volumes around the edge of d
/* /*! @param d a dart
*
*/ */
virtual int edgeDegree(Dart d);