Commit 020f15a7 authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' of icube-forge.unistra.fr:cgogn/cgogn into develop

parents 4882257e 6bd24868
......@@ -354,6 +354,7 @@ private:
VertexAttribute<VEC3, MAP> normal ;
EdgeAttribute<EdgeInfo, MAP> edgeInfo ;
EdgeAttribute<REAL, MAP> edgeangle ;
EdgeAttribute<REAL, MAP> edgearea ;
VertexAttribute<REAL, MAP> kmax ;
VertexAttribute<REAL, MAP> kmin ;
VertexAttribute<VEC3, MAP> Kmax ;
......@@ -390,6 +391,13 @@ public:
Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ;
}
edgearea = m.template getAttribute<REAL, EDGE, MAP>("edgearea") ;
if(!edgearea.isValid())
{
edgearea = m.template addAttribute<REAL, EDGE, MAP>("edgearea") ;
Algo::Surface::Geometry::computeAreaEdges<PFP>(m, pos, edgearea) ;
}
kmax = m.template getAttribute<REAL, VERTEX, MAP>("kmax") ;
kmin = m.template getAttribute<REAL, VERTEX, MAP>("kmin") ;
Kmax = m.template getAttribute<VEC3, VERTEX, MAP>("Kmax") ;
......@@ -404,7 +412,7 @@ public:
Kmax = m.template addAttribute<VEC3, VERTEX, MAP>("Kmax") ;
Kmin = m.template addAttribute<VEC3, VERTEX, MAP>("Kmin") ;
Knormal = m.template addAttribute<VEC3, VERTEX, MAP>("Knormal") ;
Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles<PFP>(m, radius, pos, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles<PFP>(m, radius, pos, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal) ;
}
edgeInfo = m.template addAttribute<EdgeInfo, EDGE, MAP>("edgeInfo") ;
......@@ -412,6 +420,7 @@ public:
~EdgeSelector_Curvature()
{
// this->m_map.removeAttribute(edgeangle) ;
// this->m_map.removeAttribute(edgearea) ;
// this->m_map.removeAttribute(kmax) ;
// this->m_map.removeAttribute(kmin) ;
// this->m_map.removeAttribute(Kmax) ;
......@@ -452,6 +461,7 @@ private:
EdgeAttribute<EdgeInfo, MAP> edgeInfo ;
EdgeAttribute<REAL, MAP> edgeangle ;
EdgeAttribute<REAL, MAP> edgearea ;
std::multimap<float,Dart> edges ;
typename std::multimap<float,Dart>::iterator cur ;
......@@ -473,11 +483,19 @@ public:
Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ;
}
edgearea = m.template getAttribute<REAL, EDGE, MAP>("edgearea") ;
if(!edgearea.isValid())
{
edgearea = m.template addAttribute<REAL, EDGE, MAP>("edgearea") ;
Algo::Surface::Geometry::computeAreaEdges<PFP>(m, pos, edgearea) ;
}
edgeInfo = m.template addAttribute<EdgeInfo, EDGE, MAP>("edgeInfo") ;
}
~EdgeSelector_CurvatureTensor()
{
// this->m_map.removeAttribute(edgeangle) ;
// this->m_map.removeAttribute(edgearea) ;
this->m_map.removeAttribute(edgeInfo) ;
}
SelectorType getType() { return S_CurvatureTensor ; }
......
......@@ -1022,14 +1022,14 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
MAP& m = this->m_map ;
normal[d2] = Algo::Surface::Geometry::vertexNormal<PFP>(m, d2, m_position) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, m_position, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal) ;
Dart vit = d2 ;
do
{
Dart nVert = m.phi1(vit) ;
normal[nVert] = Algo::Surface::Geometry::vertexNormal<PFP>(m, nVert, m_position) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, nVert, radius, m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, nVert, radius, m_position, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal) ;
updateEdgeInfo(m.phi1(vit), false) ; // must recompute some edge infos in the
if(vit == d2 || vit == dd2) // neighborhood of the collapsed edge
......@@ -1131,7 +1131,7 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// compute things on the coarse version of the mesh
normal[newV] = Algo::Surface::Geometry::vertexNormal<PFP>(m, d2, m_position) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, m_position, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal) ;
// VEC3 norm = normal[newV] ;
REAL mCurv = (kmax[newV] + kmin[newV]) / REAL(2) ;
......@@ -1330,7 +1330,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
MATRIX tens1;
Algo::Surface::Selection::Collector_OneRing_AroundEdge<PFP> col1(m);
col1.collectAll(d);
col1.computeNormalCyclesTensor(m_position, edgeangle, tens1); // edgeangle is up to date here
Algo::Surface::Geometry::normalCycles_computeTensor(col1, m_position, edgeangle, tens1); // edgeangle is up to date here
tens1 *= col1.computeArea(m_position); // mean tensor * area = integral of the tensor
Algo::Surface::Geometry::normalCycles_SortTensor<PFP>(tens1);
......@@ -1345,7 +1345,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
MATRIX tens2;
Algo::Surface::Selection::Collector_OneRing<PFP> col2(m);
col2.collectAll(d);
col2.computeNormalCyclesTensor(m_position, tens2); // edgeangle is not up to date here
Algo::Surface::Geometry::normalCycles_computeTensor(col2, m_position, tens2); // edgeangle is not up to date here
tens2 *= col2.computeArea(m_position); // mean tensor * area = integral of the tensor
Algo::Surface::Geometry::normalCycles_SortTensor<PFP>(tens2);
......
This diff is collapsed.
This diff is collapsed.
......@@ -89,13 +89,13 @@ public:
virtual void collectBorder(Dart d) = 0;
template <typename FUNC>
void applyOnInsideVertices(FUNC& f);
void applyOnInsideVertices(FUNC& func);
template <typename FUNC>
void applyOnInsideEdges(FUNC& f);
void applyOnInsideEdges(FUNC& func);
template <typename FUNC>
void applyOnInsideFaces(FUNC& f);
void applyOnInsideFaces(FUNC& func);
template <typename FUNC>
void applyOnBorder(FUNC& f);
void applyOnBorder(FUNC& func);
inline void sort()
{
......@@ -122,14 +122,22 @@ public:
template <typename PPFP>
friend std::ostream& operator<<(std::ostream &out, const Collector<PPFP>& c);
virtual REAL computeArea (const VertexAttribute<VEC3, MAP>& /*pos*/, const EdgeAttribute<REAL, MAP>& /*edgearea*/)
virtual REAL computeArea(const VertexAttribute<VEC3, MAP>& /*pos*/)
{
assert(!"Warning: Collector<PFP>::computeArea() should be overloaded in non-virtual derived classes");
return 0.0;
}
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& /*pos*/, const EdgeAttribute<REAL, MAP>& /*edgeangle*/, const EdgeAttribute<REAL, MAP>& /*edgearea*/, typename PFP::MATRIX33&)
virtual REAL computeArea(const VertexAttribute<VEC3, MAP>& /*pos*/, const EdgeAttribute<REAL, MAP>& /*edgearea*/)
{
assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes");
assert(!"Warning: Collector<PFP>::computeArea() should be overloaded in non-virtual derived classes");
return 0.0;
}
virtual REAL borderEdgeRatio(Dart /*d*/, const VertexAttribute<VEC3, MAP>& /*pos*/)
{
assert(!"Warning: Collector<PFP>::borderEdgeRatio() should be overloaded in non-virtual derived classes");
return 1.0;
}
};
......@@ -158,8 +166,9 @@ public:
void collectAll(Dart d);
void collectBorder(Dart d);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgearea);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, const EdgeAttribute<REAL, MAP>& edgearea, typename PFP::MATRIX33&);
REAL borderEdgeRatio(Dart d, const VertexAttribute<VEC3, MAP>& pos);
};
/*********************************************************
......@@ -189,8 +198,9 @@ public:
void collectAll(Dart d);
void collectBorder(Dart d);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgearea);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, const EdgeAttribute<REAL, MAP>& edgearea, typename PFP::MATRIX33&);
REAL borderEdgeRatio(Dart d, const VertexAttribute<VEC3, MAP>& pos);
};
/*********************************************************
......@@ -227,8 +237,9 @@ public:
void collectAll(Dart d);
void collectBorder(Dart d);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgearea);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, const EdgeAttribute<REAL, MAP>& edgearea, typename PFP::MATRIX33&);
REAL borderEdgeRatio(Dart d, const VertexAttribute<VEC3, MAP>& pos);
};
/*********************************************************
......@@ -309,7 +320,7 @@ public:
class CollectorCriterion
{
public :
public:
CollectorCriterion() {}
virtual ~CollectorCriterion() {}
virtual void init(Dart center) = 0;
......@@ -324,12 +335,12 @@ class CollectorCriterion_VertexNormalAngle : public CollectorCriterion
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
private :
private:
const VertexAttribute<VEC3, MAP>& vertexNormals;
REAL threshold;
VEC3 centerNormal;
public :
public:
CollectorCriterion_VertexNormalAngle(const VertexAttribute<VEC3, MAP>& n, REAL th) :
vertexNormals(n), threshold(th), centerNormal(0)
{}
......@@ -349,12 +360,12 @@ class CollectorCriterion_TriangleNormalAngle : public CollectorCriterion
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
private :
private:
const FaceAttribute<VEC3, MAP>& faceNormals;
REAL threshold;
VEC3 centerNormal;
public :
public:
CollectorCriterion_TriangleNormalAngle(const FaceAttribute<VEC3, MAP>& n, REAL th) :
faceNormals(n), threshold(th), centerNormal(0)
{}
......@@ -374,12 +385,12 @@ class CollectorCriterion_VertexWithinSphere : public CollectorCriterion
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::REAL REAL;
private :
private:
const VertexAttribute<VEC3, MAP>& vertexPositions;
REAL threshold;
VEC3 centerPosition;
public :
public:
CollectorCriterion_VertexWithinSphere(const VertexAttribute<VEC3, MAP>& p, REAL th) :
vertexPositions(p), threshold(th), centerPosition(0)
{}
......
This diff is collapsed.
......@@ -512,16 +512,16 @@ void Cube<PFP>::cube(unsigned int x, unsigned int y, unsigned int z)
this->m_tableVertDarts.push_back(tableBottom[i*(x+1)+j]);
}
const std::vector<Dart>& tableTopFaces = gTop.getFaceDarts();
const std::vector<Dart>& tableTopFaces = gtop.getFaceDarts();
for (Dart f : tableTopFaces)
{
this-m_tableFaceDarts.push_back(f);
this->m_tableFaceDarts.push_back(f);
}
const std::vector<Dart>& tableBottomFaces = gBottom.getFaceDarts();
for (Dart f : tableBottomFaces)
{
this-m_tableFaceDarts.push_back(f);
this->m_tableFaceDarts.push_back(f);
}
}
......
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