Commit e842fad0 authored by untereiner's avatar untereiner

adding prototype of functions

parent 0c65357f
......@@ -79,14 +79,14 @@ public:
protected:
//! 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
* - After: d->e and e->d
*/
void phi2sew(Dart d, Dart e);
//! 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
* - After: d->d and e->e
*/
......@@ -121,7 +121,7 @@ public:
*/
void splitVertex(Dart d, Dart e);
//TODO deleteVertex can create a Hole or must retriangulate the polygonal face
//TODO deleteVertex can create a Hole or must generate a new triangulation
//! Delete the vertex of d (works only for internal vertices)
/*! Does not create a hole -> all the faces
* around the vertex are merged into one face
......
......@@ -72,6 +72,186 @@ inline unsigned int Map2<MAP_IMPL>::getNbPermutations() const
return 1;
}
/*! @name Basic Topological Operators
* Access and Modification
*************************************************************************/
template <typename MAP_IMPL>
inline Dart Map2<MAP_IMPL>::phi1(Dart d) const
{
return MAP_IMPL::template getPermutation<0>(d);
}
template <typename MAP_IMPL>
inline Dart Map2<MAP_IMPL>::phi_1(Dart d) const
{
return MAP_IMPL::template getPermutationInv<0>(d);
}
template <typename MAP_IMPL>
inline Dart Map2<MAP_IMPL>::phi2(Dart d) const
{
return MAP_IMPL::template getInvolution<0>(d);
}
template <typename MAP_IMPL>
template <int N>
inline Dart Map2<MAP_IMPL>::phi(Dart d) const
{
assert( (N > 0) || !"negative parameters not allowed in template multi-phi");
if (N < 10)
{
switch(N)
{
case 1 : return phi1(d) ;
case 2 : return phi2(d) ;
default : assert(!"Wrong multi-phi relation value") ; return d ;
}
}
switch(N%10)
{
case 1 : return phi1(phi<N/10>(d)) ;
case 2 : return phi2(phi<N/10>(d)) ;
default : assert(!"Wrong multi-phi relation value") ; return d ;
}
}
template <typename MAP_IMPL>
inline Dart Map2<MAP_IMPL>::alpha0(Dart d) const
{
return phi2(d) ;
}
template <typename MAP_IMPL>
inline Dart Map2<MAP_IMPL>::alpha1(Dart d) const
{
return phi2(phi_1(d)) ;
}
template <typename MAP_IMPL>
inline Dart Map2<MAP_IMPL>::alpha_1(Dart d) const
{
return phi1(phi2(d)) ;
}
template <typename MAP_IMPL>
inline Dart Map2<MAP_IMPL>::phi2_1(Dart d) const
{
return phi2(phi_1(d)) ;
}
template <typename MAP_IMPL>
inline Dart Map2<MAP_IMPL>::phi12(Dart d) const
{
return phi1(phi2(d)) ;
}
template <typename MAP_IMPL>
inline void Map2<MAP_IMPL>::phi2sew(Dart d, Dart e)
{
MAP_IMPL::template involutionSew<0>(d,e);
}
template <typename MAP_IMPL>
inline void Map2<MAP_IMPL>::phi2unsew(Dart d)
{
MAP_IMPL::template involutionUnsew<0>(d);
}
/*! @name Generator and Deletor
* To generate or delete faces in a 2-map
*************************************************************************/
template <typename MAP_IMPL>
Dart Map2<MAP_IMPL>::newFace()
{
Dart d = this->newDart() ; // Create the first edge
this->newDart() ; // Create the first edge
this->newDart() ; // Create the first edge
return d;
}
template <typename MAP_IMPL>
void Map2<MAP_IMPL>::deleteFace(Dart d)
{
assert(!this->template isBoundaryMarked<2>(d)) ;
Dart it = d ;
do
{
if(!isBoundaryEdge(it))
unsewFaces(it) ;
it = this->phi1(it) ;
} while(it != d) ;
Dart dd = phi2(d) ;
ParentMap::deleteCycle(d) ;
ParentMap::deleteCycle(dd) ;
}
/*! @name Topological Operators
* Topological operations on 2-maps
*************************************************************************/
template <typename MAP_IMPL>
void Map2<MAP_IMPL>::splitVertex(Dart d, Dart e)
{
assert(sameVertex(d, e)) ;
// Dart d2 = phi2(d) ; assert(d != d2) ;
// Dart e2 = phi2(e) ; assert(e != e2) ;
// Dart nd = ParentMap::cutEdge(d2) ; // Cut the edge of dd (make a new half edge)
// Dart ne = ParentMap::cutEdge(e2) ; // Cut the edge of ee (make a new half edge)
// phi2sew(nd, ne) ; // Sew the two faces along the new edge
}
template <typename MAP_IMPL>
Dart Map2<MAP_IMPL>::collapseEdge(Dart d, bool delDegenerateFaces)
{
Dart resV = NIL ;
Dart e = phi2(d);
phi2unsew(d); // Unlink the opposite edges
Dart f = this->phi1(e) ;
Dart h = phi2(this->phi_1(e));
if (h != e)
resV = h;
if (f != e && delDegenerateFaces)
{
ParentMap::collapseEdge(e) ; // Collapse edge e
collapseDegeneratedFace(f) ; // and collapse its face if degenerated
}
else
ParentMap::collapseEdge(e) ; // Just collapse edge e
f = this->phi1(d) ;
if(resV == NIL)
{
h = phi2(this->phi_1(d));
if (h != d)
resV = h;
}
if (f != d && delDegenerateFaces)
{
ParentMap::collapseEdge(d) ; // Collapse edge d
collapseDegeneratedFace(f) ; // and collapse its face if degenerated
}
else
ParentMap::collapseEdge(d) ; // Just collapse edge d
return resV ;
}
template <typename MAP_IMPL>
bool Map2<MAP_IMPL>::flipEdge(Dart d)
{
if (!isBoundaryEdge(d)) // cannot flip a boundary edge
{
//echange de brin entre des lignes
}
return false ;
}
} // namespace Simplex
......
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