mirror of https://github.com/CGAL/cgal
GH_composed_policies now able to take polcies as arguments and it and GH_line_policies now internal to CGAL
This commit is contained in:
parent
1a59d8cd3c
commit
6a65d677e3
|
|
@ -21,7 +21,12 @@ namespace CGAL {
|
||||||
namespace Surface_mesh_simplification {
|
namespace Surface_mesh_simplification {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <typename TriangleMesh, typename GeomTraits, typename Quadric_calculator_1, typename Quadric_calculator_2>
|
/*
|
||||||
|
That policy was created to merge the line policy with the existing ones.
|
||||||
|
Since it is a technical feature, it is internal to the library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
template <typename TriangleMesh, typename GeomTraits, typename Quadric_calculator_1, typename Quadric_calculator_2, bool invertible=false>
|
||||||
class Composed_quadric_calculator
|
class Composed_quadric_calculator
|
||||||
{
|
{
|
||||||
typedef typename GarlandHeckbert_matrix_types<GeomTraits>::Mat_4 Mat_4;
|
typedef typename GarlandHeckbert_matrix_types<GeomTraits>::Mat_4 Mat_4;
|
||||||
|
|
@ -34,7 +39,7 @@ class Composed_quadric_calculator
|
||||||
double weight_2;
|
double weight_2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Composed_quadric_calculator(Quadric_calculator_1 &&qc1, Quadric_calculator_2 &&qc2, double w1=1., double w2=1.):
|
Composed_quadric_calculator(Quadric_calculator_1 &qc1, Quadric_calculator_2 &qc2, double w1=1., double w2=1.):
|
||||||
quadric_calculator_1(qc1), quadric_calculator_2(qc2), weight_1(w1), weight_2(w2){}
|
quadric_calculator_1(qc1), quadric_calculator_2(qc2), weight_1(w1), weight_2(w2){}
|
||||||
Composed_quadric_calculator(double w1=1., double w2=1.): weight_1(w1), weight_2(w2){}
|
Composed_quadric_calculator(double w1=1., double w2=1.): weight_1(w1), weight_2(w2){}
|
||||||
|
|
||||||
|
|
@ -54,8 +59,8 @@ public:
|
||||||
const VertexPointMap point_map,
|
const VertexPointMap point_map,
|
||||||
const GeomTraits& gt) const
|
const GeomTraits& gt) const
|
||||||
{
|
{
|
||||||
return weight_1 * Quadric_calculator_1().construct_quadric_from_edge(he, tmesh, point_map, gt) +
|
return weight_1 * quadric_calculator_1.construct_quadric_from_edge(he, tmesh, point_map, gt) +
|
||||||
weight_2 * Quadric_calculator_2().construct_quadric_from_edge(he, tmesh, point_map, gt);
|
weight_2 * quadric_calculator_2.construct_quadric_from_edge(he, tmesh, point_map, gt);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename VertexPointMap>
|
template <typename VertexPointMap>
|
||||||
|
|
@ -64,8 +69,8 @@ public:
|
||||||
const VertexPointMap point_map,
|
const VertexPointMap point_map,
|
||||||
const GeomTraits& gt) const
|
const GeomTraits& gt) const
|
||||||
{
|
{
|
||||||
return weight_1 * Quadric_calculator_1().construct_quadric_from_face(f, tmesh, point_map, gt) +
|
return weight_1 * quadric_calculator_1.construct_quadric_from_face(f, tmesh, point_map, gt) +
|
||||||
weight_2 * Quadric_calculator_2().construct_quadric_from_face(f, tmesh, point_map, gt);
|
weight_2 * quadric_calculator_2.construct_quadric_from_face(f, tmesh, point_map, gt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -73,31 +78,33 @@ public:
|
||||||
const Col_4& p0,
|
const Col_4& p0,
|
||||||
const Col_4& p1) const
|
const Col_4& p1) const
|
||||||
{
|
{
|
||||||
//TODO How merge here?
|
if constexpr(invertible)
|
||||||
|
return construct_optimal_point_invertible<GeomTraits>(quadric);
|
||||||
|
else
|
||||||
return construct_optimal_point_singular<GeomTraits>(quadric, p0, p1);
|
return construct_optimal_point_singular<GeomTraits>(quadric, p0, p1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
template<typename TriangleMesh, typename GeomTraits, typename GH_policies_1, typename GH_policies_2, bool invertible=false>
|
||||||
|
|
||||||
template<typename TriangleMesh, typename GeomTraits, typename GH_policies_1, typename GH_policies_2>
|
|
||||||
class GarlandHeckbert_composed_policies
|
class GarlandHeckbert_composed_policies
|
||||||
: public internal::GarlandHeckbert_cost_and_placement<
|
: public internal::GarlandHeckbert_cost_and_placement<
|
||||||
internal::Composed_quadric_calculator<TriangleMesh, GeomTraits,
|
internal::Composed_quadric_calculator<TriangleMesh, GeomTraits,
|
||||||
typename GH_policies_1::Quadric_calculator,
|
typename GH_policies_1::Quadric_calculator,
|
||||||
typename GH_policies_2::Quadric_calculator>,
|
typename GH_policies_2::Quadric_calculator,
|
||||||
|
invertible>,
|
||||||
TriangleMesh, GeomTraits>
|
TriangleMesh, GeomTraits>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef internal::Composed_quadric_calculator<TriangleMesh, GeomTraits,
|
typedef internal::Composed_quadric_calculator<TriangleMesh, GeomTraits,
|
||||||
typename GH_policies_1::Quadric_calculator,
|
typename GH_policies_1::Quadric_calculator,
|
||||||
typename GH_policies_2::Quadric_calculator>
|
typename GH_policies_2::Quadric_calculator,
|
||||||
|
invertible>
|
||||||
Quadric_calculator;
|
Quadric_calculator;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef internal::GarlandHeckbert_cost_and_placement<
|
typedef internal::GarlandHeckbert_cost_and_placement<
|
||||||
Quadric_calculator, TriangleMesh, GeomTraits> Base;
|
Quadric_calculator, TriangleMesh, GeomTraits> Base;
|
||||||
typedef GarlandHeckbert_composed_policies<TriangleMesh, GeomTraits, GH_policies_1, GH_policies_2> Self;
|
typedef GarlandHeckbert_composed_policies<TriangleMesh, GeomTraits, GH_policies_1, GH_policies_2, invertible> Self;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef Self Get_cost;
|
typedef Self Get_cost;
|
||||||
|
|
@ -111,11 +118,12 @@ public:
|
||||||
: Base(tmesh, Quadric_calculator(w1, w2), dm)
|
: Base(tmesh, Quadric_calculator(w1, w2), dm)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// GarlandHeckbert_composed_policies(TriangleMesh& tmesh,
|
GarlandHeckbert_composed_policies(TriangleMesh& tmesh,
|
||||||
// GH_policies_1
|
GH_policies_1 ghp1,
|
||||||
// double w1=1., double w2=1.,const FT dm = FT(100))
|
GH_policies_2 ghp2,
|
||||||
// : Base(tmesh, Quadric_calculator(w1, w2), dm)
|
double w1=1., double w2=1.,const FT dm = FT(100))
|
||||||
// { }
|
: Base(tmesh, Quadric_calculator(ghp1.m_quadric_calculator, ghp2.m_quadric_calculator, w1, w2), dm)
|
||||||
|
{ }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const Get_cost& get_cost() const { return *this; }
|
const Get_cost& get_cost() const { return *this; }
|
||||||
|
|
@ -124,6 +132,7 @@ public:
|
||||||
using Base::operator();
|
using Base::operator();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
} // namespace Surface_mesh_simplification
|
} // namespace Surface_mesh_simplification
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
|
|
@ -21,6 +21,11 @@ namespace CGAL {
|
||||||
namespace Surface_mesh_simplification {
|
namespace Surface_mesh_simplification {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
/*
|
||||||
|
This policy is not useful on its own; it is designed to be combined with another policy using a small weight.
|
||||||
|
Therefore, it is kept internal.
|
||||||
|
*/
|
||||||
|
|
||||||
template <typename TriangleMesh, typename GeomTraits>
|
template <typename TriangleMesh, typename GeomTraits>
|
||||||
class Line_quadric_calculator
|
class Line_quadric_calculator
|
||||||
{
|
{
|
||||||
|
|
@ -67,8 +72,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
|
||||||
|
|
||||||
template<typename TriangleMesh, typename GeomTraits>
|
template<typename TriangleMesh, typename GeomTraits>
|
||||||
class GarlandHeckbert_line_policies
|
class GarlandHeckbert_line_policies
|
||||||
: public internal::GarlandHeckbert_cost_and_placement<
|
: public internal::GarlandHeckbert_cost_and_placement<
|
||||||
|
|
@ -101,6 +104,7 @@ public:
|
||||||
using Base::operator();
|
using Base::operator();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
} // namespace Surface_mesh_simplification
|
} // namespace Surface_mesh_simplification
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
|
|
@ -59,7 +59,8 @@ struct GarlandHeckbert_quadrics_storage
|
||||||
|
|
||||||
typedef QuadricCalculator Quadric_calculator;
|
typedef QuadricCalculator Quadric_calculator;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
|
// protected:
|
||||||
Vertex_cost_map m_cost_matrices;
|
Vertex_cost_map m_cost_matrices;
|
||||||
Quadric_calculator m_quadric_calculator;
|
Quadric_calculator m_quadric_calculator;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue