Commit 0f47b2ad authored by Lionel Untereiner's avatar Lionel Untereiner

Merge cgogn.unistra.fr:~/CGoGN

parents 31e15f74 b7e8bfa8
......@@ -66,7 +66,7 @@ Approximator<PFP,T,ORBIT>::Approximator(MAP& m, std::vector<VertexAttribute<T>*
template <typename PFP, typename T, unsigned int ORBIT>
Approximator<PFP,T,ORBIT>::~Approximator()
{
std::cout << "Approximator<PFP,T,ORBIT>::~Approximator()" << std::endl ;
// std::cout << "Approximator<PFP,T,ORBIT>::~Approximator()" << std::endl ;
for (unsigned int i = 0 ; i < m_attrV.size() ; ++i)
{
this->m_map.template removeAttribute(m_approx[i]) ;
......
......@@ -105,7 +105,10 @@ int decimate(
case A_hQEM :
// pos
approximators.push_back(new Approximator_QEMhalfEdge<PFP>(map, attribs)) ;
break ;
break ;
case A_OTHER:
break;
}
switch(s)
......@@ -155,9 +158,11 @@ int decimate(
case S_GeomColOptGrad:
selector = new EdgeSelector_GeomColOptGradient<PFP>(map, position, approximators) ;
break ;
case S_OTHER:
break;
}
int status = decimate(map, selector, approximators, nbWantedVertices, edgeErrors, callback_wrapper, callback_object) ;
int status = decimate<PFP>(map, selector, approximators, nbWantedVertices, true, edgeErrors, callback_wrapper, callback_object) ;
delete selector ;
......
......@@ -66,11 +66,9 @@ public:
SelectorType getType() { return S_MapOrder ; }
bool init() ;
bool nextEdge(Dart& d) const ;
void updateBeforeCollapse(Dart d)
{}
void updateBeforeCollapse(Dart /*d*/) {}
void updateAfterCollapse(Dart d2, Dart dd2) ;
void updateWithoutCollapse() { }
void updateWithoutCollapse() {}
} ;
......@@ -98,10 +96,8 @@ public:
SelectorType getType() { return S_Random ; }
bool init() ;
bool nextEdge(Dart& d) const ;
void updateBeforeCollapse(Dart d2)
{}
void updateBeforeCollapse(Dart /*d2*/) {}
void updateAfterCollapse(Dart d2, Dart dd2) ;
void updateWithoutCollapse();
} ;
......
......@@ -56,7 +56,7 @@ bool EdgeSelector_MapOrder<PFP>::nextEdge(Dart& d) const
}
template <typename PFP>
void EdgeSelector_MapOrder<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
void EdgeSelector_MapOrder<PFP>::updateAfterCollapse(Dart /*d2*/, Dart /*dd2*/)
{
typename PFP::MAP& m = this->m_map ;
cur = m.begin() ;
......@@ -111,7 +111,7 @@ bool EdgeSelector_Random<PFP>::nextEdge(Dart& d) const
}
template <typename PFP>
void EdgeSelector_Random<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
void EdgeSelector_Random<PFP>::updateAfterCollapse(Dart /*d2*/, Dart /*dd2*/)
{
typename PFP::MAP& m = this->m_map ;
allSkipped = false ;
......@@ -862,7 +862,7 @@ void EdgeSelector_NormalArea<PFP>::updateBeforeCollapse(Dart d)
}
template <typename PFP>
void EdgeSelector_NormalArea<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
void EdgeSelector_NormalArea<PFP>::updateAfterCollapse(Dart d2, Dart /*dd2*/)
{
typename PFP::MAP& m = this->m_map ;
......@@ -1310,7 +1310,7 @@ void EdgeSelector_CurvatureTensor<PFP>::updateBeforeCollapse(Dart d)
}
template <typename PFP>
void EdgeSelector_CurvatureTensor<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
void EdgeSelector_CurvatureTensor<PFP>::updateAfterCollapse(Dart d2, Dart /*dd2*/)
{
typename PFP::MAP& m = this->m_map ;
CellMarkerStore<EDGE> eMark (m);
......@@ -2062,7 +2062,7 @@ void EdgeSelector_GeomColOptGradient<PFP>::recomputeQuadric(const Dart d, const
}
template <typename PFP>
void EdgeSelector_GeomColOptGradient<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
void EdgeSelector_GeomColOptGradient<PFP>::updateAfterCollapse(Dart d2, Dart /*dd2*/)
{
typename PFP::MAP& m = this->m_map ;
......
......@@ -167,7 +167,7 @@ void HalfEdgeSelector_QEMml<PFP>::recomputeQuadric(const Dart d, const bool reco
}
template <typename PFP>
void HalfEdgeSelector_QEMml<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
void HalfEdgeSelector_QEMml<PFP>::updateAfterCollapse(Dart d2, Dart /*dd2*/)
{
MAP& m = this->m_map ;
......@@ -450,7 +450,7 @@ void HalfEdgeSelector_QEMextColor<PFP>::recomputeQuadric(const Dart d, const boo
}
template <typename PFP>
void HalfEdgeSelector_QEMextColor<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
void HalfEdgeSelector_QEMextColor<PFP>::updateAfterCollapse(Dart d2, Dart /*dd2*/)
{
MAP& m = this->m_map ;
......@@ -763,7 +763,7 @@ void HalfEdgeSelector_ColorGradient<PFP>::recomputeQuadric(const Dart d)
}
template <typename PFP>
void HalfEdgeSelector_ColorGradient<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
void HalfEdgeSelector_ColorGradient<PFP>::updateAfterCollapse(Dart d2, Dart /*dd2*/)
{
MAP& m = this->m_map ;
......
......@@ -99,7 +99,7 @@ public:
virtual void updateAfterCollapse(Dart d2, Dart dd2) = 0 ;
virtual void updateWithoutCollapse() = 0;
virtual void getEdgeErrors(EdgeAttribute<typename PFP::REAL> *errors) const
virtual void getEdgeErrors(EdgeAttribute<typename PFP::REAL>* /*errors*/) const
{
std::cout << "WARNING:: getEdgeErrors was not overridden" << std::endl ;
}
......
......@@ -284,6 +284,15 @@ void computeCentroidELWVolumes(typename PFP::MAP& map, const VertexAttribute<typ
}
template <typename PFP>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid, unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map, thread) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
vertex_centroid[d] = Volume::Geometry::vertexNeighborhoodCentroid<PFP>(map, d, position) ;
}
namespace Parallel
{
template <typename PFP>
......
......@@ -533,7 +533,7 @@ void normalCycles_SortAndSetEigenComponents(
typename PFP::VEC3& Kmin,
typename PFP::VEC3& Knormal,
const typename PFP::VEC3& normal,
unsigned int thread)
unsigned int /*thread*/)
{
// sort eigen components : ev[inormal] has minimal absolute value ; kmin = ev[imin] <= ev[imax] = kmax
int inormal=0, imin, imax ;
......@@ -563,7 +563,7 @@ void normalCycles_SortAndSetEigenComponents(
}
template <typename PFP>
void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsigned int thread)
void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsigned int /*thread*/)
{
typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ;
......
......@@ -86,11 +86,11 @@ public :
bool isRightDFace(VEC3 c, Dart d, VEC3 base, VEC3 normal);
Dart nextDartOfVertexNotMarked(Dart d, CellMarkerGen& mark);
Dart nextDartOfVertexNotMarked(Dart d, CellMarkerStore<FACE>& mark);
Dart nextNonPlanar(Dart d);
Dart nextFaceNotMarked(Dart d,CellMarkerGen& mark);
Dart nextFaceNotMarked(Dart d,CellMarkerStore<FACE>& mark);
Geom::Orientation3D whichSideOfEdge(VEC3 c, Dart d);
......
......@@ -153,7 +153,7 @@ bool ParticleCell3D<PFP>::isRightDFace(VEC3 c, Dart d, VEC3 base, VEC3 normal)
template <typename PFP>
Dart ParticleCell3D<PFP>::nextDartOfVertexNotMarked(Dart d, CellMarkerGen& mark)
Dart ParticleCell3D<PFP>::nextDartOfVertexNotMarked(Dart d, CellMarkerStore<FACE>& mark)
{
// lock a marker
Dart d1;
......@@ -257,7 +257,7 @@ Dart ParticleCell3D<PFP>::nextNonPlanar(Dart d)
}
template <typename PFP>
Dart ParticleCell3D<PFP>::nextFaceNotMarked(Dart d, CellMarkerGen& mark)
Dart ParticleCell3D<PFP>::nextFaceNotMarked(Dart d, CellMarkerStore<FACE>& mark)
{
// lock a marker
Dart d1;
......
/*******************************************************************************
* 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 *
* *
*******************************************************************************/
#ifndef __MR_DOOSABIN_MASK__
#define __MR_DOOSABIN_MASK__
#include <cmath>
namespace CGoGN
{
namespace Algo
{
namespace Surface
{
namespace MR
{
namespace Dual
{
namespace Filters
{
template <typename PFP>
class DooSabinVertexSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
public:
DooSabinVertexSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
{}
void operator() ()
{
for (Dart dV = m_map.begin(); dV != m_map.end(); m_map.next(dV))
{
typename PFP::VEC3 p(0.0);
unsigned int N = m_map.faceDegree(dV);
typename PFP::REAL K0 = float(N+5)/float(4*N);//(1.0 / 4.0) + (5.0 / 4.0) * double(N);
p += K0 * m_position[dV];
unsigned int j = 1;
Dart tmp = m_map.phi1(dV);
do
{
typename PFP::REAL Kj = (3.0 + 2.0 * cos(2.0 * double(j) * M_PI / double(N))) / (4.0 * N);
p += Kj * m_position[tmp];
tmp = m_map.phi1(tmp);
++j;
}while(tmp != dV);
m_map.incCurrentLevel();
m_position[dV] = p;
m_map.decCurrentLevel();
}
}
} ;
} // namespace Masks
} // namespace Primal
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
#endif
......@@ -43,7 +43,7 @@ namespace Regular
template <typename PFP>
Map2MR<PFP>::Map2MR(typename PFP::MAP& map) :
m_map(map),
shareVertexEmbeddings(true)
shareVertexEmbeddings(false)
{
}
......@@ -68,58 +68,68 @@ void Map2MR<PFP>::addNewLevel(bool embedNewVertices)
m_map.addLevelBack() ;
m_map.duplicateDarts(m_map.getMaxLevel());
m_map.setCurrentLevel(m_map.getMaxLevel()-1) ;
m_map.setCurrentLevel(m_map.getMaxLevel()) ;
TraversorV<typename PFP::MAP> travV(m_map) ;
for (Dart d = travV.begin(); d != travV.end(); d = travV.next())
m_map.decCurrentLevel();
TraversorE<typename PFP::MAP> te(m_map);
for (Dart d = te.begin(); d != te.end(); d = te.next())
{
//create new faces in the previous edges
unsigned int count = 0;
Dart ditv = d;
do
m_map.incCurrentLevel();
Dart d2 = m_map.phi2(d);
m_map.unsewFaces(d,false);
Dart nf = m_map.newFace(4,false);
m_map.sewFaces(d,nf,false);
m_map.sewFaces(d2,m_map.phi1(m_map.phi1(nf)),false);
// take care of edge embedding
if(m_map.template isOrbitEmbedded<EDGE>())
{
Dart d2 = m_map.phi2(ditv);
m_map.template setOrbitEmbedding<EDGE>(nf, m_map.template getEmbedding<EDGE>(d));
m_map.template setOrbitEmbedding<EDGE>(m_map.phi1(m_map.phi1(nf)), m_map.template getEmbedding<EDGE>(d2));
}
m_map.decCurrentLevel();
}
TraversorV<typename PFP::MAP> tv(m_map);
for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
{
m_map.incCurrentLevel();
m_map.incCurrentLevel();
m_map.PFP::MAP::TOPO_MAP::closeHole(m_map.phi1(m_map.phi2(d)),false);
if(m_map.phi2(d) == d2)
Dart temp = m_map.phi2(m_map.phi1(m_map.phi2(d)));
Dart stop = temp;
do
{
if(m_map.template isOrbitEmbedded<EDGE>())
{
m_map.template setOrbitEmbedding<EDGE>(temp, m_map.template getEmbedding<EDGE>( m_map.phi2(temp)));
}
m_map.unsewFaces(d, false);
Dart nf = m_map.newFace(4,false);
m_map.sewFaces(nf,d,false);
m_map.sewFaces(m_map.phi1(m_map.phi1(nf)),d2,false);
if(!shareVertexEmbeddings)
{
//if(m_map.template getEmbedding<VERTEX>(d) == EMBNULL)
m_map.template setOrbitEmbeddingOnNewCell<VERTEX>(temp) ;
//m_map.template setOrbitEmbeddingOnNewCell<VERTEX>(d2) ;
}
m_map.decCurrentLevel();
++count;
ditv = m_map.phi2(m_map.phi_1(ditv));
}while(ditv != d);
// // create new faces in the previous vertices
// Dart nf = m_map.newFace(count,false);
// do
// {
// m_map.incCurrentLevel();
//
// Dart d21 = m_map.phi1(m_map.phi2(ditv));
// m_map.sewFaces(nf,d21,false);
//
// if(embedNewVertices)
// m_map.template embedNewCell<VERTEX>(nf) ;
//
// nf = m_map.phi1(nf);
//
// m_map.decCurrentLevel();
//
//
// ditv = m_map.phi2(m_map.phi_1(ditv));
// }while(ditv != d);
temp = m_map.phi1(temp);
}
while(temp != stop);
m_map.decCurrentLevel();
}
m_map.incCurrentLevel() ;
m_map.popLevel() ;
}
......
/*******************************************************************************
* 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 *
* *
*******************************************************************************/
#ifndef __MR_DOOSABIN_MASK__
#define __MR_DOOSABIN_MASK__
#include <cmath>
namespace CGoGN
{
namespace Algo
{
namespace Volume
{
namespace MR
{
namespace Dual
{
namespace Filters
{
template <typename PFP>
class DooSabinVertexSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
public:
DooSabinVertexSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
{}
void operator() ()
{
// TraversorV<typename PFP::MAP> tv(m_map);
// for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
// {
// if(m_map.isBoundaryVertex(d))
// {
// Dart db = m_map.findBoundaryFaceOfVertex(d);
//
// typename PFP::VEC3 p(0.0);
//
// unsigned int N = m_map.faceDegree(db);
// typename PFP::REAL K0 = float(N+5)/float(4*N);//(1.0 / 4.0) + (5.0 / 4.0) * double(N);
// p += K0 * m_position[db];
// unsigned int j = 1;
// Dart tmp = m_map.phi1(db);
// do
// {
// typename PFP::REAL Kj = (3.0 + 2.0 * cos(2.0 * double(j) * M_PI / double(N))) / (4.0 * N);
// p += Kj * m_position[tmp];
// tmp = m_map.phi1(tmp);
// ++j;
// }while(tmp != db);
//
// m_map.incCurrentLevel();
//
// m_position[db] = p;
//
// m_map.decCurrentLevel();
//
// }
// else
// {
// Traversor3VW<typename PFP::MAP> tvw(m_map,d);
// for(Dart dit = tvw.begin() ; dit != tvw.end() ; dit = tvw.next())
// {
// typename PFP::VEC3 p(0.0);
// unsigned int count = 0;
//
// Dart ditface = dit;
// do
// {
// typename PFP::VEC3 tmpP(0.0);
// unsigned int N = m_map.faceDegree(ditface);
// typename PFP::REAL K0 = float(N+5)/float(4*N);//(1.0 / 4.0) + (5.0 / 4.0) * double(N);
// tmpP += K0 * m_position[ditface];
// unsigned int j = 1;
// Dart tmp = m_map.phi1(ditface);
// do
// {
// typename PFP::REAL Kj = (3.0 + 2.0 * cos(2.0 * double(j) * M_PI / double(N))) / (4.0 * N);
// tmpP += Kj * m_position[tmp];
// tmp = m_map.phi1(tmp);
// ++j;
// }while(tmp != ditface);
//
// p += tmpP;
// ++count;
// ditface = m_map.phi2(m_map.phi_1(ditface));
// }
// while(ditface != dit);
//
// p /= count;
//
// m_map.incCurrentLevel();
//
// m_position[dit] = p;
//
// m_map.decCurrentLevel();
// }
// }
// }
}
} ;
} // namespace Masks
} // namespace Dual
} // namespace MR
} // namespace Volume
} // namespace Algo
} // namespace CGoGN
#endif
......@@ -363,13 +363,15 @@ public:
{
typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ;
Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
m_position[midV] = p ;
if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d))
{
m_map.incCurrentLevel() ;
m_map.decCurrentLevel() ;
Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d)));
m_position[midV] = p ;
m_map.decCurrentLevel() ;
}
}
}
} ;
......@@ -431,7 +433,6 @@ public:
m_position[midV] = p;
m_map.decCurrentLevel() ;
}
}
} ;
......
/*******************************************************************************
* 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 *
* *
*******************************************************************************/
#ifndef __MAP3MR_DUAL_REGULAR__
#define __MAP3MR_DUAL_REGULAR__
#include "Topology/map/embeddedMap3.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor3.h"
#include "Algo/Multiresolution/filter.h"
namespace CGoGN
{
namespace Algo
{
namespace Volume
{