Merge pull request #8018 from janetournois/PMP-add_bbox_to_face_graph-jtournois

New function `PMP::add_bbox(face_graph)` that adds bbox to face graph
This commit is contained in:
Laurent Rineau 2024-04-05 14:25:17 +02:00
commit 708711e7a7
66 changed files with 436 additions and 64 deletions

View File

@ -23,7 +23,6 @@ Number_types
Polyhedron
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_sorting
Stream_support

View File

@ -34,6 +34,7 @@ ALIASES += "bgllink{1}=<a href=\"http://www.boost.org/libs/graph/doc/\1.html\">
EXTRACT_ALL=NO
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
WARN_IF_INCOMPLETE_DOC = NO
# macros to be used inside the code
ALIASES += "cgalAssociatedTypesBegin=<dl class=\"params\"><dt>Associated Types</dt><dd> <table class=\"params\">"

View File

@ -449,6 +449,9 @@ the requirement for traversal of all faces in a graph.
/// \defgroup PkgBGLHelperFct Helper Functions
/// \ingroup PkgBGLRef
/// \defgroup PkgBGLGeneratorFct Generator Functions
/// \ingroup PkgBGLRef
/// \defgroup PkgBGLIterators Iterators and Circulators
/// \ingroup PkgBGLRef
@ -520,7 +523,14 @@ by attaching and initializing external IDs to the elements of the graph.
Generic convenience functions for testing if an edge is a border edge, if a mesh is triangular,
for conversion between models of different `FaceGraph` concepts, etc.
Most functions are in the header file `<CGAL/boost/graph/helpers.h>`
All functions are in the header file `<CGAL/boost/graph/helpers.h>`
*/
/*!
\addtogroup PkgBGLGeneratorrFct
Generic convenience functions for generating meshes such as a triangle, a quad, or a grid.
All functions are in the header file `<CGAL/boost/graph/generators.h>`
*/
/*!
@ -667,7 +677,10 @@ user might encounter.
- `CGAL::is_valid_face_graph()`
- `CGAL::is_valid_polygon_mesh()`
- `CGAL::is_tetrahedron()`
- `CGAL::is_tetrahedron()
`
\cgalCRPSection{Generator Functions}
- `CGAL::is_hexahedron()`
- `CGAL::make_triangle()`
- `CGAL::make_tetrahedron()`

View File

@ -2,7 +2,7 @@
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/selection.h>
#include <CGAL/boost/graph/IO/OFF.h>
#include <CGAL/Random.h>
#include <fstream>
#include <iostream>

View File

@ -4,6 +4,7 @@
#include <CGAL/boost/graph/Graph_with_descriptor_with_graph.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/graph/generators.h>
#include <fstream>

View File

@ -1,5 +1,6 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/boost/graph/io.h>

View File

@ -19,23 +19,15 @@
#include <CGAL/Random.h>
#include <CGAL/function_objects.h>
#include <CGAL/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/boost/graph/copy_face_graph.h>
#include <array>
#include <iterator>
#include <vector>
namespace CGAL {
namespace Euler {
// Some forward declaration to break the helpers.h > generators.h > Euler_operations.h cycle
template< typename Graph>
void fill_hole(typename boost::graph_traits<Graph>::halfedge_descriptor h,
Graph& g);
template<typename Graph , typename VertexRange >
typename boost::graph_traits<Graph>::face_descriptor add_face(const VertexRange& vr,
Graph& g);
} // namespace Euler
namespace internal {
@ -126,7 +118,7 @@ random_face_in_mesh(const Graph& g, CGAL::Random& rnd = get_default_random())
} // namespace internal
/**
* \ingroup PkgBGLHelperFct
* \ingroup PkgBGLGeneratorFct
*
* \brief creates an isolated triangle
* with its vertices initialized to `p0`, `p1` and `p2`, and adds it to the graph `g`.
@ -256,7 +248,7 @@ struct Default_grid_maker
} // namespace internal
/**
* \ingroup PkgBGLHelperFct
* \ingroup PkgBGLGeneratorFct
*
* \brief creates an isolated quad with
* its vertices initialized to `p0`, `p1`, `p2`, and `p3`, and adds it to the graph `g`.
@ -287,17 +279,35 @@ make_quad(const P& p0, const P& p1, const P& p2, const P& p3, Graph& g)
}
/**
* \ingroup PkgBGLHelperFct
* \ingroup PkgBGLGeneratorFct
* \brief creates an isolated hexahedron
* with its vertices initialized to `p0`, `p1`, ...\ , and `p7`, and adds it to the graph `g`.
* \image html hexahedron.png
* \image latex hexahedron.png
* \returns the halfedge that has the target vertex associated with `p0`, in the face with the vertices with the points `p0`, `p1`, `p2`, and `p3`.
* \returns the halfedge that has the target vertex associated with `p0`,
* in the face with the vertices with the points `p0`, `p1`, `p2`, and `p3`
* (or `p0`, `p2` and `p3` when `do_not_triangulate` is set to `false`).
*
* \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
* \param np an optional sequence of \ref bgl_namedparameters "Named Parameters"
* among the ones listed below
* \cgalNamedParamsBegin
* \cgalParamNBegin{do_not_triangulate_faces}
* \cgalParamDescription{a Boolean used to specify whether the hexadron's faces
* should be triangulated or not.
* The default value is `true`, and faces are not triangulated.}
* \cgalParamDefault{true}
* \cgalParamNEnd
* \cgalNamedParamsEnd
**/
template<typename Graph, typename P>
template<typename P,
typename Graph,
typename NamedParameters = parameters::Default_named_parameters>
typename boost::graph_traits<Graph>::halfedge_descriptor
make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3,
const P& p4, const P& p5, const P& p6, const P& p7, Graph& g)
const P& p4, const P& p5, const P& p6, const P& p7,
Graph& g,
const NamedParameters& np = parameters::default_values())
{
typedef typename boost::graph_traits<Graph> Traits;
typedef typename Traits::halfedge_descriptor halfedge_descriptor;
@ -306,6 +316,9 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3,
typedef typename boost::property_map<Graph,vertex_point_t>::type Point_property_map;
Point_property_map ppmap = get(CGAL::vertex_point, g);
const bool triangulate = !parameters::choose_parameter(
parameters::get_parameter(np, internal_np::do_not_triangulate_faces), true);
vertex_descriptor v0, v1, v2, v3, v4, v5, v6, v7;
v0 = add_vertex(g);
v1 = add_vertex(g);
@ -326,6 +339,14 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3,
halfedge_descriptor ht = internal::make_quad(v4, v5, v6, v7, g);
halfedge_descriptor hb = prev(internal::make_quad(v0, v3, v2, v1, g), g);
std::array<halfedge_descriptor, 6> he_faces;
if(triangulate)
{
he_faces[0] = hb;
he_faces[1] = ht;
}
for(int i=0; i <4; ++i)
{
halfedge_descriptor h = halfedge(add_edge(g), g);
@ -342,14 +363,72 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3,
for(int i=0; i <4; ++i)
{
Euler::fill_hole(opposite(hb, g), g);
if(triangulate)
he_faces[i+2] = opposite(hb, g);
hb = next(hb, g);
}
if(triangulate)
{
for (halfedge_descriptor hi : he_faces)
{
halfedge_descriptor nnhi = next(next(hi, g), g);
Euler::split_face(hi, nnhi, g);
}
}
return next(next(hb, g), g);
}
/**
* \ingroup PkgBGLHelperFct
* \ingroup PkgBGLGeneratorFct
* \brief creates an isolated hexahedron
* equivalent to `c`, and adds it to the graph `g`.
* \returns the halfedge that has the target vertex associated with `c.min()`,
* aligned with x-axis,
* in the bottom face of the cuboid.
*
* \tparam IsoCuboid a model of `IsoCuboid_3`
* \tparam Graph a model of `MutableFaceGraph`
* \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
*
* \param c the iso-cuboid describing the geometry of the hexahedron
* \param g the graph to which the hexahedron will be appended
* \param np an optional sequence of \ref bgl_namedparameters "Named Parameters"
* among the ones listed below
* \cgalNamedParamsBegin
* \cgalParamNBegin{do_not_triangulate_faces}
* \cgalParamDescription{a Boolean used to specify whether the hexadron's faces
* should be triangulated or not.
* The default value is `true`, and faces are not triangulated.}
* \cgalParamDefault{true}
* \cgalParamNEnd
* \cgalParamNBegin{geom_traits}
* \cgalParamDescription{an instance of a geometric traits class model of `Kernel`.}
* \cgalParamNEnd
* \cgalNamedParamsEnd
**/
template<typename IsoCuboid,
typename Graph,
typename NamedParameters = parameters::Default_named_parameters>
typename boost::graph_traits<Graph>::halfedge_descriptor
make_hexahedron(const IsoCuboid& c,
Graph& g,
const NamedParameters& np = parameters::default_values())
{
using GT = typename GetGeomTraits<Graph, NamedParameters>::type;
GT gt = parameters::choose_parameter<GT>(
parameters::get_parameter(np, internal_np::geom_traits));
typename GT::Construct_vertex_3 v = gt.construct_vertex_3_object();
return CGAL::make_hexahedron(v(c, 0), v(c, 1), v(c, 2), v(c, 3),
v(c, 4), v(c, 5), v(c, 6), v(c, 7),
g,
np);
}
/**
* \ingroup PkgBGLGeneratorFct
* \brief creates an isolated tetrahedron
* with its vertices initialized to `p0`, `p1`, `p2`, and `p3`, and adds it to the graph `g`.
* \image html tetrahedron.png
@ -447,7 +526,7 @@ make_tetrahedron(const P& p0, const P& p1, const P& p2, const P& p3, Graph& g)
}
/**
* \ingroup PkgBGLHelperFct
* \ingroup PkgBGLGeneratorFct
*
* \brief creates a triangulated regular prism, outward oriented,
* having `nb_vertices` vertices in each of its bases and adds it to the graph `g`.
@ -547,7 +626,7 @@ make_regular_prism(typename boost::graph_traits<Graph>::vertices_size_type nb_ve
}
/**
* \ingroup PkgBGLHelperFct
* \ingroup PkgBGLGeneratorFct
* \brief creates a pyramid, outward oriented, having `nb_vertices` vertices in its base and adds it to the graph `g`.
*
* If `center` is `(0, 0, 0)`, then the first point of the base is `(radius, 0, 0)`
@ -635,7 +714,7 @@ make_pyramid(typename boost::graph_traits<Graph>::vertices_size_type nb_vertices
}
/**
* \ingroup PkgBGLHelperFct
* \ingroup PkgBGLGeneratorFct
*
* \brief creates an icosahedron, outward oriented, centered in `center` and adds it to the graph `g`.
*
@ -730,7 +809,7 @@ make_icosahedron(Graph& g,
}
/*!
* \ingroup PkgBGLHelperFct
* \ingroup PkgBGLGeneratorFct
*
* \brief creates a row major ordered grid with `i` cells along the width and `j` cells
* along the height and adds it to the graph `g`.

View File

@ -1081,8 +1081,5 @@ int halfedge_index_in_face(typename boost::graph_traits<Graph>::halfedge_descrip
} // namespace CGAL
// Here at the bottom because helpers.h must include generators (for backward compatibility reasons),
// and Euler_operations.h needs helpers.h
#include <CGAL/boost/graph/generators.h>
#endif // CGAL_BOOST_GRAPH_HELPERS_H

View File

@ -2,7 +2,7 @@
#include <iostream>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/generators.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::Point_3 Point_3;

View File

@ -1,6 +1,7 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/graph/generators.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_3 Point_3;

View File

@ -2,6 +2,7 @@
#include "test_Prefix.h"
#include <boost/range/distance.hpp>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/IO/OFF.h>
#include <CGAL/Polygon_mesh_processing/border.h>

View File

@ -2,6 +2,7 @@
#include <CGAL/boost/graph/Face_filtered_graph.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/Polygon_mesh_processing/connected_components.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/use.h>
#include "test_Prefix.h"

View File

@ -1,6 +1,7 @@
#include <CGAL/Surface_mesh.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/graph/generators.h>
#include <vector>
#include <iostream>

View File

@ -21,7 +21,6 @@ Number_types
Polygon
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_sorting
Stream_support

View File

@ -20,6 +20,5 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Stream_support

View File

@ -28,7 +28,6 @@ Polygon
Polyhedron
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_sorting
Stream_support

View File

@ -33,6 +33,7 @@
#include <CGAL/Number_types/internal/Exact_type_selector.h>
#include <CGAL/boost/graph/copy_face_graph.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/Named_function_parameters.h>
#include <CGAL/boost/graph/graph_traits_Triangulation_data_structure_2.h>
#include <CGAL/boost/graph/properties_Triangulation_data_structure_2.h>

View File

@ -11,9 +11,9 @@
#include <CGAL/Linear_cell_complex_for_generalized_map.h>
#include <CGAL/boost/graph/graph_traits_Arrangement_2.h>
#include <CGAL/boost/graph/graph_traits_Triangulation_2.h>
#include <CGAL/boost/graph/generators.h>
#include <map>
#include <boost/unordered_map.hpp>
#include <CGAL/boost/graph/helpers.h>
typedef CGAL::Simple_cartesian<double> Kernel;

View File

@ -12,7 +12,6 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Solver_interface
Stream_support

View File

@ -70,6 +70,8 @@ Release date: October 2023
`CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` that refines a soup of triangles so that no pair of triangles intersects
in their interiors. Also added, the function `autorefine()` operating directly on a triangle mesh and updating it
using the aforementioned function on a triangle soup.
- Added the function `CGAL::Polygon_mesh_processing::add_bbox()` that enables to add a tight or extended, triangulated or not,
bounding box to a face graph.
### [2D Arrangements](https://doc.cgal.org/6.0/Manual/packages.html#PkgArrangementOnSurface2)
- Fixed a bug in the zone construction code applied to arrangements of geodesic arcs on a sphere,

View File

@ -102,6 +102,12 @@ dilates the bounding box by a specified number of ULP.
*/
void dilate(int dist);
/*!
scales the bounding box by `factor`, while keeping its center fixed.
\pre `factor > 0`
*/
void scale(double factor);
/// @}
}; /* end Bbox_2 */

