Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 37e4f492 authored by untereiner's avatar untereiner
Browse files

Merge cgogn.u-strasbg.fr:~kraemer/CGoGN

parents 7159e0d2 aa3ae422
......@@ -147,11 +147,12 @@ void coarsenEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
assert(map.edgeCanBeCoarsened(d) || !"Trying to coarsen an edge that can not be coarsened") ;
unsigned int cur = map.getCurrentLevel() ;
Dart d2 = map.phi2(d) ;
// Dart e = map.phi2(d) ;
map.setCurrentLevel(cur + 1) ;
unsigned int dl = map.getDartLevel(d2) ;
map.setDartLevel(map.phi1(d2), dl) ;
map.collapseEdge(d2) ;
// unsigned int dl = map.getDartLevel(e) ;
// map.setDartLevel(map.phi1(e), dl) ;
// map.collapseEdge(e) ;
map.uncutEdge(d) ;
map.setCurrentLevel(cur) ;
}
......
......@@ -132,6 +132,9 @@ public:
// Equal
bool operator==(const Vector<DIM,T>& v) const ;
// Different
bool operator!=(const Vector<DIM,T>& v) const ;
bool hasNan() const ;
/**********************************************/
......
......@@ -277,6 +277,15 @@ inline bool Vector<DIM,T>::operator==(const Vector<DIM,T>& v) const
return true ;
}
template <unsigned int DIM, typename T>
inline bool Vector<DIM,T>::operator!=(const Vector<DIM,T>& v) const
{
for(unsigned int i = 0 ; i < DIM ; ++i)
if(v[i] != m_data[i])
return true ;
return false ;
}
template <unsigned int DIM, typename T>
inline bool Vector<DIM,T>::hasNan() const
{
......@@ -314,7 +323,6 @@ inline Vector<DIM,T> operator*(T a, const Vector<DIM,T>& v)
return v * a ;
}
template <unsigned int DIM, typename T>
inline Vector<DIM,T> operator/(T a, const Vector<DIM,T>& v)
{
......@@ -346,7 +354,6 @@ inline Vector<DIM,T> slerp(const Vector<DIM,T> &v1, const Vector<DIM,T> &v2, con
return res ;
}
} // namespace Geom
} // namespace CGoGN
......@@ -55,6 +55,11 @@ public:
*/
virtual void cutEdge(Dart d) ;
/**
* The attributes attached to the edge of d are kept on the resulting edge
*/
virtual void uncutEdge(Dart d) ;
/**
* Check if the edge of d can be collapsed or not based on some topological conditions
* @param d a dart of the edge to test
......
......@@ -87,6 +87,20 @@ void EmbeddedMap2<MAP2>::cutEdge(Dart d)
}
}
template <typename MAP2>
void EmbeddedMap2<MAP2>::uncutEdge(Dart d)
{
bool doSomethg = (d != MAP2::phi2(d)) ;
MAP2::uncutEdge(d) ;
if(doSomethg)
{
if(MAP2::isOrbitEmbedded(EDGE_ORBIT))
MAP2::copyDartEmbedding(EDGE_ORBIT, MAP2::phi2(d), d) ;
}
}
template <typename MAP2>
bool EmbeddedMap2<MAP2>::edgeCanCollapse(Dart d)
{
......
......@@ -130,6 +130,11 @@ public:
*/
virtual void cutEdge(Dart d);
//! Undo the cut of the edge of d and its opposite edge if it exists
/*! @param d a dart of the edge to uncut
*/
virtual void uncutEdge(Dart d);
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
* faces are built (faces with less than 3 edges). If it occurs the faces
......
......@@ -190,7 +190,10 @@ Dart ImplicitHierarchicalMap::faceOldestDart(Dart d)
do
{
unsigned int l = m_dartLevel[it] ;
if(l < l_old || (l == l_old && it < oldest))
if(l == 0)
return it ;
if(l < l_old)
// if(l < l_old || (l == l_old && it < oldest))
{
oldest = it ;
l_old = l ;
......
......@@ -88,6 +88,24 @@ void Map2::cutEdge(Dart d)
}
}
void Map2::uncutEdge(Dart d)
{
assert(vertexDegree(phi1(d)) == 2) ;
Dart ne = phi2(d) ;
if(ne == d)
collapseEdge(d) ;
else
{
Dart nd = phi1(d) ;
Dart e = phi_1(ne) ;
phi2unsew(e) ;
phi2unsew(d) ;
Map1::collapseEdge(nd) ;
Map1::collapseEdge(ne) ;
phi2sew(d, e) ;
}
}
Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
{
Dart resV ;
......@@ -108,11 +126,11 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
if (f != e && delDegenerateFaces)
{
Map1::collapseEdge(e); // Collapse edge e
collapseDegeneratedFace(f); // and collapse its face if degenerated
Map1::collapseEdge(e) ; // Collapse edge e
collapseDegeneratedFace(f) ;// and collapse its face if degenerated
}
else
Map1::collapseEdge(e); // Just collapse edge e
Map1::collapseEdge(e) ; // Just collapse edge e
}
Dart f = phi1(d) ;
......@@ -130,11 +148,11 @@ Dart Map2::collapseEdge(Dart d, bool delDegenerateFaces)
if (f != d && delDegenerateFaces)
{
Map1::collapseEdge(d); // Collapse edge d
collapseDegeneratedFace(f); // and collapse its face if degenerated
Map1::collapseEdge(d) ; // Collapse edge d
collapseDegeneratedFace(f) ;// and collapse its face if degenerated
}
else
Map1::collapseEdge(d); // Just collapse edge d
Map1::collapseEdge(d) ; // Just collapse edge d
return resV ;
}
......
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