Commit 4eaf067e authored by Sauvage's avatar Sauvage

collector one ring around edge : il faut encore le tester

parent def134ab
......@@ -149,6 +149,37 @@ public:
void computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, const EdgeAttribute<REAL>&edgeangle, typename PFP::MATRIX33&);
};
/*********************************************************
* Collector One Ring around edge
*********************************************************/
/*
* insideVertices = 2 ends of center edge (centerDart)
* insideEdges = center egde + edges adjacent by a vertex
* = union of stars of 1-rings of the 2 ends
* insideFaces = triangles incident to the 2 ends
* border = vertices of 1-ring -> link (set of adjacent vertices)
* = edges of 1-ring
*/
template <typename PFP>
class Collector_OneRing_AroundEdge : public Collector<PFP>
{
protected:
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ;
public:
Collector_OneRing_AroundEdge(typename PFP::MAP& m, unsigned int thread=0):
Collector<PFP>(m, thread) {}
void collectAll(Dart d);
void collectBorder(Dart d);
REAL computeArea(const VertexAttribute<VEC3>& pos);
void computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, const EdgeAttribute<REAL>&edgeangle, typename PFP::MATRIX33&);
};
/*********************************************************
* Collector Within Sphere
*********************************************************/
......
......@@ -168,6 +168,95 @@ void Collector_OneRing<PFP>::computeNormalCyclesTensor (const VertexAttribute<VE
tensor /= computeArea(pos) ;
}
/*********************************************************
* Collector One Ring aroung edge
*********************************************************/
template <typename PFP>
void Collector_OneRing_AroundEdge<PFP>::collectAll(Dart d)
{
// TODO : this collector is not boundary safe
// init
this->init(d);
this->isInsideCollected = true;
const Dart d2 = this->map.phi2(d);
this->insideEdges.reserve(16);
this->insideFaces.reserve(16);
this->border.reserve(16);
CellMarkerStore<FACE> fm (this->map, this->m_thread);
fm.mark(d);
fm.mark(d2);
// collect
this->insideVertices.push_back(d);
this->insideVertices.push_back(d2);
this->insideEdges.push_back(d);
Traversor2EEaV<typename PFP::MAP> te(this->map, d) ;
for(Dart it = te.begin(); it != te.end(); it = te.next())
{
this->insideEdges.push_back(it);
this->insideFaces.push_back(it);
if (! fm.isMarked(it)) this->border.push_back(this->map.phi1(it));
}
}
template <typename PFP>
void Collector_OneRing_AroundEdge<PFP>::collectBorder(Dart d)
{
// TODO : this collector is not boundary safe
// init
this->init(d);
const Dart d2 = this->map.phi2(d);
this->border.reserve(16);
CellMarkerStore<FACE> fm (this->map, this->m_thread);
fm.mark(d);
fm.mark(d2);
// collect
Traversor2EEaV<typename PFP::MAP> te(this->map, d) ;
for(Dart it = te.begin(); it != te.end(); it = te.next())
{
if (! fm.isMarked(it)) this->border.push_back(this->map.phi1(it));
}
}
template <typename PFP>
typename PFP::REAL Collector_OneRing_AroundEdge<PFP>::computeArea(const VertexAttribute<VEC3>& pos)
{
assert(this->isInsideCollected || !"computeArea: inside cells have not been collected.") ;
REAL area = 0;
for (std::vector<Dart>::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it)
area += Algo::Geometry::triangleArea<PFP>(this->map, *it, pos);
return area;
}
template <typename PFP>
void Collector_OneRing_AroundEdge<PFP>::computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, const EdgeAttribute<REAL>& edgeangle, typename PFP::MATRIX33& tensor){
assert(this->isInsideCollected || !"computeNormalCyclesTensor: inside cells have not been collected.") ;
tensor.zero() ;
// collect edges inside the neighborhood
for (std::vector<Dart>::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it)
{
const VEC3 e = Algo::Geometry::vectorOutOfDart<PFP>(this->map, *it, pos) ;
tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ;
}
tensor /= computeArea(pos) ;
}
/*********************************************************
* Collector Within Sphere
*********************************************************/
......
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