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,
......
This diff is collapsed.
......@@ -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) ;
};
......
This diff is collapsed.
......@@ -397,7 +397,7 @@ public:
};
template < unsigned int ORBIT_TO, unsigned int ORBIT_FROM, typename MAP, typename FUNC>
template <unsigned int ORBIT_TO, unsigned int ORBIT_FROM, typename MAP, typename FUNC>
inline void foreach_incident2(MAP& map, Cell<ORBIT_FROM> c,FUNC f)
{
IncidentTrav2<MAP,ORBIT_FROM,ORBIT_TO> trav(const_cast<const MAP&>(map),c);
......@@ -406,7 +406,7 @@ inline void foreach_incident2(MAP& map, Cell<ORBIT_FROM> c,FUNC f)
}
template <unsigned int THRU, unsigned int ORBIT, typename MAP, typename FUNC>
inline void foreach_adjacent2( MAP& map, Cell<ORBIT> c, FUNC f)
inline void foreach_adjacent2(MAP& map, Cell<ORBIT> c, FUNC f)
{
AdjacentTrav2<MAP,ORBIT,THRU> trav(const_cast<const MAP&>(map),c);
for (Cell<ORBIT> c = trav.t.begin(), e = trav.t.end(); c.dart != e.dart; c = trav.t.next())
......
......@@ -32,12 +32,12 @@ namespace CGoGN
// Traversor2VE
template <typename MAP>
Traversor2VE<MAP>::Traversor2VE(const MAP& map, Vertex dart) : m(map), start(dart),m_QLT(NULL)
Traversor2VE<MAP>::Traversor2VE(const MAP& map, Vertex v) : m(map), start(v),m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<VERTEX,EDGE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.getEmbedding(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(v)));
}
}
......@@ -81,12 +81,12 @@ Edge Traversor2VE<MAP>::next()
// Traversor2VF
template <typename MAP>
Traversor2VF<MAP>::Traversor2VF(const MAP& map, Vertex dart) : m(map), start(dart),m_QLT(NULL)
Traversor2VF<MAP>::Traversor2VF(const MAP& map, Vertex v) : m(map), start(v),m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<VERTEX,FACE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(v)));
}
else
{
......@@ -135,16 +135,16 @@ Face Traversor2VF<MAP>::next()
// Traversor2VVaE
template <typename MAP>
Traversor2VVaE<MAP>::Traversor2VVaE(const MAP& map, Vertex dart) : m(map),m_QLT(NULL)
Traversor2VVaE<MAP>::Traversor2VVaE(const MAP& map, Vertex v) : m(map), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<VERTEX,EDGE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(v)));
}
else
{
start = m.phi2(dart) ;
start = m.phi2(v.dart) ;
}
}
......@@ -186,21 +186,21 @@ Vertex Traversor2VVaE<MAP>::next()
// Traversor2VVaF
template <typename MAP>
Traversor2VVaF<MAP>::Traversor2VVaF(const MAP& map, Vertex dart) : m(map),m_QLT(NULL)
Traversor2VVaF<MAP>::Traversor2VVaF(const MAP& map, Vertex v) : m(map), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<VERTEX,FACE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(v)));
}
else
{
if(m.template isBoundaryMarked<2>(dart))
dart = m.phi2(m.phi_1(dart)) ;
start = m.phi1(m.phi1(dart)) ;
if(start.dart == dart.dart)
start = m.phi1(dart) ;
stop = dart ;
if(m.template isBoundaryMarked<2>(v.dart))
v.dart = m.phi2(m.phi_1(v.dart)) ;
start = m.phi1(m.phi1(v.dart)) ;
if(start.dart == v.dart)
start = m.phi1(v.dart) ;
stop = v ;
}
}
......@@ -260,12 +260,12 @@ Vertex Traversor2VVaF<MAP>::next()
// Traversor2EV
template <typename MAP>
Traversor2EV<MAP>::Traversor2EV(const MAP& map, Edge dart) : m(map), start(dart),m_QLT(NULL)
Traversor2EV<MAP>::Traversor2EV(const MAP& map, Edge e) : m(map), start(e), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<EDGE,VERTEX>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<EDGE>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(e)));
}
}
......@@ -307,17 +307,17 @@ Vertex Traversor2EV<MAP>::next()
// Traversor2EF
template <typename MAP>
Traversor2EF<MAP>::Traversor2EF(const MAP& map, Edge dart) : m(map), start(dart),m_QLT(NULL)
Traversor2EF<MAP>::Traversor2EF(const MAP& map, Edge e) : m(map), start(e),m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<EDGE,FACE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<EDGE>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(e)));
}
else
{
if(m.template isBoundaryMarked<2>(start))
start = m.phi2(start) ;
if(m.template isBoundaryMarked<2>(start.dart))
start = m.phi2(start.dart) ;
}
}
......@@ -359,18 +359,18 @@ Face Traversor2EF<MAP>::next()
// Traversor2EEaV
template <typename MAP>
Traversor2EEaV<MAP>::Traversor2EEaV(const MAP& map, Edge dart) : m(map),m_QLT(NULL)
Traversor2EEaV<MAP>::Traversor2EEaV(const MAP& map, Edge e) : m(map), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<EDGE,VERTEX>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<EDGE>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(e)));
}
else
{
start = m.phi2(m.phi_1(dart)) ;
stop1 = dart ;
stop2 = m.phi2(dart) ;
start = m.phi2(m.phi_1(e.dart)) ;
stop1 = e ;
stop2 = m.phi2(e.dart) ;
}
}
......@@ -414,22 +414,21 @@ Edge Traversor2EEaV<MAP>::next()
// Traversor2EEaF
template <typename MAP>
Traversor2EEaF<MAP>::Traversor2EEaF(const MAP& map, Edge dart) :
m(map),m_QLT(NULL)
Traversor2EEaF<MAP>::Traversor2EEaF(const MAP& map, Edge e) : m(map), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<EDGE,FACE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<EDGE>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(e)));
}
else
{
if (m.template isBoundaryMarked<2>(dart))
stop1 = m.phi2(dart);
if (m.template isBoundaryMarked<2>(e.dart))
stop1 = m.phi2(e.dart);
else
stop1 = dart;
stop2 = m.phi2(stop1) ;
start = m.phi1(stop1);
stop1 = e;
stop2 = m.phi2(stop1.dart) ;
start = m.phi1(stop1.dart);
}
}
......@@ -479,16 +478,15 @@ Edge Traversor2EEaF<MAP>::next()
FACE CENTERED TRAVERSALS
*******************************************************************************/
// Traversor2FV
template <typename MAP>
Traversor2FV<MAP>::Traversor2FV(const MAP& map, Face dart) : m(map), start(dart),m_QLT(NULL)
Traversor2FV<MAP>::Traversor2FV(const MAP& map, Face f) : m(map), start(f), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<FACE,VERTEX>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<FACE>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(f)));
}
}
......@@ -527,16 +525,15 @@ Vertex Traversor2FV<MAP>::next()
return current ;
}
// Traversor2FE
template <typename MAP>
Traversor2FE<MAP>::Traversor2FE(const MAP& map, Face dart) : m(map), start(dart),m_QLT(NULL)
Traversor2FE<MAP>::Traversor2FE(const MAP& map, Face f) : m(map), start(f), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<FACE,VERTEX>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<FACE>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(f)));
}
}
......@@ -578,23 +575,23 @@ Edge Traversor2FE<MAP>::next()
// Traversor2FFaV
template <typename MAP>
Traversor2FFaV<MAP>::Traversor2FFaV(const MAP& map, Face dart) : m(map),m_QLT(NULL)
Traversor2FFaV<MAP>::Traversor2FFaV(const MAP& map, Face f) : m(map), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<FACE,VERTEX>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<FACE>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(f)));
}
else
{
start = m.phi2(m.phi_1(m.phi2(m.phi_1(dart)))) ;
while (start.dart == dart.dart)
start = m.phi2(m.phi_1(m.phi2(m.phi_1(f.dart)))) ;
while (start.dart == f.dart)
{
dart = m.phi1(dart);
start = m.phi2(m.phi_1(m.phi2(m.phi_1(dart)))) ;
f = m.phi1(f.dart);
start = m.phi2(m.phi_1(m.phi2(m.phi_1(f.dart)))) ;
}
current = start ;
stop = dart ;
stop = f ;
if(m.template isBoundaryMarked<2>(start))
start = next() ;
}
......@@ -654,20 +651,20 @@ Face Traversor2FFaV<MAP>::next()
// Traversor2FFaE
template <typename MAP>
Traversor2FFaE<MAP>::Traversor2FFaE(const MAP& map, Face dart) : m(map),m_QLT(NULL)
Traversor2FFaE<MAP>::Traversor2FFaE(const MAP& map, Face f) : m(map), m_QLT(NULL)
{
const AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<FACE,EDGE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<FACE>(dart)));
m_QLT = &(quickTraversal->operator[](map.getEmbedding(f)));
}
else
{
start = m.phi2(dart) ;
start = m.phi2(f.dart) ;
while(start.dart != NIL && m.template isBoundaryMarked<2>(start))
{
start = m.phi2(m.phi1(m.phi2(start))) ;
if(start.dart == m.phi2(dart))
if(start.dart == m.phi2(f.dart))
start = NIL ;
}
}
......@@ -711,8 +708,6 @@ Face Traversor2FFaE<MAP>::next()
return current ;
}
//
//template<typename MAP>
//Traversor2<MAP>* Traversor2<MAP>::createIncident(MAP& map, Dart dart, unsigned int orbX, unsigned int orbY)
//{
......
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