Commit fa461dc7 authored by thomas's avatar thomas

Merge branch 'feature-trimap' of git@icube-forge.unistra.fr:untereiner/cgogn.git into develop

parents adf3778e 29f7de99
......@@ -190,6 +190,9 @@ void MyQT::cb_Open()
// }
// SelectorDartNoBoundary<MAP> nb(myMap);
myMap.check();
m_topo_render->updateData(myMap, position, 0.8f, 0.8f, 0.8f);
m_explode_render->updateData<PFP>(myMap, position, color);
......
......@@ -646,8 +646,6 @@ Dart swapGen3To2(typename PFP::MAP& map, Dart d)
Dart stop = map.phi1(map.phi2(map.phi_1(d)));
if(map.deleteEdge(d) == NIL)
{
std::cout << "boundary" << std::endl;
std::vector<Dart> edges;
Dart dbegin = map.findBoundaryFaceOfEdge(d);
Traversor3EW<typename PFP::MAP> t(map, d);
......@@ -663,11 +661,23 @@ Dart swapGen3To2(typename PFP::MAP& map, Dart d)
map.template copyDartEmbedding<VERTEX>(d, map.phi1(e)) ;
map.template copyDartEmbedding<VERTEX>(e, map.phi1(d)) ;
if (map.template isOrbitEmbedded<FACE>())
{
map.template copyDartEmbedding<FACE>(map.phi1(d), d) ;
map.template copyDartEmbedding<FACE>(map.phi1(e), e) ;
}
d = map.phi3(dbegin);
e = map.phi2(d);
map.flipEdge(d);
map.template copyDartEmbedding<VERTEX>(d, map.phi1(e)) ;
map.template copyDartEmbedding<VERTEX>(e, map.phi1(d)) ;
if (map.template isOrbitEmbedded<FACE>())
{
map.template copyDartEmbedding<FACE>(map.phi_1(d), d) ;
map.template copyDartEmbedding<FACE>(map.phi_1(e), e) ;
}
}
std::vector<Dart> edges;
......@@ -716,8 +726,6 @@ std::vector<Dart> swapGen3To2Optimized(typename PFP::MAP& map, Dart d)
Dart stop = map.phi1(map.phi2(map.phi_1(d)));
if(map.deleteEdge(d) == NIL)
{
std::cout << "boundary" << std::endl;
std::vector<Dart> edges;
Dart dbegin = map.findBoundaryFaceOfEdge(d);
Traversor3EW<typename PFP::MAP> t(map, d);
......@@ -733,11 +741,23 @@ std::vector<Dart> swapGen3To2Optimized(typename PFP::MAP& map, Dart d)
map.template copyDartEmbedding<VERTEX>(d, map.phi1(e)) ;
map.template copyDartEmbedding<VERTEX>(e, map.phi1(d)) ;
if (map.template isOrbitEmbedded<FACE>())
{
map.template copyDartEmbedding<FACE>(map.phi1(d), d) ;
map.template copyDartEmbedding<FACE>(map.phi1(e), e) ;
}
d = map.phi3(dbegin);
e = map.phi2(d);
map.flipEdge(d);
map.template copyDartEmbedding<VERTEX>(d, map.phi1(e)) ;
map.template copyDartEmbedding<VERTEX>(e, map.phi1(d)) ;
if (map.template isOrbitEmbedded<FACE>())
{
map.template copyDartEmbedding<FACE>(map.phi_1(d), d) ;
map.template copyDartEmbedding<FACE>(map.phi_1(e), e) ;
}
}
std::vector<Dart> edges;
......
This diff is collapsed.
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace CGoGN
{
namespace Simplex
{
template <typename MAP_IMPL>
inline void Map2<MAP_IMPL>::init()
{
MAP_IMPL::addInvolution() ;
}
template <typename MAP_IMPL>
inline Map2<MAP_IMPL>::Map2() : MapCommon<MAP_IMPL>()
{
init() ;
}
template <typename MAP_IMPL>
inline std::string Map2<MAP_IMPL>::mapTypeName() const
{
return "Map2" ;
}
template <typename MAP_IMPL>
inline unsigned int Map2<MAP_IMPL>::dimension() const
{
return 2 ;
}
template <typename MAP_IMPL>
inline void Map2<MAP_IMPL>::clear(bool removeAttrib)
{
ParentMap::clear(removeAttrib) ;
if (removeAttrib)
init() ;
}
template <typename MAP_IMPL>
inline unsigned int Map2<MAP_IMPL>::getNbInvolutions() const
{
return 1;
}
template <typename MAP_IMPL>
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
} // namespace CGoGN
......@@ -77,7 +77,7 @@ Dart EmbeddedMap3::cutEdge(Dart d)
// if(isOrbitEmbedded<VERTEX>())
// {
// initOrbitEmbeddingNewCell<VERTEX>(nd) ;
// initOrbitEmbeddingOnNewCell<VERTEX>(nd) ;
// }
if(isOrbitEmbedded<EDGE>())
......@@ -235,7 +235,7 @@ void EmbeddedMap3::splitFace(Dart d, Dart e)
// if(isOrbitEmbedded<EDGE>())
// {
// initOrbitEmbeddingNewCell<EDGE>(phi_1(d)) ;
// initOrbitEmbeddingOnNewCell<EDGE>(phi_1(d)) ;
// }
if(isOrbitEmbedded<FACE2>())
......@@ -479,6 +479,12 @@ void EmbeddedMap3::splitVolume(std::vector<Dart>& vd)
}
}
// if(isOrbitEmbedded<FACE>())
// {
// Dart v = vd.front() ;
// initOrbitEmbeddingNewCell<FACE>(phi2(v));
// }
if(isOrbitEmbedded<VOLUME>())
{
Dart v = vd.front() ;
......
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