Commit ab4e079a authored by Pierre Kraemer's avatar Pierre Kraemer

add some Cell typing

parent d944530c
......@@ -35,7 +35,8 @@ public:
virtual void select(Dart d, bool emitSignal = true) = 0;
virtual void unselect(Dart d, bool emitSignal = true) = 0;
inline void select(const std::vector<Dart>& d)
template <unsigned int ORBIT>
inline void select(const std::vector<Cell<ORBIT> >& d)
{
for(unsigned int i = 0; i < d.size(); ++i)
select(d[i], false);
......@@ -47,7 +48,8 @@ public:
}
}
inline void unselect(const std::vector<Dart>& d)
template <unsigned int ORBIT>
inline void unselect(const std::vector<Cell<ORBIT> >& d)
{
for(unsigned int i = 0; i < d.size(); ++i)
unselect(d[i], false);
......
......@@ -63,7 +63,7 @@ void computeCurvatureVertices_QuadraticFitting(
template <typename PFP>
void computeCurvatureVertex_QuadraticFitting(
typename PFP::MAP& map,
Dart dart,
Vertex v,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& kmax,
......@@ -74,7 +74,7 @@ void computeCurvatureVertex_QuadraticFitting(
template <typename PFP>
void vertexQuadraticFitting(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::MATRIX33& localFrame,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -104,7 +104,8 @@ template <typename PFP>
void cubicFittingAddVertexNormal(typename PFP::VEC3& v, typename PFP::VEC3& n, typename PFP::VEC3& p, typename PFP::MATRIX33& localFrame) ;
*/
/* normal cycles by [ACDLD03] : useful for parallel computing*/
/* normal cycles by [ACDLD03] : useful for parallel computing */
template <typename PFP>
void computeCurvatureVertices_NormalCycles(
typename PFP::MAP& map,
......@@ -122,7 +123,7 @@ void computeCurvatureVertices_NormalCycles(
template <typename PFP>
void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -174,7 +175,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -204,8 +205,7 @@ void computeCurvatureVertices_NormalCycles(
template <typename PFP>
void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map,
Dart dart,
Vertex v,
Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -233,8 +233,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map,
Dart dart,
Vertex v,
Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......
......@@ -50,14 +50,14 @@ void computeCurvatureVertices_QuadraticFitting(
VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& Kmin)
{
TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
computeCurvatureVertex_QuadraticFitting<PFP>(map, d, position, normal, kmax, kmin, Kmax, Kmin) ;
for(Vertex v = t.begin(); v != t.end(); v = t.next())
computeCurvatureVertex_QuadraticFitting<PFP>(map, v, position, normal, kmax, kmin, Kmax, Kmin) ;
}
template <typename PFP>
void computeCurvatureVertex_QuadraticFitting(
typename PFP::MAP& map,
Dart dart,
Vertex v,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& kmax,
......@@ -69,17 +69,17 @@ void computeCurvatureVertex_QuadraticFitting(
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::MATRIX33 MATRIX33 ;
VEC3 n = normal[dart] ;
VEC3 n = normal[v] ;
MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame<PFP>(map, dart, position, n) ;
MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame<PFP>(map, v, position, n) ;
MATRIX33 invLocalFrame ;
localFrame.invert(invLocalFrame) ;
REAL a, b, c, d, e;
//vertexCubicFitting(map,dart,localFrame,a,b,c,d,e,f,g,h,i) ;
vertexQuadraticFitting<PFP>(map, dart, localFrame, position, normal, a, b, c, d, e) ;
vertexQuadraticFitting<PFP>(map, v, localFrame, position, normal, a, b, c, d, e) ;
REAL kmax_v, kmin_v, Kmax_x, Kmax_y ;
// REAL kmax_v, kmin_v, Kmax_x, Kmax_y ;
// /*int res = */slaev2_(&a, &b, &c, &kmax_v, &kmin_v, &Kmax_x, &Kmax_y) ;
Eigen::Matrix<REAL,2,2> m;
......@@ -89,8 +89,8 @@ void computeCurvatureVertex_QuadraticFitting(
Eigen::SelfAdjointEigenSolver<Eigen::Matrix<REAL,2,2> > solver(m);
const Eigen::Matrix<REAL,2,1>& ev = solver.eigenvalues();
kmax_v = ev[0];
kmin_v = ev[1];
REAL kmax_v = ev[0];
REAL kmin_v = ev[1];
const Eigen::Matrix<REAL,2,2>& evec = solver.eigenvectors();
VEC3 Kmax_v(evec(0,0), evec(1,0), 0.0f) ;
......@@ -101,30 +101,30 @@ void computeCurvatureVertex_QuadraticFitting(
if (kmax_v < kmin_v)
{
kmax[dart] = -kmax_v ;
kmin[dart] = -kmin_v ;
Kmax[dart] = Kmax_v ;
Kmin[dart] = Kmin_v ;
kmax[v] = -kmax_v ;
kmin[v] = -kmin_v ;
Kmax[v] = Kmax_v ;
Kmin[v] = Kmin_v ;
}
else
{
kmax[dart] = -kmin_v ;
kmin[dart] = -kmax_v ;
Kmax[dart] = Kmin_v ;
Kmin[dart] = Kmax_v ;
kmax[v] = -kmin_v ;
kmin[v] = -kmax_v ;
Kmax[v] = Kmin_v ;
Kmin[v] = Kmax_v ;
}
}
template <typename PFP>
void vertexQuadraticFitting(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::MATRIX33& localFrame,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
float& a, float& b, float& c, float& d, float& e)
{
typename PFP::VEC3 p = position[dart] ;
typename PFP::VEC3 p = position[v] ;
NLContext nlContext = nlNewContext() ;
nlMakeCurrent(nlContext) ;
......@@ -132,14 +132,12 @@ void vertexQuadraticFitting(
nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE) ;
nlBegin(NL_SYSTEM) ;
nlBegin(NL_MATRIX) ;
Traversor2VVaE<typename PFP::MAP> tav(map, dart) ;
for(Dart it = tav.begin(); it != tav.end(); it = tav.next())
{
typename PFP::VEC3 v = position[it] ;
quadraticFittingAddVertexPos<PFP>(v, p, localFrame) ;
typename PFP::VEC3 n = normal[it] ;
quadraticFittingAddVertexNormal<PFP>(v, n, p, localFrame) ;
}
foreach_adjacent2<EDGE>(map, v, [&] (Vertex it) {
typename PFP::VEC3 itp = position[it] ;
quadraticFittingAddVertexPos<PFP>(v, itp, localFrame) ;
typename PFP::VEC3 itn = normal[it] ;
quadraticFittingAddVertexNormal<PFP>(itp, itn, p, localFrame) ;
});
nlEnd(NL_MATRIX) ;
nlEnd(NL_SYSTEM) ;
nlSolve() ;
......@@ -303,14 +301,14 @@ void computeCurvatureVertices_NormalCycles(
unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
computeCurvatureVertex_NormalCycles<PFP>(map, d, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
for(Vertex v = t.begin(); v != t.end(); v = t.next())
computeCurvatureVertex_NormalCycles<PFP>(map, v, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
}
template <typename PFP>
void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -330,17 +328,17 @@ void computeCurvatureVertex_NormalCycles(
// collect the normal cycle tensor
Selection::Collector_WithinSphere<PFP> neigh(map, position, radius, thread) ;
neigh.collectAll(dart) ;
neigh.collectAll(v) ;
MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle,tensor);
neigh.computeNormalCyclesTensor(position, edgeangle, tensor);
// solve eigen problem
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor));
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[dart],kmin[dart],Kmax[dart],Kmin[dart],Knormal[dart],normal[dart],thread);
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v],thread);
// if (dart.index % 15000 == 0)
// {
......@@ -368,14 +366,14 @@ void computeCurvatureVertices_NormalCycles_Projected(
unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
computeCurvatureVertex_NormalCycles_Projected<PFP>(map, d, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
for(Vertex v = t.begin(); v.dart != t.end(); v = t.next())
computeCurvatureVertex_NormalCycles_Projected<PFP>(map, v, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal, thread) ;
}
template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map,
Dart dart,
Vertex v,
typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......@@ -395,26 +393,26 @@ void computeCurvatureVertex_NormalCycles_Projected(
// collect the normal cycle tensor
Selection::Collector_WithinSphere<PFP> neigh(map, position, radius, thread) ;
neigh.collectAll(dart) ;
neigh.collectAll(v) ;
MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle,tensor);
neigh.computeNormalCyclesTensor(position, edgeangle, tensor);
// project the tensor
normalCycles_ProjectTensor<PFP>(tensor,normal[dart],thread);
normalCycles_ProjectTensor<PFP>(tensor, normal[v], thread);
// solve eigen problem
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor));
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[dart],kmin[dart],Kmax[dart],Kmin[dart],Knormal[dart],normal[dart],thread);
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v],thread);
}
template <typename PFP>
void computeCurvatureVertices_NormalCycles(
typename PFP::MAP& map,
Selection::Collector<PFP> & neigh,
Algo::Surface::Selection::Collector<PFP>& neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle,
......@@ -426,15 +424,14 @@ void computeCurvatureVertices_NormalCycles(
unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
computeCurvatureVertex_NormalCycles<PFP>(map, d, neigh, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
for(Vertex v = t.begin(); v != t.end(); v = t.next())
computeCurvatureVertex_NormalCycles<PFP>(map, v, neigh, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
}
template <typename PFP>
void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map,
Dart dart,
Selection::Collector<PFP> & neigh,
Vertex v,
Algo::Surface::Selection::Collector<PFP>& neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle,
......@@ -452,23 +449,23 @@ void computeCurvatureVertex_NormalCycles(
typedef Eigen::Matrix<REAL,3,3,Eigen::RowMajor> E_MATRIX;
// collect the normal cycle tensor
neigh.collectAll(dart) ;
neigh.collectAll(v) ;
MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle,tensor);
neigh.computeNormalCyclesTensor(position, edgeangle, tensor);
// solve eigen problem
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor));
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[dart],kmin[dart],Kmax[dart],Kmin[dart],Knormal[dart],normal[dart],thread);
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v],thread);
}
template <typename PFP>
void computeCurvatureVertices_NormalCycles_Projected(
typename PFP::MAP& map,
Selection::Collector<PFP> & neigh,
Algo::Surface::Selection::Collector<PFP>& neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle,
......@@ -480,15 +477,14 @@ void computeCurvatureVertices_NormalCycles_Projected(
unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
computeCurvatureVertex_NormalCycles_Projected<PFP>(map, d, neigh, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
for(Vertex v = t.begin(); v != t.end(); v = t.next())
computeCurvatureVertex_NormalCycles_Projected<PFP>(map, v, neigh, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
}
template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map,
Dart dart,
Selection::Collector<PFP> & neigh,
Vertex v,
Algo::Surface::Selection::Collector<PFP>& neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle,
......@@ -506,20 +502,20 @@ void computeCurvatureVertex_NormalCycles_Projected(
typedef Eigen::Matrix<REAL,3,3,Eigen::RowMajor> E_MATRIX;
// collect the normal cycle tensor
neigh.collectAll(dart) ;
neigh.collectAll(v) ;
MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle,tensor);
neigh.computeNormalCyclesTensor(position, edgeangle, tensor);
// project the tensor
normalCycles_ProjectTensor<PFP>(tensor,normal[dart],thread);
normalCycles_ProjectTensor<PFP>(tensor, normal[v], thread);
// solve eigen problem
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor));
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[dart],kmin[dart],Kmax[dart],Kmin[dart],Knormal[dart],normal[dart],thread);
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v],thread);
}
template <typename PFP>
......@@ -535,7 +531,7 @@ void normalCycles_SortAndSetEigenComponents(
unsigned int /*thread*/)
{
// sort eigen components : ev[inormal] has minimal absolute value ; kmin = ev[imin] <= ev[imax] = kmax
int inormal=0, imin, imax ;
int inormal = 0, imin, imax ;
if (fabs(e_val[1]) < fabs(e_val[inormal])) inormal = 1;
if (fabs(e_val[2]) < fabs(e_val[inormal])) inormal = 2;
imin = (inormal + 1) % 3;
......@@ -562,7 +558,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 ;
......@@ -571,12 +567,12 @@ void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsi
typedef Eigen::Matrix<REAL,3,3,Eigen::RowMajor> E_MATRIX;
// compute eigen components
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor));
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& e_val = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& e_vec = Utils::convertRef<MATRIX>(solver.eigenvectors());
// switch kmin and kmax w.r.t. Kmin and Kmax
int inormal=0, imin, imax ;
int inormal = 0, imin, imax ;
if (fabs(e_val[1]) < fabs(e_val[inormal])) inormal = 1;
if (fabs(e_val[2]) < fabs(e_val[inormal])) inormal = 2;
imin = (inormal + 1) % 3;
......@@ -595,11 +591,11 @@ void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsi
}
template <typename PFP>
void normalCycles_ProjectTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, const typename PFP::VEC3& normal_vector, unsigned int thread)
void normalCycles_ProjectTensor(Geom::Matrix<3,3,typename PFP::REAL>& tensor, const typename PFP::VEC3& normal_vector, unsigned int thread)
{
Geom::Matrix<3,3,typename PFP::REAL> proj;
proj.identity();
proj -= Geom::transposed_vectors_mult(normal_vector,normal_vector);
proj -= Geom::transposed_vectors_mult(normal_vector, normal_vector);
tensor = proj * tensor * proj;
}
......
......@@ -67,9 +67,9 @@ protected:
bool isInsideCollected;
std::vector<Dart> insideVertices;
std::vector<Dart> insideEdges;
std::vector<Dart> insideFaces;
std::vector<Vertex> insideVertices;
std::vector<Edge> insideEdges;
std::vector<Face> insideFaces;
std::vector<Dart> border;
public:
......@@ -105,9 +105,9 @@ public:
inline Dart getCenterDart() const { return centerDart; }
inline const std::vector<Dart>& getInsideVertices() const { assert(isInsideCollected || !"getInsideVertices: inside cells have not been collected.") ; return insideVertices; }
inline const std::vector<Dart>& getInsideEdges() const { assert(isInsideCollected || !"getInsideEdges: inside cells have not been collected.") ; return insideEdges; }
inline const std::vector<Dart>& getInsideFaces() const { assert(isInsideCollected || !"getInsideFaces: inside cells have not been collected.") ; return insideFaces; }
inline const std::vector<Vertex>& getInsideVertices() const { assert(isInsideCollected || !"getInsideVertices: inside cells have not been collected.") ; return insideVertices; }
inline const std::vector<Edge>& getInsideEdges() const { assert(isInsideCollected || !"getInsideEdges: inside cells have not been collected.") ; return insideEdges; }
inline const std::vector<Face>& getInsideFaces() const { assert(isInsideCollected || !"getInsideFaces: inside cells have not been collected.") ; return insideFaces; }
inline const std::vector<Dart>& getBorder() const { return border; }
inline unsigned int getNbInsideVertices() const { assert(isInsideCollected || !"getNbInsideVertices: inside cells have not been collected.") ; return insideVertices.size(); }
......@@ -118,12 +118,19 @@ public:
template <typename PPFP>
friend std::ostream& operator<<(std::ostream &out, const Collector<PPFP>& c);
virtual REAL computeArea (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/) {
virtual REAL computeArea (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/)
{
assert(!"Warning: Collector<PFP>::computeArea() should be overloaded in non-virtual derived classes");
return 0.0;
}
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/, const EdgeAttribute<REAL, MAP_IMPL>& /*edgeangle*/, typename PFP::MATRIX33&) {assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes"); }
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/, typename PFP::MATRIX33&) {assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes"); }
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/, const EdgeAttribute<REAL, MAP_IMPL>& /*edgeangle*/, typename PFP::MATRIX33&)
{
assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes");
}
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& /*pos*/, typename PFP::MATRIX33&)
{
assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes");
}
};
/*********************************************************
......@@ -186,8 +193,9 @@ public:
void collectBorder(Dart d);
REAL computeArea(const VertexAttribute<VEC3, MAP_IMPL>& pos);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& pos, const EdgeAttribute<REAL, MAP_IMPL>&edgeangle, typename PFP::MATRIX33&);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& pos, const EdgeAttribute<REAL, MAP_IMPL>& edgeangle, typename PFP::MATRIX33&);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& pos, typename PFP::MATRIX33&);
};
/*********************************************************
......@@ -345,7 +353,7 @@ public :
}
};
// tests if the angle between vertex normals is below some threshold
// tests if the angle between triangle normals is below some threshold
template <typename PFP>
class CollectorCriterion_TriangleNormalAngle : public CollectorCriterion
{
......@@ -422,7 +430,6 @@ public:
Collector<PFP>(m, thread),
crit(c)
{}
void collectAll(Dart d);
void collectBorder(Dart d);
};
......@@ -450,7 +457,6 @@ public:
Collector_Triangles(typename PFP::MAP& m, CollectorCriterion& c, unsigned int thread = 0) :
Collector<PFP>(m,thread), crit(c)
{}
void collectAll(Dart d) ;
void collectBorder(Dart d) ;
};
......
......@@ -50,8 +50,8 @@ template <typename PFP>
inline bool Collector<PFP>::applyOnInsideVertices(FunctorType& f)
{
assert(isInsideCollected || !"applyOnInsideVertices: inside cells have not been collected.") ;
for(std::vector<Dart>::iterator iv = insideVertices.begin(); iv != insideVertices.end(); ++iv)
if(f(*iv))
for(std::vector<Vertex>::iterator iv = insideVertices.begin(); iv != insideVertices.end(); ++iv)
if(f((*iv).dart))
return true ;
return false ;
}
......@@ -60,8 +60,8 @@ template <typename PFP>
inline bool Collector<PFP>::applyOnInsideEdges(FunctorType& f)
{
assert(isInsideCollected || !"applyOnInsideEdges: inside cells have not been collected.") ;
for(std::vector<Dart>::iterator iv = insideEdges.begin(); iv != insideEdges.end(); ++iv)
if(f(*iv))
for(std::vector<Edge>::iterator iv = insideEdges.begin(); iv != insideEdges.end(); ++iv)
if(f((*iv).dart))
return true ;
return false ;
}
......@@ -70,8 +70,8 @@ template <typename PFP>
inline bool Collector<PFP>::applyOnInsideFaces(FunctorType& f)
{
assert(isInsideCollected || !"applyOnInsideFaces: inside cells have not been collected.") ;
for(std::vector<Dart>::iterator iv = insideFaces.begin(); iv != insideFaces.end(); ++iv)
if(f(*iv))
for(std::vector<Face>::iterator iv = insideFaces.begin(); iv != insideFaces.end(); ++iv)
if(f((*iv).dart))
return true ;
return false ;
}
......@@ -117,18 +117,14 @@ void Collector_OneRing<PFP>::collectAll(Dart d)
this->insideFaces.reserve(16);
this->border.reserve(16);
this->insideVertices.push_back(this->centerDart);
Traversor2VE<typename PFP::MAP> te(this->map, this->centerDart) ;
for(Dart it = te.begin(); it != te.end(); it = te.next())
this->insideEdges.push_back(it);
this->insideVertices.push_back(d);
Traversor2VF<typename PFP::MAP> tf(this->map, this->centerDart) ;
for(Dart it = tf.begin(); it != tf.end(); it = tf.next())
foreach_incident2<EDGE>(this->map, d, [&] (Edge e)
{
this->insideFaces.push_back(it);
this->border.push_back(this->map.phi1(it));
}
this->insideEdges.push_back(e);
this->insideFaces.push_back(e.dart);
this->border.push_back(this->map.phi1(e.dart));
});
}
template <typename PFP>
......@@ -137,9 +133,10 @@ void Collector_OneRing<PFP>::collectBorder(Dart d)
this->init(d);
this->border.reserve(12);
Traversor2VF<typename PFP::MAP> t(this->map, this->centerDart) ;
for(Dart it = t.begin(); it != t.end(); it = t.next())
this->border.push_back(this->map.phi1(it));
foreach_incident2<FACE>(this->map, d, [&] (Face f)
{
this->border.push_back(this->map.phi1(f.dart));
});
}
template <typename PFP>
......@@ -156,7 +153,8 @@ typename PFP::REAL Collector_OneRing<PFP>::computeArea(const VertexAttribute<VEC
}
template <typename PFP>
void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& pos, const EdgeAttribute<REAL, MAP_IMPL>& edgeangle, typename PFP::MATRIX33& tensor){
void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& pos, const EdgeAttribute<REAL, MAP_IMPL>& edgeangle, typename PFP::MATRIX33& tensor)
{
assert(this->isInsideCollected || !"computeNormalCyclesTensor: inside cells have not been collected.") ;
tensor.zero() ;
......@@ -181,7 +179,8 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
}
template <typename PFP>
void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& pos, typename PFP::MATRIX33& tensor){
void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP_IMPL>& pos, typename PFP::MATRIX33& tensor)
{
assert(this->isInsideCollected || !"computeNormalCyclesTensor: inside cells have not been collected.") ;
tensor.zero() ;
......@@ -226,7 +225,7 @@ void Collector_OneRing_AroundEdge<PFP>::collectAll(Dart d)
this->insideFaces.reserve(16);
this->border.reserve(16);