mirror of https://github.com/CGAL/cgal
Add plane_plus_line_policies to GarlantHeckbert example
This commit is contained in:
parent
7e4791ffb2
commit
029fb1b6b3
|
|
@ -24,6 +24,7 @@ typedef SMS::GarlandHeckbert_plane_policies<Surface_mesh, Kernel>
|
|||
typedef SMS::GarlandHeckbert_probabilistic_plane_policies<Surface_mesh, Kernel> Prob_plane;
|
||||
typedef SMS::GarlandHeckbert_triangle_policies<Surface_mesh, Kernel> Classic_tri;
|
||||
typedef SMS::GarlandHeckbert_probabilistic_triangle_policies<Surface_mesh, Kernel> Prob_tri;
|
||||
typedef SMS::GarlandHeckbert_plane_plus_line_policies<Surface_mesh, Kernel> Plane_plus_line;
|
||||
|
||||
template <typename GHPolicies>
|
||||
void collapse_gh(Surface_mesh& mesh,
|
||||
|
|
@ -59,7 +60,7 @@ void collapse_gh(Surface_mesh& mesh,
|
|||
|
||||
// Usage:
|
||||
// ./command [input] [ratio] [policy] [output]
|
||||
// policy can be "cp" (classic plane), "ct" (classic triangle), "pp" (probabilistic plane), "pt" (probabilistic triangle)
|
||||
// policy can be "cp" (classic plane), "ct" (classic triangle), "pp" (probabilistic plane), "pt" (probabilistic triangle), "pl" (plane plus line)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Surface_mesh mesh;
|
||||
|
|
@ -91,8 +92,10 @@ int main(int argc, char** argv)
|
|||
collapse_gh<Classic_tri>(mesh, ratio);
|
||||
else if(policy == "pp")
|
||||
collapse_gh<Prob_plane>(mesh, ratio);
|
||||
else
|
||||
else if(policy == "pt")
|
||||
collapse_gh<Prob_tri>(mesh, ratio);
|
||||
else
|
||||
collapse_gh<Plane_plus_line>(mesh, ratio);
|
||||
|
||||
CGAL::IO::write_polygon_mesh((argc > 4) ? argv[4] : "out.off", mesh, CGAL::parameters::stream_precision(17));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright (c) 2025 GeometryFactory (France). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Leo Valque
|
||||
|
||||
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_PLANE_PLUS_LINE_POLICIES_H
|
||||
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_PLANE_PLUS_LINE_POLICIES_H
|
||||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_policy_base.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_functions.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_composed_policies.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_plane_policies.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_line_policies.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
|
||||
template<typename TriangleMesh, typename GeomTraits>
|
||||
class GarlandHeckbert_plane_plus_line_policies
|
||||
: public GarlandHeckbert_composed_policies<TriangleMesh, GeomTraits,
|
||||
GarlandHeckbert_plane_policies<TriangleMesh, GeomTraits>,
|
||||
GarlandHeckbert_line_policies<TriangleMesh, GeomTraits> >
|
||||
{
|
||||
typedef GarlandHeckbert_composed_policies<TriangleMesh, GeomTraits,
|
||||
GarlandHeckbert_plane_policies<TriangleMesh, GeomTraits>,
|
||||
GarlandHeckbert_line_policies<TriangleMesh, GeomTraits> > Base;
|
||||
|
||||
public:
|
||||
typedef typename Base::Quadric_calculator Quadric_calculator;
|
||||
|
||||
typedef typename GeomTraits::FT FT;
|
||||
|
||||
public:
|
||||
GarlandHeckbert_plane_plus_line_policies(TriangleMesh& tmesh,
|
||||
const FT dm = FT(100),
|
||||
const FT line_weight=FT(0.01))
|
||||
: Base(tmesh, FT(1.)/line_weight, dm)
|
||||
{ }
|
||||
|
||||
public:
|
||||
using Base::operator();
|
||||
using Base::get_cost;
|
||||
using Base::get_placement;
|
||||
};
|
||||
|
||||
} // namespace Surface_mesh_simplification
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_PLANE_PLUS_LINE_POLICIES_H
|
||||
|
|
@ -21,12 +21,15 @@
|
|||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_triangle_policies.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_probabilistic_plane_policies.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_probabilistic_triangle_policies.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_line_policies.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_composed_policies.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_plane_plus_line_policies.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
|
||||
template<typename TriangleMesh, typename GeomTraits>
|
||||
using GarlandHeckbert_policies CGAL_DEPRECATED = GarlandHeckbert_plane_policies<TriangleMesh, GeomTraits>;
|
||||
using GarlandHeckbert_policies = GarlandHeckbert_plane_plus_line_policies<TriangleMesh, GeomTraits>;
|
||||
|
||||
} // namespace Surface_mesh_simplification
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
Loading…
Reference in New Issue