View File

@ -115,6 +115,13 @@ Bbox_3& operator+=(const Bbox_3 &c);
dilates the bounding box by a specified number of ULP.
*/
void dilate(int dist);
/*!
scales the bounding box by `factor`, while keeping its center fixed.
\pre `factor > 0`
*/
void scale(double factor);
/// @}
}; /* end Bbox_3 */

View File

@ -71,6 +71,7 @@ public:
inline Bbox_2& operator+=(const Bbox_2 &b);
inline void dilate(int dist);
inline void scale(double factor);
};
inline
@ -170,6 +171,25 @@ Bbox_2::dilate(int dist)
rep[3] = float_advance(rep[3],dist);
}
inline
void
Bbox_2::scale(double factor)
{
CGAL_precondition(factor > 0);
if(factor == 1.)
return;
std::array<double, 2> half_width = { (xmax() - xmin()) * 0.5,
(ymax() - ymin()) * 0.5 };
std::array<double, 2> center = { xmin() + half_width[0],
ymin() + half_width[1] };
rep[0] = center[0] - factor * half_width[0];
rep[1] = center[1] - factor * half_width[1];
rep[2] = center[0] + factor * half_width[0];
rep[3] = center[1] + factor * half_width[1];
}
inline
bool
do_overlap(const Bbox_2 &bb1, const Bbox_2 &bb2)

