add kernel named parameter to triangulate_hole_polyline

This commit is contained in:
Jane Tournois 2015-03-31 17:24:19 +02:00
parent 959fa86bba
commit 9f3efdeba6
9 changed files with 43 additions and 28 deletions

View File

@ -91,18 +91,19 @@ struct Tracer_polyhedron
};
// This function is used in test cases (since it returns not just OutputIterator but also Weight)
template<class PolygonMesh, class OutputIterator, class VertexPointMap>
template<class PolygonMesh, class OutputIterator, class VertexPointMap, class Kernel>
std::pair<OutputIterator, CGAL::internal::Weight_min_max_dihedral_and_area>
triangulate_hole_polygon_mesh(PolygonMesh& pmesh,
typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
OutputIterator out,
VertexPointMap vpmap,
bool use_delaunay_triangulation)
bool use_delaunay_triangulation,
const Kernel& k)
{
typedef Halfedge_around_face_circulator<PolygonMesh> Hedge_around_face_circulator;
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
typedef typename boost::property_traits<VertexPointMap>::value_type Point_3;
typedef typename Kernel::Point_3 Point_3;
typedef std::map<vertex_descriptor, int> Vertex_map;
typedef typename Vertex_map::iterator Vertex_map_it;
@ -171,7 +172,8 @@ triangulate_hole_polygon_mesh(PolygonMesh& pmesh,
Tracer_polyhedron<PolygonMesh, OutputIterator>
tracer(out, pmesh, P_edges);
CGAL::internal::Weight_min_max_dihedral_and_area weight =
triangulate_hole_polyline(P, Q, tracer, WC(is_valid), use_delaunay_triangulation)
triangulate_hole_polyline(P, Q, tracer, WC(is_valid),
use_delaunay_triangulation, k)
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
.weight // get actual weight in Weight_incomplete
#endif

View File

@ -1175,19 +1175,19 @@ public:
template <
typename PointRange,
typename Tracer,
typename WeightCalculator
typename WeightCalculator,
typename Kernel
>
typename WeightCalculator::Weight
triangulate_hole_polyline(const PointRange& points,
const PointRange& third_points,
Tracer& tracer,
const WeightCalculator& WC,
bool use_delaunay_triangulation)
bool use_delaunay_triangulation,
const Kernel&)
{
typedef typename PointRange::iterator InIterator;
typedef typename std::iterator_traits<InIterator>::value_type Point_3;
typedef typename CGAL::Kernel_traits<Point_3>::Kernel K;
typedef Kernel K;
typedef K::Point_3 Point_3;
typedef CGAL::internal::Triangulate_hole_polyline_DT<K, Tracer, WeightCalculator> Fill_DT;
typedef CGAL::internal::Triangulate_hole_polyline<K, Tracer, WeightCalculator> Fill;

View File

@ -95,10 +95,10 @@ namespace CGAL{
//overload
template <typename PointMap>
pmp_bgl_named_params<PointMap, vertex_point_t, self>
pmp_bgl_named_params<PointMap, boost::vertex_point_t, self>
vertex_point_map(const PointMap& p) const
{
typedef pmp_bgl_named_params<PointMap, vertex_point_t, self> Params;
typedef pmp_bgl_named_params<PointMap, boost::vertex_point_t, self> Params;
return Params(p, *this);
}
@ -209,10 +209,10 @@ namespace parameters{
//overload
template <typename PointMap>
pmp_bgl_named_params<PointMap, vertex_point_t>
pmp_bgl_named_params<PointMap, boost::vertex_point_t>
vertex_point_map(const PointMap& p)
{
typedef pmp_bgl_named_params<PointMap, vertex_point_t> Params;
typedef pmp_bgl_named_params<PointMap, boost::vertex_point_t> Params;
return Params(p);
}

View File

@ -38,7 +38,7 @@ template<typename PolygonMesh>
class GetK
{
typedef typename property_map_value<PolygonMesh,
CGAL::vertex_point_t>::type
boost::vertex_point_t>::type
Point;
public:
typedef typename CGAL::Kernel_traits<Point>::Kernel Kernel;

View File

@ -67,7 +67,7 @@ namespace internal{
* isolated connected component.
*
* @tparam PolygonMesh a model of `FaceListGraph` that has a property map
* for `CGAL::vertex_point_t`
* for `boost::vertex_point_t`
* @tparam NamedParameters a sequence of \ref namedparameters
*
* @param pmesh the closed polygon mesh to be tested
@ -105,7 +105,7 @@ bool is_outward_oriented(const PolygonMesh& pmesh,
boost::vertex_point);
//Kernel
typedef typename CGAL::Kernel_traits <
typename property_map_value<PolygonMesh, CGAL::vertex_point_t>::type
typename property_map_value<PolygonMesh, boost::vertex_point_t>::type
> ::Kernel DefaultKernel;
typedef typename boost::lookup_named_param_def <
CGAL::geom_traits_t,

View File

@ -227,7 +227,7 @@ public:
* \ingroup PkgPolygonMeshProcessing
* triangulates faces of the polygon mesh `pmesh`. This function depends on the package \ref PkgTriangulation2Summary
* @tparam PolygonMesh a model of `FaceListGraph` and `MutableFaceGraph`
* that has a property map for `CGAL::vertex_point_t`
* that has a property map for `boost::vertex_point_t`
* @tparam NamedParameters a sequence of \ref namedparameters
*
* @param pmesh the polygon mesh to be triangulated

View File

@ -25,7 +25,7 @@
#include <CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h>
#include <CGAL/Polygon_mesh_processing/refine.h>
#include <CGAL/Polygon_mesh_processing/fair.h>
#include <CGAL/Default.h>
#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
@ -93,7 +93,9 @@ namespace Polygon_mesh_processing {
border_halfedge,
out,
choose_param(get_param(np, vertex_point), get(CGAL::vertex_point, pmesh)),
use_dt3).first;
use_dt3,
choose_param(get_param(np, geom_traits), GetKernel<PolygonMesh,NamedParameters>::Kernel()))
.first;
}
template<typename PolygonMesh, typename OutputIterator>
@ -255,6 +257,9 @@ namespace Polygon_mesh_processing {
Note that the ranges `points` and `third_points` may or may not contain duplicated first point at the end of sequence.
@tparam OutputIteratorValueType value type of `OutputIterator`
having a constructor `OutputIteratorValueType(int p0, int p1, int p2)` available.
It defaults to `value_type_traits<OutputIterator>::%type`, and can be omitted when the default is fine.
@tparam PointRange range of points, model of `SinglePassRange`
@tparam OutputIterator model of `OutputIterator`
holding `boost::graph_traits<PolygonMesh>::%face_descriptor` for patch faces
@ -273,7 +278,8 @@ namespace Polygon_mesh_processing {
\todo handle islands
*/
template <typename PointRange,
template </*typename OutputIteratorValueType,*/
typename PointRange,
typename OutputIterator,
typename NamedParameters>
OutputIterator
@ -303,7 +309,15 @@ namespace Polygon_mesh_processing {
typedef typename value_type_traits<OutputIterator>::type OutputIteratorValueType;
CGAL::internal::Tracer_polyline_incomplete<OutputIteratorValueType, OutputIterator, Holes_out>
tracer(out, Holes_out(holes));
triangulate_hole_polyline(points, third_points, tracer, WC(), use_dt3);
typedef typename PointRange::iterator InIterator;
typedef typename std::iterator_traits<InIterator>::value_type Point;
triangulate_hole_polyline(points, third_points, tracer, WC(),
use_dt3,
choose_param(get_param(np, CGAL::geom_traits),
typename CGAL::Kernel_traits<Point>::Kernel()));
CGAL_assertion(holes.empty());
return tracer.out;
}
@ -321,10 +335,9 @@ namespace Polygon_mesh_processing {
/*!
\ingroup PkgPolygonMeshProcessing
same as above but the range of third points is omitted.
They are not taken into account in the cost computation that leads the hole filling
combinatorial decisions.
*/
same as above but the range of third points is omitted. They are not
taken into account in the cost computation that leads the hole filling.
*/
template <typename PointRange,
typename OutputIterator,
typename NamedParameters>

View File

@ -104,7 +104,7 @@ void test_triangulate_hole_weight(const char* file_name, bool use_DT) {
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it) {
std::vector<Facet_handle> patch;
Weight w_algo = CGAL::Polygon_mesh_processing::internal::triangulate_hole_polygon_mesh(
poly, *it, back_inserter(patch), get(CGAL::vertex_point, poly), use_DT).second;
poly, *it, back_inserter(patch), get(CGAL::vertex_point, poly), use_DT, Kernel()).second;
if(patch.empty()) { continue; }
Weight w_test = calculate_weight_for_patch(poly, patch.begin(), patch.end());

View File

@ -103,7 +103,7 @@ void test_triangulate_hole_weight(const char* file_name, bool use_DT) {
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it) {
std::vector<Facet_handle> patch;
Weight w_algo = CGAL::Polygon_mesh_processing::internal::triangulate_hole_polygon_mesh(
poly, *it, back_inserter(patch), get(CGAL::vertex_point, poly), use_DT).second;
poly, *it, back_inserter(patch), get(CGAL::vertex_point, poly), use_DT, Kernel()).second;
if(patch.empty()) { continue; }
Weight w_test = calculate_weight_for_patch(poly, patch.begin(), patch.end());