View File

@ -76,7 +76,8 @@ public:
Bbox_3 operator+(const Bbox_3& b) const;
Bbox_3& operator+=(const Bbox_3& b);
void dilate(int dist);
inline void dilate(int dist);
inline void scale(double factor);
};
inline
@ -200,6 +201,28 @@ Bbox_3::dilate(int dist)
rep[5] = float_advance(rep[5],dist);
}
inline
void
Bbox_3::scale(double factor)
{
CGAL_precondition(factor > 0);
if (factor == 1.)
return;
std::array<double, 3> half_width = { (xmax() - xmin()) * 0.5,
(ymax() - ymin()) * 0.5,
(zmax() - zmin()) * 0.5 };
std::array<double, 3> center = { xmin() + half_width[0],
ymin() + half_width[1],
zmin() + half_width[2] };
rep[0] = center[0] - factor * half_width[0];
rep[1] = center[1] - factor * half_width[1];
rep[2] = center[2] - factor * half_width[2];
rep[3] = center[0] + factor * half_width[0];
rep[4] = center[1] + factor * half_width[1];
rep[5] = center[2] + factor * half_width[2];
}
inline
bool

View File

@ -24,6 +24,5 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Stream_support

View File

@ -17,6 +17,7 @@
#include <CGAL/Linear_cell_complex_constructors.h>
#include <CGAL/Triangulation_2_to_lcc.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Random.h>
#include <fstream>
// #define LCC_TRACE_TEST_BEGIN 1

View File

@ -29,7 +29,6 @@ Polygon
Polyhedron
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_sorting
Stream_support

View File

@ -27,6 +27,7 @@
#include <CGAL/Point_3.h>
#include <CGAL/Vector_3.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/named_params_helper.h>
#undef CGAL_NEF_DEBUG
#define CGAL_NEF_DEBUG 29

View File

@ -29,7 +29,6 @@ Polygon_mesh_processing
Polyhedron
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_sorting
Stream_support

View File

@ -24,6 +24,7 @@
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/Convex_hull_traits_3.h>
#include <CGAL/Default.h>

View File

@ -15,14 +15,16 @@
#include <CGAL/license/Polygon_mesh_processing/miscellaneous.h>
#include <CGAL/Bbox_3.h>
#include <boost/graph/graph_traits.hpp>
#include <CGAL/boost/graph/generators.h>
#include <boost/graph/graph_traits.hpp>
#include <CGAL/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <vector>
namespace CGAL {
namespace Polygon_mesh_processing {
@ -54,6 +56,14 @@ namespace CGAL {
* `Construct_bbox_3` must provide the functor `Bbox_3 operator()(Point_3)`
* where `%Point_3` is the value type of the vertex point map.}
* \cgalParamNEnd
*
* \cgalParamNBegin{bbox_scaling}
* \cgalParamDescription{a double used to scale the bounding box.
* The default value is 1 and the bounding box is the smallest possible
* axis-aligned bounding box.}
* \cgalParamDefault{1.}
* \cgalParamPrecondition{`bbox_scaling > 0`}
* \cgalParamNEnd
* \cgalNamedParamsEnd
*
* @see `vertex_bbox()`
@ -75,6 +85,9 @@ namespace CGAL {
GT gt = choose_parameter<GT>(get_parameter(np, internal_np::geom_traits));
typename GT::Construct_bbox_3 get_bbox = gt.construct_bbox_3_object();
const double factor = choose_parameter(get_parameter(np, internal_np::bbox_scaling), 1.);
CGAL_precondition(factor > 0);
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
CGAL::Bbox_3 bb;
@ -82,6 +95,8 @@ namespace CGAL {
{
bb += get_bbox( get(vpm, v) );
}
bb.scale(factor);
return bb;
}
@ -255,6 +270,66 @@ namespace CGAL {
}
return bb;
}
/*!
* \ingroup PkgPolygonMeshProcessingRef
*
* adds an axis-aligned bounding box to a polygon mesh.
*
* @tparam PolygonMesh a model of `MutableFaceGraph`
* @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
*
* @param pmesh a polygon mesh
* @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below
*
* \cgalNamedParamsBegin
* \cgalParamNBegin{bbox_scaling}
* \cgalParamDescription{a double used to scale the bounding box.
* The default value is 1 and the bounding box is the smallest possible
* axis-aligned bounding box.}
* \cgalParamDefault{1.}
* \cgalParamPrecondition{`bbox_scaling > 0`}
* \cgalParamNEnd
* \cgalParamNBegin{do_not_triangulate_faces}
* \cgalParamDescription{a Boolean used to specify whether the bounding box's faces
* should be triangulated or not.
* The default value is `true`, and faces are not triangulated.}
* \cgalParamDefault{true}
* \cgalParamNEnd
* \cgalParamNBegin{vertex_point_map}
* \cgalParamDescription{a property map associating points to the vertices of `pmesh`}
* \cgalParamType{a class model of `ReadWritePropertyMap` with `boost::graph_traits<PolygonMesh>::%vertex_descriptor`
* as key type and `%Point_3` as value type}
* \cgalParamDefault{`boost::get(CGAL::vertex_point, pmesh)`}
* \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t`
* must be available in `PolygonMesh`.}
* \cgalParamNEnd
* \cgalParamNBegin{geom_traits}
* \cgalParamDescription{an instance of a geometric traits class model of `Kernel`.}
* \cgalParamNEnd
* \cgalNamedParamsEnd
*
* @see `bbox()`
*/
template<typename PolygonMesh,
typename NamedParameters = parameters::Default_named_parameters>
void add_bbox(PolygonMesh& pmesh,
const NamedParameters& np = parameters::default_values())
{
using parameters::choose_parameter;
using parameters::get_parameter;
using GT = typename GetGeomTraits<PolygonMesh, NamedParameters>::type;
using P = typename GT::Point_3;
GT gt = choose_parameter<GT>(get_parameter(np, internal_np::geom_traits));
typename GT::Construct_iso_cuboid_3
iso_cuboid = gt.construct_iso_cuboid_3_object();
const CGAL::Bbox_3 bb = bbox(pmesh, np);
CGAL::make_hexahedron(iso_cuboid(P(bb.xmin(), bb.ymin(), bb.zmin()),
P(bb.xmax(), bb.ymax(), bb.zmax())),
pmesh, np);
}
}
}

View File

@ -27,6 +27,7 @@
#include <CGAL/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/Polygon_mesh_processing/border.h>
#include <CGAL/Polygon_mesh_processing/compute_normal.h>

View File

@ -1,7 +1,7 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/Polygon_mesh_processing/connected_components.h>
#include <CGAL/property_map.h>

View File

@ -1,7 +1,7 @@
#include <CGAL/Polygon_mesh_processing/transform.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Aff_transformation_3.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -5,6 +5,7 @@
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/boost/graph/copy_face_graph.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/Dynamic_property_map.h>
#include <CGAL/Polyhedron_3.h>

View File

@ -28,7 +28,6 @@ Principal_component_analysis
Principal_component_analysis_LGPL
Profiling_tools
Property_map
Random_numbers
STL_Extension
Solver_interface
Spatial_searching

View File

@ -8,6 +8,7 @@
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/subdivision_method_3.h>
#include <CGAL/Kernel_traits.h>

View File

@ -15,6 +15,7 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
#include <CGAL/boost/graph/generators.h>
#include "Selection_visualizer.h"
#include "Scene_plane_item.h"

View File

@ -3,6 +3,8 @@
#include <CGAL/Three/Scene_item.h>
#include <CGAL/Three/Scene_interface.h>
#include <CGAL/boost/graph/generators.h>
#include <QAction>
#include <QMainWindow>
#include <QMessageBox>
@ -164,7 +166,7 @@ bbox(bool extended)
Scene_item* item;
EPICK::Iso_cuboid_3 ic(bbox);
SMesh* p = new SMesh;
CGAL::make_hexahedron(ic[0], ic[1], ic[2], ic[3], ic[4], ic[5], ic[6], ic[7], *p);
CGAL::make_hexahedron(ic, *p);
item = new Scene_surface_mesh_item(p);
item->setName(name + (extended ? " (Extended Bbox)" : " (Bbox)"));

View File

@ -7,6 +7,7 @@
#include <CGAL/Three/Viewer_interface.h>
#include <CGAL/Three/Three.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/generators.h>
#include <QAction>
#include <QMainWindow>
#include <QApplication>

View File

@ -11,6 +11,7 @@
#include <CGAL/bounding_box.h>
#include <CGAL/linear_least_squares_fitting_3.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/generators.h>
#include "Kernel_type.h"
#include <CGAL/Three/Three.h>

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddBboxDialog</class>
<widget class="QDialog" name="AddBboxDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>413</width>
<height>108</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="triangulate_bbox">
<property name="text">
<string>Triangulate bbox</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Scaling :</string>
</property>
</widget>
</item>
<item>
<widget class="DoubleEdit" name="bbox_scaling"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<customwidgets>
<customwidget>
<class>DoubleEdit</class>
<extends>QLineEdit</extends>
<header location="global">CGAL_double_edit.h</header>
</customwidget>
</customwidgets>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AddBboxDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AddBboxDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -131,14 +131,13 @@ target_link_libraries(
PUBLIC scene_surface_mesh_item scene_polylines_item
scene_points_with_normal_item)
qt6_wrap_ui( repairUI_FILES RemoveNeedlesDialog.ui SelfSnapDialog.ui)
qt6_wrap_ui( repairUI_FILES RemoveNeedlesDialog.ui SelfSnapDialog.ui AddBboxDialog.ui)
polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin ${repairUI_FILES} KEYWORDS PMP)
target_link_libraries(repair_polyhedron_plugin PUBLIC scene_points_with_normal_item scene_surface_mesh_item scene_polygon_soup_item)
if(TARGET CGAL::TBB_support)
target_link_libraries(repair_polyhedron_plugin PUBLIC CGAL::TBB_support)
endif()
if(TARGET CGAL::Eigen3_support)
qt6_wrap_ui(isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui)
polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin

View File

@ -25,6 +25,7 @@
#include "ui_RemoveNeedlesDialog.h"
#include "ui_SelfSnapDialog.h"
#include "ui_AddBboxDialog.h"
#include <cmath>
#include <limits>
#include <vector>
@ -60,6 +61,7 @@ public:
actionAutorefineAndRMSelfIntersections = new QAction(tr("Autorefine and Remove Self-Intersections (Deprecated)"), mw);
actionRemoveNeedlesAndCaps = new QAction(tr("Remove Needles And Caps"));
actionSnapBorders = new QAction(tr("Snap Boundaries"));
actionAddBbox = new QAction(tr("Add Bounding Box"));
actionRemoveIsolatedVertices->setObjectName("actionRemoveIsolatedVertices");
actionRemoveDegenerateFaces->setObjectName("actionRemoveDegenerateFaces");
@ -73,6 +75,7 @@ public:
actionAutorefineAndRMSelfIntersections->setObjectName("actionAutorefineAndRMSelfIntersections");
actionRemoveNeedlesAndCaps->setObjectName("actionRemoveNeedlesAndCaps");
actionSnapBorders->setObjectName("actionSnapBorders");
actionAddBbox->setObjectName("actionAddBbox");
actionRemoveDegenerateFaces->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental");
actionStitchCloseBorderHalfedges->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental");
@ -85,6 +88,7 @@ public:
actionNewAutorefine->setProperty("subMenuName", "Polygon Mesh Processing/Repair");
actionAutorefineAndRMSelfIntersections->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental");
actionSnapBorders->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental");
actionAddBbox->setProperty("subMenuName", "Polygon Mesh Processing");
autoConnectActions();
}
@ -102,7 +106,8 @@ public:
<< actionNewAutorefine
<< actionAutorefineAndRMSelfIntersections
<< actionRemoveNeedlesAndCaps
<< actionSnapBorders;
<< actionSnapBorders
<< actionAddBbox;
}
bool applicable(QAction* action) const
@ -127,6 +132,8 @@ public:
template <typename Item>
void on_actionRemoveDegenerateFaces_triggered(Scene_interface::Item_id index);
template <typename Item>
void on_actionAddBbox_triggered(Scene_interface::Item_id index);
template <typename Item>
void on_actionRemoveSelfIntersections_triggered(Scene_interface::Item_id index);
template <typename Item>
void on_actionStitchCloseBorderHalfedges_triggered(Scene_interface::Item_id index);
@ -156,6 +163,7 @@ public Q_SLOTS:
void on_actionAutorefineAndRMSelfIntersections_triggered();
void on_actionRemoveNeedlesAndCaps_triggered();
void on_actionSnapBorders_triggered();
void on_actionAddBbox_triggered();
private:
QAction* actionRemoveIsolatedVertices;
@ -170,6 +178,7 @@ private:
QAction* actionAutorefineAndRMSelfIntersections;
QAction* actionRemoveNeedlesAndCaps;
QAction* actionSnapBorders;
QAction* actionAddBbox;
Messages_interface* messages;
}; // end Polyhedron_demo_repair_polyhedron_plugin
@ -365,6 +374,41 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionSnapBorders_triggered()
sm_item->itemChanged();
}
template<typename Item>
void Polyhedron_demo_repair_polyhedron_plugin::on_actionAddBbox_triggered(Scene_interface::Item_id index)
{
Item* poly_item =
qobject_cast<Item*>(scene->item(index));
if (poly_item)
{
QDialog dialog;
Ui::AddBboxDialog ui;
ui.setupUi(&dialog);
ui.triangulate_bbox->setChecked(true);
ui.bbox_scaling->setValue(1.0);
if(dialog.exec() != QDialog::Accepted)
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
const double scaling = ui.bbox_scaling->value();
CGAL::Polygon_mesh_processing::add_bbox(*poly_item->face_graph(),
CGAL::parameters::bbox_scaling(scaling).
do_not_triangulate_faces(!ui.triangulate_bbox->isChecked()));
poly_item->invalidateOpenGLBuffers();
Q_EMIT poly_item->itemChanged();
QApplication::restoreOverrideCursor();
CGAL::Three::Three::information(tr("Bbox has been added (%1 @%)").arg(scaling));
}
}
void Polyhedron_demo_repair_polyhedron_plugin::on_actionAddBbox_triggered()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
on_actionAddBbox_triggered<Scene_surface_mesh_item>(index);
}
template <typename Item>
void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_triggered(Scene_interface::Item_id index)
{

View File

@ -19,6 +19,5 @@ Number_types
Polyhedron
Profiling_tools
Property_map
Random_numbers
STL_Extension
Stream_support

View File

@ -1,6 +1,7 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/generators.h>
#include <string>

View File

@ -2,6 +2,7 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/boost/graph/generators.h>
#if defined(CGAL_USE_OPENMESH)
#include <OpenMesh/Core/IO/MeshIO.hh>

View File

@ -5,6 +5,7 @@
#include <CGAL/MP_Float.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/property_map.h>
#include <CGAL/boost/graph/generators.h>
#include <cassert>

View File

@ -9,7 +9,6 @@ Number_types
Principal_component_analysis_LGPL
Profiling_tools
Property_map
Random_numbers
Ridges_3
STL_Extension
Stream_support

View File

@ -20,7 +20,6 @@ Number_types
Polygon_mesh_processing
Profiling_tools
Property_map
Random_numbers
SMDS_3
STL_Extension
Spatial_sorting

View File

@ -163,6 +163,7 @@ CGAL_add_named_parameter(patch_normal_map_t, patch_normal_map, patch_normal_map)
CGAL_add_named_parameter(region_primitive_map_t, region_primitive_map, region_primitive_map)
CGAL_add_named_parameter(postprocess_regions_t, postprocess_regions, postprocess_regions)
CGAL_add_named_parameter(sizing_function_t, sizing_function, sizing_function)
CGAL_add_named_parameter(bbox_scaling_t, bbox_scaling, bbox_scaling)
// List of named parameters that we use in the package 'Surface Mesh Simplification'
CGAL_add_named_parameter(get_cost_policy_t, get_cost_policy, get_cost)

View File

@ -22,7 +22,6 @@ Number_types
Polyhedron
Profiling_tools
Property_map
Random_numbers
STL_Extension
Skin_surface_3
Spatial_sorting

View File

@ -22,7 +22,6 @@ Polygon
Polygon_mesh_processing
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_sorting
Straight_skeleton_2

View File

@ -9,7 +9,6 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Stream_support
Subdivision_method_3

View File

@ -6,6 +6,7 @@
#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/graph/generators.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_3 Point;

View File

@ -13,7 +13,6 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Stream_support
Surface_mesh

View File

@ -14,7 +14,6 @@ Principal_component_analysis
Principal_component_analysis_LGPL
Profiling_tools
Property_map
Random_numbers
STL_Extension
Solver_interface
Stream_support

View File

@ -13,7 +13,6 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Solver_interface
Stream_support

View File

@ -19,7 +19,6 @@ Number_types
Polygon_mesh_processing
Profiling_tools
Property_map
Random_numbers
STL_Extension
Solver_interface
Spatial_sorting

View File

@ -14,7 +14,6 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_searching
Stream_support

View File

@ -14,7 +14,6 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_searching
Stream_support

View File

@ -20,7 +20,6 @@ Number_types
Polygon_mesh_processing
Profiling_tools
Property_map
Random_numbers
SMDS_3
STL_Extension
Spatial_sorting

View File

@ -8,6 +8,7 @@
#include <CGAL/Tetrahedral_remeshing/Remeshing_triangulation_3.h>
#include <CGAL/tetrahedral_remeshing.h>
#include <CGAL/Tetrahedral_remeshing/tetrahedral_remeshing_io.h>
#include <CGAL/Random.h>
#include <iostream>
#include <fstream>

View File

@ -20,7 +20,6 @@ Modular_arithmetic
Number_types
Profiling_tools
Property_map
Random_numbers
STL_Extension
Spatial_sorting
Stream_support

View File

@ -17,6 +17,7 @@
#include <CGAL/Weights/utils.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/Kernel_traits.h>
#include <CGAL/Point_2.h>
#include <CGAL/Point_3.h>

View File

@ -9,7 +9,6 @@ Number_types
Polygon
Profiling_tools
Property_map
Random_numbers
STL_Extension
Stream_support
Weights