Merge branch 'main' into gsoc2021-Barycentric_coordinates_3-antoniospg

This commit is contained in:
Sven Oesau 2025-09-24 11:06:57 +02:00 committed by GitHub
commit 07fe32849e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1516 changed files with 191153 additions and 14379 deletions

2
.gitattributes vendored
View File

@ -16,7 +16,7 @@
*.py text *.py text
*.xml text *.xml text
*.js text *.js text
*.hmtl text *.html text
*.bib text *.bib text
*.css text *.css text
*.ui text *.ui text

View File

@ -29,6 +29,7 @@ permissions:
jobs: jobs:
pre_build_checks: pre_build_checks:
if: ${{ inputs.pr_number || startsWith(github.event.comment.body, '/build:') || startsWith(github.event.comment.body, '/force-build:') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Trigger the build? name: Trigger the build?
outputs: outputs:

25
.gitignore vendored
View File

@ -1,3 +1,4 @@
build
/*build* /*build*
/*/*/*/build /*/*/*/build
/*/*/*/VC* /*/*/*/VC*
@ -1147,3 +1148,27 @@ Polygonal_surface_reconstruction/examples/build*
Polygonal_surface_reconstruction/test/build* Polygonal_surface_reconstruction/test/build*
Solver_interface/examples/build* Solver_interface/examples/build*
/Mesh_3/examples/Mesh_3/indicator_0.inr.gz /Mesh_3/examples/Mesh_3/indicator_0.inr.gz
/*.off
/*.xyz
/r0*
all_segments.polylines.txt
Data/data/meshes/*.*.edge
Data/data/meshes/*.*.ele
Data/data/meshes/*.*.face
Data/data/meshes/*.*.mesh
Data/data/meshes/*.*.node
Data/data/meshes/*.*.smesh
Data/data/meshes/*.*.vtk
Data/data/meshes/*.log
Data/data/meshes/*.off-cdt-output.off
dump_*.off
dump_*.txt
dump-*.binary.cgal
dump-*.polylines.txt
dump-*.xyz
dump.off.mesh
log.txt
patches_after_merge.ply
CMakeUserPresets.json
/.cache
compile_commands.json

View File

@ -1,4 +1,4 @@
/// \defgroup PkgAABBTreeRef AABB Tree Reference /// \defgroup PkgAABBTreeRef Reference Manual
/// \defgroup PkgAABBTreeConcepts Concepts /// \defgroup PkgAABBTreeConcepts Concepts
/// \ingroup PkgAABBTreeRef /// \ingroup PkgAABBTreeRef

View File

@ -106,7 +106,7 @@ it is used only for distance computations.
\warning Having degenerate primitives in the AABB-tree is not recommended as the underlying \warning Having degenerate primitives in the AABB-tree is not recommended as the underlying
predicates and constructions of the traits class might not be able to handle them. predicates and constructions of the traits class might not be able to handle them.
For example if one is using `CGAL::AABB_traits` with a Kernel from \cgal, For example if one is using `CGAL::AABB_traits` with a Kernel from \cgal,
having degenerate triangles or segments in the AABB-tree will results in an undefined having degenerate triangles or segments in the AABB-tree will result in an undefined
behavior or a crash. behavior or a crash.
\section aabb_tree_examples Examples \section aabb_tree_examples Examples
@ -197,9 +197,9 @@ The AABB tree example folder contains three examples of trees
constructed with custom primitives. In \ref AABB_tree/AABB_custom_example.cpp "AABB_custom_example.cpp" constructed with custom primitives. In \ref AABB_tree/AABB_custom_example.cpp "AABB_custom_example.cpp"
the primitive contains triangles which are defined by three pointers the primitive contains triangles which are defined by three pointers
to custom points. In \ref AABB_tree/AABB_custom_triangle_soup_example.cpp "AABB_custom_triangle_soup_example.cpp" all input to custom points. In \ref AABB_tree/AABB_custom_triangle_soup_example.cpp "AABB_custom_triangle_soup_example.cpp" all input
triangles are stored into a single array so as to form a triangle triangles are stored into a single array as to form a triangle
soup. The primitive internally uses a `boost::iterator_adaptor` so as soup. The primitive internally uses a `boost::iterator_adaptor`
to provide the three functions `AABBPrimitive::id()`, `AABBPrimitive::datum()`, as to provide the three functions `AABBPrimitive::id()`, `AABBPrimitive::datum()`,
and `AABBPrimitive::reference_point()`) required by the primitive concept. In and `AABBPrimitive::reference_point()`) required by the primitive concept. In
\ref AABB_tree/AABB_custom_indexed_triangle_set_example.cpp "AABB_custom_indexed_triangle_set_example.cpp" the input is an indexed \ref AABB_tree/AABB_custom_indexed_triangle_set_example.cpp "AABB_custom_indexed_triangle_set_example.cpp" the input is an indexed
triangle set stored through two arrays: one array of points and one triangle set stored through two arrays: one array of points and one
@ -213,7 +213,7 @@ contains a set of polyhedron triangle facets. We measure the tree
construction time, the memory occupancy and the number of queries per construction time, the memory occupancy and the number of queries per
second for a variety of intersection and distance queries. The machine second for a variety of intersection and distance queries. The machine
used is a PC running Windows XP64 with an Intel CPU Core2 Extreme used is a PC running Windows XP64 with an Intel CPU Core2 Extreme
clocked at 3.06 GHz with 4GB of RAM. By default the kernel used is clocked at 3.06 GHz with 4GB of RAM. By default, the kernel used is
`Simple_cartesian<double>` (the fastest in our experiments). The `Simple_cartesian<double>` (the fastest in our experiments). The
program has been compiled with Visual C++ 2005 compiler with the O2 program has been compiled with Visual C++ 2005 compiler with the O2
option which maximizes speed. option which maximizes speed.
@ -244,7 +244,7 @@ internal KD-tree). It increases to approximately 150 bytes per
primitive when constructing the internal KD-tree with one reference primitive when constructing the internal KD-tree with one reference
point per primitive (the default mode when calling the function point per primitive (the default mode when calling the function
`AABB_tree::accelerate_distance_queries()`). Note that the polyhedron `AABB_tree::accelerate_distance_queries()`). Note that the polyhedron
facet primitive primitive stores only one facet handle as primitive id facet primitive stores only one facet handle as primitive id
and computes on the fly a 3D triangle from the facet handle stored and computes on the fly a 3D triangle from the facet handle stored
internally. When explicitly storing a 3D triangle in the primitive the internally. When explicitly storing a 3D triangle in the primitive the
tree occupies approximately 140 bytes per primitive instead of 60 tree occupies approximately 140 bytes per primitive instead of 60
@ -340,7 +340,7 @@ inside the bounding box.
The experiments described above are neither exhaustive nor conclusive The experiments described above are neither exhaustive nor conclusive
as we have chosen one specific case where the input primitives are the as we have chosen one specific case where the input primitives are the
facets of a triangle surface polyhedron. Nevertheless we now provide facets of a triangle surface polyhedron. Nevertheless, we now provide
some general observations and advises about how to put the AABB tree some general observations and advises about how to put the AABB tree
to use with satisfactory performances. While the tree construction to use with satisfactory performances. While the tree construction
times and memory occupancy do not fluctuate much in our experiments times and memory occupancy do not fluctuate much in our experiments

View File

@ -27,7 +27,7 @@ void triangle_mesh(std::string fname)
typedef CGAL::AABB_tree<Traits> Tree; typedef CGAL::AABB_tree<Traits> Tree;
TriangleMesh tmesh; TriangleMesh tmesh;
if(!CGAL::IO::read_polygon_mesh(fname, tmesh) || CGAL::is_triangle_mesh(tmesh)) if(!CGAL::IO::read_polygon_mesh(fname, tmesh) || !CGAL::is_triangle_mesh(tmesh))
{ {
std::cerr << "Invalid input." << std::endl; std::cerr << "Invalid input." << std::endl;
return; return;

View File

@ -395,15 +395,15 @@ public:
public: public:
CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_true) const CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_true) const
{ {
return GeomTraits().do_intersect_2_object() return do_intersect_circle_iso_rectangle_2
(GeomTraits().construct_circle_2_object() (GeomTraits().construct_circle_2_object()
(p, GeomTraits().compute_squared_distance_2_object()(p, bound)), bb,true)? (p, GeomTraits().compute_squared_distance_2_object()(p, bound)), bb)?
CGAL::SMALLER : CGAL::LARGER; CGAL::SMALLER : CGAL::LARGER;
} }
CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_false) const CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_false) const
{ {
return GeomTraits().do_intersect_2_object() return do_intersect_circle_iso_rectangle_2
(GeomTraits().construct_circle_2_object() (GeomTraits().construct_circle_2_object()
(p, GeomTraits().compute_squared_distance_2_object()(p, bound)), bb)? (p, GeomTraits().compute_squared_distance_2_object()(p, bound)), bb)?
CGAL::SMALLER : CGAL::LARGER; CGAL::SMALLER : CGAL::LARGER;
@ -433,6 +433,45 @@ public:
CGAL::SMALLER : CGAL::SMALLER :
CGAL::LARGER; CGAL::LARGER;
} }
typename GeomTraits::Boolean do_intersect_circle_iso_rectangle_2(const typename GeomTraits::Circle_2& circle,
const typename GeomTraits::Iso_rectangle_2& rec) const
{
typedef typename GeomTraits::FT FT;
typedef typename GeomTraits::Point_2 Point;
Point center = circle.center();
// Check that the minimum distance to the box is smaller than the radius, otherwise there is
// no intersection. `distance` stays at 0 if the center is inside or on `rec`.
FT distance = FT(0);
if (center.x() < rec.xmin())
{
FT d = rec.xmin() - center.x();
distance += d * d;
}
else if (center.x() > rec.xmax())
{
FT d = center.x() - rec.xmax();
distance += d * d;
}
if (center.y() < rec.ymin())
{
FT d = rec.ymin() - center.y();
distance += d * d;
}
else if (center.y() > rec.ymax())
{
FT d = center.y() - rec.ymax();
distance += d * d;
}
if (distance <= circle.squared_radius())
return true;
return false;
}
}; };
Closest_point closest_point_object() const {return Closest_point(*this);} Closest_point closest_point_object() const {return Closest_point(*this);}

View File

@ -302,12 +302,11 @@ public:
typename AT::Bounding_box operator()(ConstPrimitiveIterator first, typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond) const ConstPrimitiveIterator beyond) const
{ {
typename AT::Bounding_box bbox = m_traits.compute_bbox(*first,m_traits.bbm); return std::accumulate(first, beyond,
for(++first; first != beyond; ++first) typename AT::Bounding_box{} /* empty bbox */,
{ [this](const typename AT::Bounding_box& bbox, const Primitive& pr) {
bbox = bbox + m_traits.compute_bbox(*first,m_traits.bbm); return bbox + m_traits.compute_bbox(pr, m_traits.bbm);
} });
return bbox;
} }
}; };

View File

@ -199,9 +199,7 @@ namespace CGAL {
} }
/// returns the axis-aligned bounding box of the whole tree. /// returns the axis-aligned bounding box of the whole tree.
/// \pre `!empty()`
const Bounding_box bbox() const { const Bounding_box bbox() const {
CGAL_precondition(!empty());
if(size() > 1) if(size() > 1)
return root_node()->bbox(); return root_node()->bbox();
else else

View File

@ -0,0 +1,80 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits_2.h>
#include <CGAL/AABB_triangle_primitive_2.h>
#include <CGAL/IO/polygon_soup_io.h>
#include <array>
#include <iostream>
#include <string>
#include <vector>
template<typename Kernel>
void test(const std::vector<CGAL::Simple_cartesian<double>::Point_2> &points, const std::vector<std::array<std::size_t, 3> > &faces) {
using Point_2 = typename Kernel::Point_2;
using Triangle_2 = typename Kernel::Triangle_2;
using Iterator = typename std::vector<Triangle_2>::const_iterator;
using Primitive = CGAL::AABB_triangle_primitive_2<Kernel, Iterator>;
using Tree_traits = CGAL::AABB_traits_2<Kernel, Primitive>;
using Tree = CGAL::AABB_tree<Tree_traits>;
std::vector<Triangle_2> triangles(faces.size());
for (std::size_t i = 0; i < faces.size(); ++i) {
const auto& f = faces[i];
triangles[i] = Triangle_2(Point_2(points[f[0]].x(), points[f[0]].y()), Point_2(points[f[1]].x(), points[f[1]].y()), Point_2(points[f[2]].x(), points[f[2]].y()));
}
Tree tree(triangles.begin(), triangles.end());
// Without hint
Point_2 query(-0.092372499264859229, -0.5067061545706153);
Point_2 closest_point = tree.closest_point(query);
std::cout << "Closest point to " << query << " is " << closest_point << std::endl;
// With hint
Point_2 hint(-0.077185400000000001, -0.42269299999999999);
Point_2 closest_point_hint = tree.closest_point(query, hint);
std::cout << "Closest point to " << query << " with hint " << hint << " is " << closest_point_hint << std::endl << std::endl;
assert(closest_point == closest_point_hint);
}
int main(int argc, char** argv)
{
std::cout.precision(17);
// Read the input
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/camel.off");
std::cout << "Reading " << filename << "..." << std::endl;
std::vector<CGAL::Simple_cartesian<double>::Point_3> points;
std::vector<std::array<std::size_t, 3> > faces;
if (!CGAL::IO::read_polygon_soup(filename, points, faces) || faces.empty())
{
std::cerr << "Invalid input:" << filename << std::endl;
return EXIT_FAILURE;
}
std::cout << "Input: " << points.size() << " points, " << faces.size() << " faces" << std::endl;
// Project onto the XY plane
std::vector<CGAL::Simple_cartesian<double>::Point_2> points_2(points.size());
for (std::size_t i = 0; i < points.size(); ++i)
points_2[i] = CGAL::Simple_cartesian<double>::Point_2(points[i].x(), points[i].y());
std::cout << "Testing closest point with Simple_cartesian<double>:" << std::endl;
test<CGAL::Simple_cartesian<double> >(points_2, faces);
std::cout << "Testing closest point with Epick:" << std::endl;
test<CGAL::Exact_predicates_inexact_constructions_kernel>(points_2, faces);
std::cout << "Testing closest point with Epeck:" << std::endl;
test<CGAL::Exact_predicates_exact_constructions_kernel>(points_2, faces);
std::cout << "Testing closest point with Simple_cartesian<Exact_rational>:" << std::endl;
test<CGAL::Simple_cartesian<CGAL::Exact_rational>>(points_2, faces);
std::cout << "Done." << std::endl;
return EXIT_SUCCESS;
}

View File

@ -49,7 +49,7 @@ We describe next the algorithm and provide examples.
\note A \ref tuto_reconstruction "detailed tutorial on surface reconstruction" \note A \ref tuto_reconstruction "detailed tutorial on surface reconstruction"
is provided with a guide to choose the most appropriate method along is provided with a guide to choose the most appropriate method along
with pre- and post-processing. with pre- and postprocessing.
\section AFSR_Definitions Definitions and the Algorithm \section AFSR_Definitions Definitions and the Algorithm

View File

@ -1,4 +1,4 @@
/// \defgroup PkgAdvancingFrontSurfaceReconstructionRef Advancing Front Surface Reconstruction Reference /// \defgroup PkgAdvancingFrontSurfaceReconstructionRef Reference Manual
/// \defgroup PkgAdvancingFrontSurfaceReconstructionRefConcepts Concepts /// \defgroup PkgAdvancingFrontSurfaceReconstructionRefConcepts Concepts
/// \ingroup PkgAdvancingFrontSurfaceReconstructionRef /// \ingroup PkgAdvancingFrontSurfaceReconstructionRef

View File

@ -382,7 +382,7 @@ namespace CGAL {
int _facet_number; int _facet_number;
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// For post-processing // For postprocessing
mutable int _postprocessing_counter; mutable int _postprocessing_counter;
int _size_before_postprocessing; int _size_before_postprocessing;
@ -2432,7 +2432,7 @@ namespace CGAL {
std::size_t itmp, L_v_size_mem; std::size_t itmp, L_v_size_mem;
L_v_size_mem = L_v.size(); L_v_size_mem = L_v.size();
if ((vh_on_border_inserted != 0)&& // to post-process only the borders if ((vh_on_border_inserted != 0)&& // to postprocess only the borders
(L_v.size() < .1 * _size_before_postprocessing)) (L_v.size() < .1 * _size_before_postprocessing))
{ {
{ {

View File

@ -15,7 +15,7 @@ As a consequence types representing polynomials, algebraic extensions and
finite fields play a more important role in related implementations. finite fields play a more important role in related implementations.
This package has been introduced to stay abreast of these changes. This package has been introduced to stay abreast of these changes.
Since in particular polynomials must be supported by the introduced framework Since in particular polynomials must be supported by the introduced framework
the package avoids the term <I>number type</I>. Instead the package distinguishes the package avoids the term <I>number type</I>. Instead, the package distinguishes
between the <I>algebraic structure</I> of a type and whether a type is embeddable on between the <I>algebraic structure</I> of a type and whether a type is embeddable on
the real axis, or <I>real embeddable</I> for short. the real axis, or <I>real embeddable</I> for short.
Moreover, the package introduces the notion of <I>interoperable</I> types which Moreover, the package introduces the notion of <I>interoperable</I> types which
@ -45,11 +45,11 @@ the operations 'sqrt', 'k-th root' and 'real root of a polynomial',
respectively. The concept `IntegralDomainWithoutDivision` also respectively. The concept `IntegralDomainWithoutDivision` also
corresponds to integral domains in the algebraic sense, the corresponds to integral domains in the algebraic sense, the
distinction results from the fact that some implementations of distinction results from the fact that some implementations of
integral domains lack the (algebraically always well defined) integral integral domains lack the (algebraically always well-defined) integral
division. division.
Note that `Field` refines `IntegralDomain`. This is because Note that `Field` refines `IntegralDomain`. This is because
most ring-theoretic notions like greatest common divisors become trivial for most ring-theoretic notions like greatest common divisors become trivial for
`Field`s. Hence we see `Field` as a refinement of `Field`s. Hence, we see `Field` as a refinement of
`IntegralDomain` and not as a `IntegralDomain` and not as a
refinement of one of the more advanced ring concepts. refinement of one of the more advanced ring concepts.
If an algorithm wants to rely on gcd or remainder computation, it is trying If an algorithm wants to rely on gcd or remainder computation, it is trying
@ -80,12 +80,12 @@ using overloaded functions. However, for ease of use and backward
compatibility all functionality is also compatibility all functionality is also
accessible through global functions defined within namespace `CGAL`, accessible through global functions defined within namespace `CGAL`,
e.g., \link sqrt `CGAL::sqrt(x)` \endlink. This is realized via function templates using e.g., \link sqrt `CGAL::sqrt(x)` \endlink. This is realized via function templates using
the according functor of the traits class. For an overview see the according functor of the traits class. For an overview see the section "Global Functions" in the
Section \ref PkgAlgebraicFoundationsRef in the reference manual. \ref PkgAlgebraicFoundationsRef.
\subsection Algebraic_foundationsTagsinAlgebraicStructure Tags in Algebraic Structure Traits \subsection Algebraic_foundationsTagsinAlgebraicStructure Tags in Algebraic Structure Traits
\subsection Algebraic_foundationsAlgebraicCategory Algebraic Category \subsubsection Algebraic_foundationsAlgebraicCategory Algebraic Category
For a type `AS`, `Algebraic_structure_traits<AS>` For a type `AS`, `Algebraic_structure_traits<AS>`
provides several tags. The most important tag is the `Algebraic_category` provides several tags. The most important tag is the `Algebraic_category`
@ -100,7 +100,7 @@ The tags are derived from each other such that they reflect the
hierarchy of the algebraic structure concept, e.g., hierarchy of the algebraic structure concept, e.g.,
`Field_with_sqrt_tag` is derived from `Field_tag`. `Field_with_sqrt_tag` is derived from `Field_tag`.
\subsection Algebraic_foundationsExactandNumericalSensitive Exact and Numerical Sensitive \subsubsection Algebraic_foundationsExactandNumericalSensitive Exact and Numerical Sensitive
Moreover, `Algebraic_structure_traits<AS>` provides the tags `Is_exact` Moreover, `Algebraic_structure_traits<AS>` provides the tags `Is_exact`
and `Is_numerical_sensitive`, which are both `Boolean_tag`s. and `Is_numerical_sensitive`, which are both `Boolean_tag`s.
@ -119,7 +119,7 @@ Conversely, types as `leda_real` or `CORE::Expr` are exact but sensitive
to numerical issues due to the internal use of multi precision floating point to numerical issues due to the internal use of multi precision floating point
arithmetic. We expect that `Is_numerical_sensitive` is used for dispatching arithmetic. We expect that `Is_numerical_sensitive` is used for dispatching
of algorithms, while `Is_exact` is useful to enable assertions that can be of algorithms, while `Is_exact` is useful to enable assertions that can be
check for exact types only. checked for exact types only.
Tags are very useful to dispatch between alternative implementations. Tags are very useful to dispatch between alternative implementations.
The following example illustrates a dispatch for `Field`s using overloaded The following example illustrates a dispatch for `Field`s using overloaded
@ -134,7 +134,7 @@ category tags reflect the algebraic structure hierarchy.
Most number types represent some subset of the real numbers. From those types Most number types represent some subset of the real numbers. From those types
we expect functionality to compute the sign, absolute value or double we expect functionality to compute the sign, absolute value or double
approximations. In particular we can expect an order on such a type that approximations. In particular, we can expect an order on such a type that
reflects the order along the real axis. reflects the order along the real axis.
All these properties are gathered in the concept `::RealEmbeddable`. All these properties are gathered in the concept `::RealEmbeddable`.
The concept is orthogonal to the algebraic structure concepts, The concept is orthogonal to the algebraic structure concepts,
@ -190,12 +190,12 @@ In general mixed operations are provided by overloaded operators and
functions or just via implicit constructor calls. functions or just via implicit constructor calls.
This level of interoperability is reflected by the concept This level of interoperability is reflected by the concept
`ImplicitInteroperable`. However, within template code the result type, `ImplicitInteroperable`. However, within template code the result type,
or so called coercion type, of a mixed arithmetic operation may be unclear. or so-called coercion type, of a mixed arithmetic operation may be unclear.
Therefore, the package introduces `Coercion_traits` Therefore, the package introduces `Coercion_traits`
giving access to the coercion type via \link Coercion_traits::Type `Coercion_traits<A,B>::Type` \endlink giving access to the coercion type via \link Coercion_traits::Type `Coercion_traits<A,B>::Type` \endlink
for two interoperable types `A` and `B`. for two interoperable types `A` and `B`.
Some trivial example are `int` and `double` with coercion type double Some trivial examples are `int` and `double` with coercion type double
or `Gmpz` and `Gmpq` with coercion type `Gmpq`. or `Gmpz` and `Gmpq` with coercion type `Gmpq`.
However, the coercion type is not necessarily one of the input types, However, the coercion type is not necessarily one of the input types,
e.g. the coercion type of a polynomial e.g. the coercion type of a polynomial
@ -269,7 +269,7 @@ The package is part of \cgal since release 3.3. Of course the package is based
on the former Number type support of CGAL. This goes back to Stefan Schirra and Andreas Fabri. But on the other hand the package is to a large extend influenced on the former Number type support of CGAL. This goes back to Stefan Schirra and Andreas Fabri. But on the other hand the package is to a large extend influenced
by the experience with the number type support in \exacus \cgalCite{beh-eeeafcs-05}, by the experience with the number type support in \exacus \cgalCite{beh-eeeafcs-05},
which in the main goes back to which in the main goes back to
Lutz Kettner, Susan Hert, Arno Eigenwillig and Michael Hemmer. Lutz Kettner, Susan Hert, Arno Eigenwillig, and Michael Hemmer.
However, the package abstracts from the pure support for However, the package abstracts from the pure support for
number types that are embedded on the real axis which allows the support of number types that are embedded on the real axis which allows the support of
polynomials, finite fields, and algebraic extensions as well. See also related polynomials, finite fields, and algebraic extensions as well. See also related

View File

@ -1,4 +1,4 @@
/// \defgroup PkgAlgebraicFoundationsRef Algebraic Foundations Reference /// \defgroup PkgAlgebraicFoundationsRef Reference Manual
/// \defgroup PkgAlgebraicFoundationsAlgebraicStructuresConcepts Concepts /// \defgroup PkgAlgebraicFoundationsAlgebraicStructuresConcepts Concepts
/// \ingroup PkgAlgebraicFoundationsRef /// \ingroup PkgAlgebraicFoundationsRef

View File

@ -146,8 +146,8 @@ polynomial is not computed yet.
This is in particular relevant in relation to the `AlgebraicKernel_d_2`, This is in particular relevant in relation to the `AlgebraicKernel_d_2`,
where `AlgebraicKernel_d_1::Algebraic_real_1` is used to represent coordinates of solutions of bivariate systems. where `AlgebraicKernel_d_1::Algebraic_real_1` is used to represent coordinates of solutions of bivariate systems.
Hence, the design does Hence, the design does
not allow a direct access to any, seemingly obvious, members of an not allow direct access to any, seemingly obvious, members of an
`AlgebraicKernel_d_1::Algebraic_real_1`. Instead there is, e.g., `AlgebraicKernel_d_1::Algebraic_real_1`. Instead, there is, e.g.,
`AlgebraicKernel_d_1::Compute_polynomial_1` which emphasizes `AlgebraicKernel_d_1::Compute_polynomial_1` which emphasizes
that the requested polynomial may not be computed yet. Similarly, that the requested polynomial may not be computed yet. Similarly,
there is no way to directly ask for the refinement of the current there is no way to directly ask for the refinement of the current

View File

@ -1,4 +1,4 @@
/// \defgroup PkgAlgebraicKernelDRef Algebraic Kernel Reference /// \defgroup PkgAlgebraicKernelDRef Reference Manual
/// \defgroup PkgAlgebraicKernelDConcepts Concepts /// \defgroup PkgAlgebraicKernelDConcepts Concepts
/// \ingroup PkgAlgebraicKernelDRef /// \ingroup PkgAlgebraicKernelDRef

View File

@ -46,7 +46,7 @@ class Root_for_circles_2_2 {
Root_for_circles_2_2(const Root_of_2& r1, const Root_of_2& r2) Root_for_circles_2_2(const Root_of_2& r1, const Root_of_2& r2)
: x_(r1), y_(r2) : x_(r1), y_(r2)
{ {
// When it is an interval this assertion dont compile // When it is an interval this assertion doesn't compile
//CGAL_assertion((r1.is_rational() || r2.is_rational()) || //CGAL_assertion((r1.is_rational() || r2.is_rational()) ||
// (r1.gamma() == r2.gamma())); // (r1.gamma() == r2.gamma()));
} }

View File

@ -35,8 +35,8 @@ of this process in 2D (where our ice-cream spoon is simply a circle).
Alpha shapes depend on a parameter \f$ \alpha\f$ after which they are named. Alpha shapes depend on a parameter \f$ \alpha\f$ after which they are named.
In the ice-cream analogy above, \f$ \alpha\f$ is the squared radius of the In the ice-cream analogy above, \f$ \alpha\f$ is the squared radius of the
carving spoon. A very small value will allow us to eat up all of the carving spoon. A very small value will allow us to eat up all the
ice-cream except the chocolate points themselves. Thus we already see ice-cream except the chocolate points themselves. Thus, we already see
that the \f$ \alpha\f$-shape degenerates to the point-set \f$ S\f$ for that the \f$ \alpha\f$-shape degenerates to the point-set \f$ S\f$ for
\f$ \alpha \rightarrow 0\f$. On the other hand, a huge value of \f$ \alpha\f$ \f$ \alpha \rightarrow 0\f$. On the other hand, a huge value of \f$ \alpha\f$
will prevent us even from moving the spoon between two points since will prevent us even from moving the spoon between two points since
@ -53,7 +53,7 @@ We distinguish two versions of alpha shapes. <I>Basic alpha shapes</I>
are based on the Delaunay triangulation. <I>Weighted alpha shapes</I> are based on the Delaunay triangulation. <I>Weighted alpha shapes</I>
are based on its generalization, the regular triangulation are based on its generalization, the regular triangulation
(cf. Section \ref Section_2D_Triangulations_Regular "Regular Triangulations"), (cf. Section \ref Section_2D_Triangulations_Regular "Regular Triangulations"),
replacing the euclidean distance by the power to weighted points. replacing the Euclidean distance by the power to weighted points.
There is a close connection between alpha shapes and the underlying There is a close connection between alpha shapes and the underlying
triangulations. More precisely, the \f$ \alpha\f$-complex of \f$ S\f$ is a triangulations. More precisely, the \f$ \alpha\f$-complex of \f$ S\f$ is a
@ -100,7 +100,7 @@ It provides iterators to enumerate the vertices and edges that are in
the \f$ \alpha\f$-shape, and functions that allow to classify vertices, the \f$ \alpha\f$-shape, and functions that allow to classify vertices,
edges and faces with respect to the \f$ \alpha\f$-shape. They can be in edges and faces with respect to the \f$ \alpha\f$-shape. They can be in
the interior of a face that belongs or does not belong to the \f$ \alpha\f$-shape. the interior of a face that belongs or does not belong to the \f$ \alpha\f$-shape.
They can be singular/regular, that is be on the boundary of the \f$ \alpha\f$-shape, They can be singular/regular, that is, they can be on the boundary of the \f$ \alpha\f$-shape,
but not incident/incident to a triangle of the \f$ \alpha\f$-complex. but not incident/incident to a triangle of the \f$ \alpha\f$-complex.
Finally, it provides a function to determine the \f$ \alpha\f$-value Finally, it provides a function to determine the \f$ \alpha\f$-value
@ -213,7 +213,7 @@ cube will be chosen and no optimizations will be used.
It is also recommended to switch the triangulation to 1-sheeted It is also recommended to switch the triangulation to 1-sheeted
covering if possible. Note that a periodic triangulation in 9-sheeted covering if possible. Note that a periodic triangulation in 9-sheeted
covering space is degenerate. In this case, an exact constructions covering space is degenerate. In this case, an exact constructions
kernel needs to be used to compute the alpha shapes. Otherwise the kernel needs to be used to compute the alpha shapes. Otherwise, the
results will suffer from round-off problems. results will suffer from round-off problems.
\cgalExample{Alpha_shapes_2/ex_periodic_alpha_shapes_2.cpp} \cgalExample{Alpha_shapes_2/ex_periodic_alpha_shapes_2.cpp}

View File

@ -1,4 +1,4 @@
/// \defgroup PkgAlphaShapes2Ref 2D Alpha Shapes Reference /// \defgroup PkgAlphaShapes2Ref Reference Manual
/// \defgroup PkgAlphaShapes2Concepts Concepts /// \defgroup PkgAlphaShapes2Concepts Concepts
/// \ingroup PkgAlphaShapes2Ref /// \ingroup PkgAlphaShapes2Ref

View File

@ -34,8 +34,8 @@ of this process in 2D (where our ice-cream spoon is simply a circle).
Alpha shapes depend on a parameter \f$ \alpha\f$ after which they are named. Alpha shapes depend on a parameter \f$ \alpha\f$ after which they are named.
In the ice-cream analogy above, \f$ \alpha\f$ is the squared radius of the In the ice-cream analogy above, \f$ \alpha\f$ is the squared radius of the
carving spoon. A very small value will allow us to eat up all of the carving spoon. A very small value will allow us to eat up all the
ice-cream except the chocolate points themselves. Thus we already see ice-cream except the chocolate points themselves. Thus, we already see
that the alpha shape degenerates to the point-set \f$ S\f$ for that the alpha shape degenerates to the point-set \f$ S\f$ for
\f$ \alpha \rightarrow 0\f$. On the other hand, a huge value of \f$ \alpha\f$ \f$ \alpha \rightarrow 0\f$. On the other hand, a huge value of \f$ \alpha\f$
will prevent us even from moving the spoon between two points since will prevent us even from moving the spoon between two points since
@ -53,7 +53,7 @@ We distinguish two versions of alpha shapes. <I>Basic alpha shapes</I>
are based on the Delaunay triangulation. <I>Weighted alpha shapes</I> are based on the Delaunay triangulation. <I>Weighted alpha shapes</I>
are based on its generalization, the regular triangulation are based on its generalization, the regular triangulation
(cf. Section \ref Triangulation3secclassRegulartriangulation "Regular Triangulations"), (cf. Section \ref Triangulation3secclassRegulartriangulation "Regular Triangulations"),
replacing the euclidean distance by the power to weighted points. replacing the Euclidean distance by the power to weighted points.
Let us consider the basic case with a Delaunay triangulation. Let us consider the basic case with a Delaunay triangulation.
We first define the alpha complex of the set of points \f$ S\f$. We first define the alpha complex of the set of points \f$ S\f$.
@ -79,7 +79,7 @@ of the alpha complex where singular faces are removed
(See \cgalFigureRef{figgenregex} for an example). (See \cgalFigureRef{figgenregex} for an example).
\cgalFigureBegin{figgenregex,gen-reg-ex.png} \cgalFigureBegin{figgenregex,gen-reg-ex.png}
Comparison of general and regularized alpha-shape. <B>Left:</B> Some points are taken on the surface of a torus, three points being taken relatively far from the surface of the torus; <B>Middle:</B> The general alpha-shape (for a large enough alpha value) contains the singular triangle facet of the three isolated points; <B>Right:</B> The regularized version (for the same value of alpha) does not contains any singular facet. Comparison of general and regularized alpha-shape. <B>Left:</B> Some points are taken on the surface of a torus, three points being taken relatively far from the surface of the torus; <B>Middle:</B> The general alpha-shape (for a large enough alpha value) contains the singular triangle facet of the three isolated points; <B>Right:</B> The regularized version (for the same value of alpha) does not contain any singular facet.
\cgalFigureEnd \cgalFigureEnd
The alpha shapes of a set of points The alpha shapes of a set of points
@ -112,11 +112,11 @@ and radii \f$ r_1, r_2 \f$ are said to be orthogonal iff
iff \f$ C_1C_2 ^2 < r_1^2 + r_2^2\f$. iff \f$ C_1C_2 ^2 < r_1^2 + r_2^2\f$.
For a given value of \f$ \alpha\f$, For a given value of \f$ \alpha\f$,
the weighted alpha complex is formed with the simplices of the the weighted alpha complex is formed with the simplices of the
regular triangulation triangulation regular triangulation such that there is a sphere
such that there is a sphere orthogonal to the weighted points associated orthogonal to the weighted points associated
with the vertices of the simplex and suborthogonal to all the other with the vertices of the simplex and suborthogonal to all the other
input weighted points. Once again the alpha shape is then defined as input weighted points. Once again the alpha shape is then defined as
the domain covered by a the alpha complex and comes in general and the domain covered by the alpha complex and comes in general and
regularized versions. regularized versions.
\section Alpha_Shape_3Functionality Functionality \section Alpha_Shape_3Functionality Functionality
@ -273,7 +273,7 @@ alpha-shape, using the `Alpha_shape_3<Dt,ExactAlphaComparisonTag>` requires a ke
with exact predicates and exact constructions (or setting `ExactAlphaComparisonTag` to `Tag_true`) with exact predicates and exact constructions (or setting `ExactAlphaComparisonTag` to `Tag_true`)
while using a kernel with exact predicates is sufficient for the class `Fixed_alpha_shape_3<Dt>`. while using a kernel with exact predicates is sufficient for the class `Fixed_alpha_shape_3<Dt>`.
This makes the class `Fixed_alpha_shape_3<Dt>` even more efficient in this setting. This makes the class `Fixed_alpha_shape_3<Dt>` even more efficient in this setting.
In addition, note that the `Fixed` version is the only of the In addition, note that the `Fixed` version is the only one of the
two that supports incremental insertion and removal of points. two that supports incremental insertion and removal of points.
We give the time spent while computing the alpha shape of a protein (considered We give the time spent while computing the alpha shape of a protein (considered
@ -345,7 +345,7 @@ cube will be chosen and no optimizations will be used.
It is also recommended to switch the triangulation to 1-sheeted It is also recommended to switch the triangulation to 1-sheeted
covering if possible. Note that a periodic triangulation in 27-sheeted covering if possible. Note that a periodic triangulation in 27-sheeted
covering space is degenerate. In this case, an exact constructions covering space is degenerate. In this case, an exact constructions
kernel needs to be used to compute the alpha shapes. Otherwise the kernel needs to be used to compute the alpha shapes. Otherwise, the
results will suffer from round-off problems. results will suffer from round-off problems.
\cgalExample{Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp} \cgalExample{Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp}

View File

@ -1,4 +1,4 @@
/// \defgroup PkgAlphaShapes3Ref 3D Alpha Shapes Reference /// \defgroup PkgAlphaShapes3Ref Reference Manual
/// \defgroup PkgAlphaShapes3Concepts Concepts /// \defgroup PkgAlphaShapes3Concepts Concepts
/// \ingroup PkgAlphaShapes3Ref /// \ingroup PkgAlphaShapes3Ref
/*! /*!

View File

@ -134,13 +134,13 @@ def main(argv):
avg_diff_str = str(format(abs(avg_diff_to_goal), '.2f')) avg_diff_str = str(format(abs(avg_diff_to_goal), '.2f'))
if key == "Mean_Min_Angle_(degree)" or key == "Mean_Max_Angle_(degree)": if key == "Mean_Min_Angle_(degree)" or key == "Mean_Max_Angle_(degree)":
if avg_diff_to_goal < 0 : if avg_diff_to_goal < 0 :
title += "\nIn average we loose " title += "\nIn average we lose "
else : else :
title += "\nIn average we gain " title += "\nIn average we gain "
title += avg_diff_str + "° toward 60°" title += avg_diff_str + "° toward 60°"
elif key == "Mean_Radius_Ratio" or key == "Mean_Edge_Ratio" or key == "Mean_Aspect_Ratio" : elif key == "Mean_Radius_Ratio" or key == "Mean_Edge_Ratio" or key == "Mean_Aspect_Ratio" :
if avg_diff_to_goal < 0 : if avg_diff_to_goal < 0 :
title += "\nIn average we loose " title += "\nIn average we lose "
else : else :
title += "\nIn average we gain " title += "\nIn average we gain "
title += avg_diff_str + " of ratio toward 1" title += avg_diff_str + " of ratio toward 1"

View File

@ -1,4 +1,4 @@
/// \defgroup PkgAlphaWrap3Ref 3D Alpha Wrapping /// \defgroup PkgAlphaWrap3Ref Reference Manual
/// \defgroup AW3_free_functions_grp Free Functions /// \defgroup AW3_free_functions_grp Free Functions
/// Functions to create a wrap from point clouds, triangle soups, and triangle meshes. /// Functions to create a wrap from point clouds, triangle soups, and triangle meshes.

View File

@ -264,7 +264,7 @@ Secondly, the farther the isosurface is from the input, the more new points are
through the first criterion (i.e., through intersection with dual Voronoi edge, see Section \ref aw3_algorithm); through the first criterion (i.e., through intersection with dual Voronoi edge, see Section \ref aw3_algorithm);
thus, the quality of the output improves in terms of angles of the triangle elements. thus, the quality of the output improves in terms of angles of the triangle elements.
Finally, and depending on the value of the alpha parameter, a large offset can also offer defeaturing capabilities. Finally, and depending on the value of the alpha parameter, a large offset can also offer defeaturing capabilities.
However using a small offset parameter will tend to better preserve sharp features as projection However, using a small offset parameter will tend to better preserve sharp features as projection
Steiner points tend to project onto convex sharp features. Steiner points tend to project onto convex sharp features.
\cgalFigureAnchor{6} \cgalFigureAnchor{6}
@ -278,7 +278,7 @@ Impact of the offset parameter on the output.
The offset parameter is decreasing from left to right, to respectively 1/50, 1/200 and 1/1000 of the longest diagonal of the input bounding box. The offset parameter is decreasing from left to right, to respectively 1/50, 1/200 and 1/1000 of the longest diagonal of the input bounding box.
The alpha parameter is equal to 1/50 of the longest diagonal of the input bounding box for all level of details. The alpha parameter is equal to 1/50 of the longest diagonal of the input bounding box for all level of details.
A larger offset will produce an output less complex with better triangle quality. A larger offset will produce an output less complex with better triangle quality.
However the sharp features (red edges) are well preserved when the offset parameter is small. However, the sharp features (red edges) are well-preserved when the offset parameter is small.
\cgalFigureCaptionEnd \cgalFigureCaptionEnd
\cgalFigureAnchor{7} \cgalFigureAnchor{7}
@ -346,15 +346,15 @@ The charts below plots the computation times of the wrapping algorithm on the Th
\cgalFigureCaptionBegin{9} \cgalFigureCaptionBegin{9}
Execution times and output complexity for different values of alpha on the Thingi10k data set. Execution times and output complexity for different values of alpha on the Thingi10k data set.
Alpha increases from 1/20 to 1/200 of the length of bounding box diagonal. Alpha increases from 1/20 to 1/200 of the length of bounding box diagonal.
The x axis represents the complexity of the output wrap mesh in number of triangle facets. The x-axis represents the complexity of the output wrap mesh in number of triangle facets.
The y axis represents the total computation time, in seconds. The y-axis represents the total computation time, in seconds.
The color and diameter of the dots represent the number of faces in the input triangle soup, The color and diameter of the dots represent the number of faces in the input triangle soup,
ranging from 10 (green) to 3154000 (blue). ranging from 10 (green) to 3154000 (blue).
\cgalFigureCaptionEnd \cgalFigureCaptionEnd
\section aw3_examples Examples \section aw3_examples Examples
Here is an example with an input triangle mesh, with alpha set to 1/20 of the bounding box longest diagonal edge length, Here is an example with an input triangle mesh, with alpha set to 1/20 of the bounding box's longest diagonal edge length,
and offset set to 1/30 of alpha (i.e., 1/600 of the bounding box diagonal edge length). and offset set to 1/30 of alpha (i.e., 1/600 of the bounding box diagonal edge length).
\cgalExample{Alpha_wrap_3/triangle_mesh_wrap.cpp} \cgalExample{Alpha_wrap_3/triangle_mesh_wrap.cpp}

View File

@ -159,7 +159,9 @@ int main(int argc, char** argv)
// edge length of regular tetrahedron with circumradius alpha // edge length of regular tetrahedron with circumradius alpha
const double l = 1.6329931618554521 * alpha; // sqrt(8/3) const double l = 1.6329931618554521 * alpha; // sqrt(8/3)
CGAL::tetrahedral_isotropic_remeshing(tr, l, CGAL::parameters::remesh_boundaries(false)); CGAL::tetrahedral_isotropic_remeshing(tr, l,
CGAL::parameters::remesh_boundaries(false)
.number_of_iterations(5));
std::cout << "AFTER: " << tr.number_of_vertices() << " vertices, " << tr.number_of_cells() << " cells" << std::endl; std::cout << "AFTER: " << tr.number_of_vertices() << " vertices, " << tr.number_of_cells() << " cells" << std::endl;

View File

@ -348,7 +348,7 @@ public:
#ifdef CGAL_AW3_TIMER #ifdef CGAL_AW3_TIMER
t.stop(); t.stop();
std::cout << "Manifoldness post-processing took: " << t.time() << " s." << std::endl; std::cout << "Manifoldness postprocessing took: " << t.time() << " s." << std::endl;
t.reset(); t.reset();
t.start(); t.start();
#endif #endif

View File

@ -17,12 +17,11 @@ concept `ApolloniusSite_2`.
\cgalHeading{I/O} \cgalHeading{I/O}
The I/O operators are defined for `iostream`. The I/O operators are defined for `std::iostream`.
The information output in the `iostream` is: the point of the The information output in the `std::iostream` is: the point of the
Apollonius site and its weight. Apollonius site and its weight.
\sa `CGAL::Qt_widget`
\sa `CGAL::Apollonius_graph_traits_2<K,Method_tag>` \sa `CGAL::Apollonius_graph_traits_2<K,Method_tag>`
\sa `CGAL::Apollonius_graph_filtered_traits_2<CK,CM,EK,EM,FK,FM>` \sa `CGAL::Apollonius_graph_filtered_traits_2<CK,CM,EK,EM,FK,FM>`
*/ */
@ -50,7 +49,6 @@ Apollonius_site_2(const Apollonius_site_2<K>& other);
/*! /*!
Inserts the Inserts the
Apollonius site `s` into the stream `os`. Apollonius site `s` into the stream `os`.
\note Included through `CGAL/IO/Qt_widget_Apollonius_site_2.h`.
\pre The insert operator must be defined for `Point_2` and `Weight`. \pre The insert operator must be defined for `Point_2` and `Weight`.
\relates Apollonius_site_2 \relates Apollonius_site_2
*/ */
@ -59,18 +57,9 @@ std::ostream& operator<<(std::ostream& os, const Apollonius_site_2<K>& s) const;
/*! /*!
Reads an Apollonius site from the stream `is` and assigns it Reads an Apollonius site from the stream `is` and assigns it
to `s`. to `s`.
\note Included through `CGAL/IO/Qt_widget_Apollonius_site_2.h`.
\pre The extract operator must be defined for `Point_2` and `Weight`. \pre The extract operator must be defined for `Point_2` and `Weight`.
\relates Apollonius_site_2 \relates Apollonius_site_2
*/ */
std::istream& operator>>(std::istream& is, const Apollonius_site_2<K>& s); std::istream& operator>>(std::istream& is, const Apollonius_site_2<K>& s);
/*!
Inserts the Apollonius site `s` into the `Qt_widget` stream `w`.
\note Included through `CGAL/IO/Qt_widget_Apollonius_site_2.h`.
\pre The insert operator must be defined for `K::Circle_2`.
\relates Apollonius_site_2
*/
Qt_widget& operator<<(Qt_widget& w, const Apollonius_site_2<K>& s) const;
} /* end namespace CGAL */ } /* end namespace CGAL */

View File

@ -1,4 +1,4 @@
/// \defgroup PkgApolloniusGraph2Ref 2D Apollonius Graphs (Delaunay Graphs of Disks) Reference /// \defgroup PkgApolloniusGraph2Ref Reference Manual
/// \defgroup PkgApolloniusGraph2Concepts Concepts /// \defgroup PkgApolloniusGraph2Concepts Concepts
/// \ingroup PkgApolloniusGraph2Ref /// \ingroup PkgApolloniusGraph2Ref
/*! /*!

View File

@ -77,7 +77,7 @@ private:
public: public:
typedef Voronoi_radius_2<K> Voronoi_radius; typedef Voronoi_radius_2<K> Voronoi_radius;
typedef typename K::Bounded_side Bounded_dide; typedef typename K::Bounded_side Bounded_side;
public: public:
template<class Tag> template<class Tag>

View File

@ -63,7 +63,7 @@ struct Parabola_segment_2 : public Parabola_2< Gt >
} }
int compute_k(const FT tt, const FT STEP) const { int compute_k(const FT tt, const FT STEP) const {
return int(CGAL::to_double(CGAL::sqrt(tt / STEP))); return int(CGAL::to_double(CGAL::approximate_sqrt(tt / STEP)));
} }
// s0 and s1 define a desired drawing "range" // s0 and s1 define a desired drawing "range"

View File

@ -164,7 +164,7 @@
or at least issues warnings about returning a reference to temporary or at least issues warnings about returning a reference to temporary
variable. Can you prompt the INRIA people to fix this? variable. Can you prompt the INRIA people to fix this?
(I personally think that we should remove this example from our test-suite, (I personally think that we should remove this example from our test-suite,
but if the INRIA people believe that it's place is there, they should at but if the INRIA people believe that its place is there, they should at
least properly maintain it ...) least properly maintain it ...)
- There is a problem with the examples that use CORE on Darwin (platform #10). - There is a problem with the examples that use CORE on Darwin (platform #10).
Other Darwin platforms seem fine. Do we want to investigate? (perhaps it's Other Darwin platforms seem fine. Do we want to investigate? (perhaps it's

View File

@ -232,7 +232,7 @@ protected: // methods
// Assumes that clippingRect is valid. // Assumes that clippingRect is valid.
std::vector< X_monotone_curve_2 > visibleParts( X_monotone_curve_2 curve ); std::vector< X_monotone_curve_2 > visibleParts( X_monotone_curve_2 curve );
// keep only the intersection points ie. throw out overlapping curve segments // keep only the intersection points i.e. throw out overlapping curve segments
void filterIntersectionPoints( std::vector< CGAL::Object >& res ); void filterIntersectionPoints( std::vector< CGAL::Object >& res );
protected: // members protected: // members

View File

@ -269,7 +269,7 @@ Kml::Nodes Kml::generate_ids_approx(Placemarks& placemarks, const double eps) {
for (const auto& node : lring->nodes) { for (const auto& node : lring->nodes) {
// check if there is a node sufficiently close to the current one // check if there is a node sufficiently close to the current one
auto node_index = std::numeric_limits<std::size_t>::max(); auto node_index = (std::numeric_limits<std::size_t>::max)();
for (std::size_t i = 0; i < nodes.size(); ++i) { for (std::size_t i = 0; i < nodes.size(); ++i) {
const auto dist = node.distance_to(nodes[i]); const auto dist = node.distance_to(nodes[i]);
if (dist < eps) { if (dist < eps) {
@ -278,7 +278,7 @@ Kml::Nodes Kml::generate_ids_approx(Placemarks& placemarks, const double eps) {
} }
} }
if (node_index == std::numeric_limits<std::size_t>::max()) { if (node_index == (std::numeric_limits<std::size_t>::max)()) {
// insert new node // insert new node
nodes.push_back(node); nodes.push_back(node);
const auto node_id = nodes.size() - 1; const auto node_id = nodes.size() - 1;
@ -301,7 +301,7 @@ Kml::Nodes Kml::generate_ids_approx(Placemarks& placemarks, const double eps) {
} }
// find the pair of closest nodes // find the pair of closest nodes
double min_dist = std::numeric_limits<double>::max(); double min_dist = (std::numeric_limits<double>::max)();
std::size_t ni1 = 0; std::size_t ni1 = 0;
std::size_t ni2 = 0; std::size_t ni2 = 0;
std::size_t num_nodes = nodes.size(); std::size_t num_nodes = nodes.size();

View File

@ -1999,7 +1999,7 @@ operates in two-dimensional surfaces (not restricted to the plane),
(ii) accepts various families of \f$x\f$-monotone curves (not only (ii) accepts various families of \f$x\f$-monotone curves (not only
line segments), and (iii) handles overlaps. (Observe that the original line segments), and (iii) handles overlaps. (Observe that the original
algorithm did not handle overlaps. Handling overlaps is difficult, algorithm did not handle overlaps. Handling overlaps is difficult,
especially for polyline, as two polylines may overlap in more then one especially for polyline, as two polylines may overlap in more than one
connected component.) The generic implementation serves as the connected component.) The generic implementation serves as the
foundation of a family of concrete operations described in the rest of foundation of a family of concrete operations described in the rest of
this section, such as aggregately constructing an arrangement induced this section, such as aggregately constructing an arrangement induced
@ -4196,7 +4196,7 @@ are both parameterized by a geometric kernel and model the concepts
`AosTraits_2` and `AosLandmarkTraits_2`. `AosTraits_2` and `AosLandmarkTraits_2`.
\cgalFootnote{They also model the refined concept \cgalFootnote{They also model the refined concept
\cgalFootnoteCode{AosDirectionalXMonotoneTraits_2}, which enables Boolean set \cgalFootnoteCode{AosDirectionalXMonotoneTraits_2}, which enables Boolean set
operations; see Package \ref PkgBooleanSetOperations2Ref.} The class operations; see Package \ref PkgBooleanSetOperations2.} The class
template `Arr_non_caching_segment_traits_2<Kernel>` derives from the template `Arr_non_caching_segment_traits_2<Kernel>` derives from the
instance `Arr_non_caching_segment_basic_traits_2<Kernel>`, which instance `Arr_non_caching_segment_basic_traits_2<Kernel>`, which
models the `AosLandmarkTraits_2` traits concept but not the models the `AosLandmarkTraits_2` traits concept but not the
@ -4937,7 +4937,7 @@ template models the concepts `AosTraits_2` and
`AosOpenBoundaryTraits_2`, but it does not model the `AosOpenBoundaryTraits_2`, but it does not model the
`AosLandmarkTraits_2` concept. It also models the refined `AosLandmarkTraits_2` concept. It also models the refined
concept `AosDirectionalXMonotoneTraits_2`, which enables concept `AosDirectionalXMonotoneTraits_2`, which enables
Boolean set operations; see Package \ref PkgBooleanSetOperations2Ref. Boolean set operations; see Package \ref PkgBooleanSetOperations2.
Note that it is not a model of `AosLandmarkTraits_2` concept, Note that it is not a model of `AosLandmarkTraits_2` concept,
so it is impossible to use the landmark point-location strategy with so it is impossible to use the landmark point-location strategy with
this traits class. this traits class.
@ -5167,7 +5167,7 @@ Every instance of the `Arr_Bezier_curve_traits_2` class templates
models the concept `AosTraits_2` (but it does not model the models the concept `AosTraits_2` (but it does not model the
`AosLandmarkTraits_2` concept). It also models the refined `AosLandmarkTraits_2` concept). It also models the refined
concept `AosDirectionalXMonotoneTraits_2`, which enables concept `AosDirectionalXMonotoneTraits_2`, which enables
Boolean set operations; see Package \ref PkgBooleanSetOperations2Ref. Boolean set operations; see Package \ref PkgBooleanSetOperations2.
<!-- ----------------------------------------------------------------------- --> <!-- ----------------------------------------------------------------------- -->
\cgalFigureBegin{aos_fig-bezier_curves,bezier_curves.png} \cgalFigureBegin{aos_fig-bezier_curves,bezier_curves.png}

View File

@ -3,7 +3,7 @@ namespace CGAL {
/*! \ingroup PkgArrangementOnSurface2Ref /*! \ingroup PkgArrangementOnSurface2Ref
* *
* `Arr_observer<Arrangement_2>` is an alias for * `Arr_observer<Arrangement_2>` is an alias for
* Aos_observer<Arrangement_on_surface_2>`, * `Aos_observer<Arrangement_on_surface_2>`,
* where `Arrangement_2` derives from `Arrangement_on_surface_2` and the latter * where `Arrangement_2` derives from `Arrangement_on_surface_2` and the latter
* is an instance of the template * is an instance of the template
* `CGAL::Arrangement_on_surface_2<GeometryTraits, TopologyTraits>`. * `CGAL::Arrangement_on_surface_2<GeometryTraits, TopologyTraits>`.

View File

@ -1,4 +1,4 @@
/// \defgroup PkgArrangementOnSurface2Ref 2D Arrangement Reference /// \defgroup PkgArrangementOnSurface2Ref Reference Manual
/// \defgroup PkgArrangementOnSurface2Concepts Concepts /// \defgroup PkgArrangementOnSurface2Concepts Concepts
/// \ingroup PkgArrangementOnSurface2Ref /// \ingroup PkgArrangementOnSurface2Ref

View File

@ -113,7 +113,7 @@ locate(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr,
* *
* If the type Bgt2 is the same as the type Gt2, use a reference to Gt2 * If the type Bgt2 is the same as the type Gt2, use a reference to Gt2
* to avoid constructing a new one. Otherwise, instantiate a local variable * to avoid constructing a new one. Otherwise, instantiate a local variable
* of the former and provide the later as a single parameter to the * of the former and provide the latter as a single parameter to the
* constructor. * constructor.
* *
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has

View File

@ -127,7 +127,11 @@ private:
public: public:
/*! constructs default. /*! constructs default.
*/ */
Arr_conic_traits_2() {} Arr_conic_traits_2()
: m_rat_kernel(std::make_shared<Rat_kernel>()),
m_alg_kernel(std::make_shared<Alg_kernel>()),
m_nt_traits(std::make_shared<Nt_traits>())
{}
/*! constructs from resources. /*! constructs from resources.
*/ */
@ -2500,7 +2504,7 @@ public:
double min_dist = -1; double min_dist = -1;
Integer aux_coeffs[6]; Integer aux_coeffs[6];
for (int k = 1; k <= 2; ++k) { for (int k = 1; k <= 2; ++k) {
// Get the integer coefficients of the k'th auxiliary conic curve. // Get the integer coefficients of the k-th auxiliary conic curve.
aux_rat_coeffs[0] = (k == 1) ? r_1 : r_2; aux_rat_coeffs[0] = (k == 1) ? r_1 : r_2;
aux_rat_coeffs[1] = (k == 1) ? s_1 : s_2; aux_rat_coeffs[1] = (k == 1) ? s_1 : s_2;
aux_rat_coeffs[2] = (k == 1) ? t_1 : t_2; aux_rat_coeffs[2] = (k == 1) ? t_1 : t_2;
@ -2516,7 +2520,7 @@ public:
(CGAL::sign(aux_coeffs[2]) == ZERO)) ? 1 : 2; (CGAL::sign(aux_coeffs[2]) == ZERO)) ? 1 : 2;
// Compute the \f$x\f$- and \f$y\f$-coordinates of intersection points // Compute the \f$x\f$- and \f$y\f$-coordinates of intersection points
// of the base conic and the k'th auxiliary conic. // of the base conic and the k-th auxiliary conic.
int n_xs = compute_resultant_roots(*nt_traits, int n_xs = compute_resultant_roots(*nt_traits,
base_coeffs[0], base_coeffs[1], base_coeffs[0], base_coeffs[1],
base_coeffs[2], base_coeffs[2],

View File

@ -590,7 +590,7 @@ bool _Bezier_cache<NtTraits>::_intersection_params
// Construct the bivariate polynomial that corresponds to Equation I. // Construct the bivariate polynomial that corresponds to Equation I.
// Note that we represent a bivariate polynomial as a vector of univariate // Note that we represent a bivariate polynomial as a vector of univariate
// polynomials, whose i'th entry corresponds to the coefficient of t^i, // polynomials, whose i-th entry corresponds to the coefficient of t^i,
// which is in turn a polynomial it s. // which is in turn a polynomial it s.
const int degX_2 = nt_traits.degree (polyX_2); const int degX_2 = nt_traits.degree (polyX_2);
std::vector<Polynomial> coeffsX_st (degX_2 < 0 ? 1 : (degX_2 + 1)); std::vector<Polynomial> coeffsX_st (degX_2 < 0 ? 1 : (degX_2 + 1));
@ -657,7 +657,7 @@ void _Bezier_cache<NtTraits>::_self_intersection_params
// Construct the bivariate polynomial that corresponds to Equation I. // Construct the bivariate polynomial that corresponds to Equation I.
// Note that we represent a bivariate polynomial as a vector of univariate // Note that we represent a bivariate polynomial as a vector of univariate
// polynomials, whose i'th entry corresponds to the coefficient of t^i, // polynomials, whose i-th entry corresponds to the coefficient of t^i,
// which is in turn a polynomial it s. // which is in turn a polynomial it s.
const int degX = nt_traits.degree (polyX); const int degX = nt_traits.degree (polyX);
CGAL_assertion(degX > 0); CGAL_assertion(degX > 0);
@ -771,7 +771,7 @@ _Bezier_cache<NtTraits>::_compute_resultant
if (nt_traits.degree (mat[i][i]) < 0) if (nt_traits.degree (mat[i][i]) < 0)
{ {
// If the current diagonal value is a zero polynomial, try to replace // If the current diagonal value is a zero polynomial, try to replace
// the current i'th row with a row with a higher index k, such that // the current i-th row with a row with a higher index k, such that
// mat[k][i] is not a zero polynomial. // mat[k][i] is not a zero polynomial.
found_row = false; found_row = false;
@ -786,7 +786,7 @@ _Bezier_cache<NtTraits>::_compute_resultant
if (found_row) if (found_row)
{ {
// Swap the i'th and the k'th rows (note that we start from the i'th // Swap the i-th and the k-th rows (note that we start from the i-th
// column, because the first i entries in every row with index i or // column, because the first i entries in every row with index i or
// higher should be zero by now). // higher should be zero by now).
for (j = i; j < dim; j++) for (j = i; j < dim; j++)
@ -808,7 +808,7 @@ _Bezier_cache<NtTraits>::_compute_resultant
} }
} }
// Zero the whole i'th column of the following rows. // Zero the whole i-th column of the following rows.
for (k = i + 1; k < dim; k++) for (k = i + 1; k < dim; k++)
{ {
if (nt_traits.degree (mat[k][i]) >= 0) if (nt_traits.degree (mat[k][i]) >= 0)
@ -821,7 +821,7 @@ _Bezier_cache<NtTraits>::_compute_resultant
mat[k][j] = mat[k][j] * mat[i][i] - mat[i][j] * value; mat[k][j] = mat[k][j] * mat[i][i] - mat[i][j] * value;
} }
// We multiplied the current row by the i'th diagonal entry, thus // We multiplied the current row by the i-th diagonal entry, thus
// multiplying the determinant value by it. We therefore increment // multiplying the determinant value by it. We therefore increment
// the exponent of mat[i][i] in the normalization factor. // the exponent of mat[i][i] in the normalization factor.
exp_fact[i] = exp_fact[i] + 1; exp_fact[i] = exp_fact[i] + 1;

View File

@ -397,7 +397,7 @@ public:
return static_cast<unsigned int>((this->_rep()._ctrl_pts.size())); return static_cast<unsigned int>((this->_rep()._ctrl_pts.size()));
} }
/*! obtains the i'th control point. /*! obtains the i-th control point.
* \pre i must be between 0 and n - 1, where n is the number of control * \pre i must be between 0 and n - 1, where n is the number of control
* points. * points.
*/ */
@ -681,7 +681,7 @@ void _Bezier_curve_2_rep<RatKer, AlgKer, NtTrt,
px = pts_begin->x(); px = pts_begin->x();
py = pts_begin->y(); py = pts_begin->y();
// By simplifying (1 - t)^(n-k) we obtain that the k'th expression of // By simplifying (1 - t)^(n-k) we obtain that the k-th expression of
// the above sum is given by: // the above sum is given by:
// //
// n-k // n-k

View File

@ -572,7 +572,7 @@ public:
int k; int k;
for (k = 1; k <= 2; ++k) { for (k = 1; k <= 2; ++k) {
// Get the integer coefficients of the k'th auxiliary conic curve. // Get the integer coefficients of the k-th auxiliary conic curve.
aux_rat_coeffs[0] = (k == 1) ? r_1 : r_2; aux_rat_coeffs[0] = (k == 1) ? r_1 : r_2;
aux_rat_coeffs[1] = (k == 1) ? s_1 : s_2; aux_rat_coeffs[1] = (k == 1) ? s_1 : s_2;
aux_rat_coeffs[2] = (k == 1) ? t_1 : t_2; aux_rat_coeffs[2] = (k == 1) ? t_1 : t_2;
@ -593,7 +593,7 @@ public:
} }
// Compute the x- and y-coordinates of intersection points of the base // Compute the x- and y-coordinates of intersection points of the base
// conic and the k'th auxiliary conic. // conic and the k-th auxiliary conic.
n_xs = compute_resultant_roots(nt_traits, n_xs = compute_resultant_roots(nt_traits,
base_coeffs[0], base_coeffs[1], base_coeffs[0], base_coeffs[1],
base_coeffs[2], base_coeffs[2],

View File

@ -1078,7 +1078,7 @@ private:
} }
public: public:
/*! obtains the i'th order derivative by x of the conic at the point p=(x,y). /*! obtains the i-th order derivative by x of the conic at the point p=(x,y).
* \param p The point where we derive. * \param p The point where we derive.
* \param i The order of the derivatives (either 1, 2 or 3). * \param i The order of the derivatives (either 1, 2 or 3).
* \param slope_numer The numerator of the slope. * \param slope_numer The numerator of the slope.
@ -1187,7 +1187,7 @@ public:
CGAL_error(); CGAL_error();
} }
/*! obtains the i'th order derivative by y of the conic at the point p=(x,y). /*! obtains the i-th order derivative by y of the conic at the point p=(x,y).
* \param p The point where we derive. * \param p The point where we derive.
* \param i The order of the derivatives (either 1, 2 or 3). * \param i The order of the derivatives (either 1, 2 or 3).
* \param slope_numer The numerator of the slope. * \param slope_numer The numerator of the slope.

View File

@ -77,7 +77,7 @@ bisect_control_polygon_2(InputIterator ctrl_pts_begin,
while (last_index > 0) while (last_index > 0)
{ {
// Construct (m - 1) control points from the m point we currently have, // Construct (m - 1) control points from the m point we currently have,
// where the new i'th point is the midpoint between p[i] and p[i + 1]. // where the new i-th point is the midpoint between p[i] and p[i + 1].
for (i = 0; i < last_index; ++i) for (i = 0; i < last_index; ++i)
vec[i] = midpoint(vec[i], vec[i + 1]); vec[i] = midpoint(vec[i], vec[i + 1]);
@ -134,7 +134,7 @@ typename InputIterator::value_type point_on_Bezier_curve_2
while (last_index > 0) while (last_index > 0)
{ {
// Construct (m - 1) control points from the m point we currently have, // Construct (m - 1) control points from the m point we currently have,
// where the new i'th point is given by: (1 - t0)*p[i] + t0*p[i + 1]. // where the new i-th point is given by: (1 - t0)*p[i] + t0*p[i + 1].
for (i = 0; i < last_index; ++i) for (i = 0; i < last_index; ++i)
{ {
vec[i] = _Point_2(comp_t0*vec[i].x() + t0*vec[i + 1].x(), vec[i] = _Point_2(comp_t0*vec[i].x() + t0*vec[i + 1].x(),
@ -197,7 +197,7 @@ typename InputIterator::value_type de_Casteljau_2
while (last_index > 0) while (last_index > 0)
{ {
// Construct (m - 1) control points from the m point we currently have, // Construct (m - 1) control points from the m point we currently have,
// where the new i'th point is given by: (1 - t0)*p[i] + t0*p[i + 1]. // where the new i-th point is given by: (1 - t0)*p[i] + t0*p[i + 1].
for (i = 0; i < last_index; ++i) for (i = 0; i < last_index; ++i)
{ {
vec[i] = _Point_2(comp_t0*vec[i].x() + t0*vec[i + 1].x(), vec[i] = _Point_2(comp_t0*vec[i].x() + t0*vec[i + 1].x(),

View File

@ -241,7 +241,7 @@ overlay(const Arrangement_on_surface_2<GeometryTraitsA_2, TopologyTraitsA>& arr1
* If the type Ovl_gt2 is the same as the type * If the type Ovl_gt2 is the same as the type
* GeomTraits, use a reference to GeomTraits to avoid constructing a new one. * GeomTraits, use a reference to GeomTraits to avoid constructing a new one.
* Otherwise, instantiate a local variable of the former and provide * Otherwise, instantiate a local variable of the former and provide
* the later as a single parameter to the constructor. * the latter as a single parameter to the constructor.
* *
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
* only an implicit constructor, (which takes *b as a parameter). * only an implicit constructor, (which takes *b as a parameter).

View File

@ -1992,10 +1992,10 @@ public:
determines according to pre defined conditions whether the determines according to pre defined conditions whether the
current Trapezoidal_decomposition_2<Traits> needs update current Trapezoidal_decomposition_2<Traits> needs update
Postconditions: Postconditions:
The output is true iff the depth of the Trapezoidal Tree is more then The output is true iff the depth of the Trapezoidal Tree is more than
DepthThreshold times log of the X_curve count or the Trapezoidal Tree's DepthThreshold times log of the X_curve count or the Trapezoidal Tree's
size size
is more then SizeThreshold times the log of the last count. is more than SizeThreshold times the log of the last count.
*/ */
bool set_with_guarantees(bool u) bool set_with_guarantees(bool u)
{ {

View File

@ -2625,7 +2625,7 @@ protected:
if ((! is_vert(cv[0]) && (cmp_x(get_min_v(cv[i]), q) == EQUAL)) || if ((! is_vert(cv[0]) && (cmp_x(get_min_v(cv[i]), q) == EQUAL)) ||
(is_vert(cv[0]) && equal(get_min_v(cv[i]), q))) { (is_vert(cv[0]) && equal(get_min_v(cv[i]), q))) {
// q is the left endpoint of the i'th subcurve: // q is the left endpoint of the i-th subcurve:
if (to_right) return i; if (to_right) return i;
else { else {
// to_left // to_left
@ -2642,7 +2642,7 @@ protected:
if ((! is_vert(cv[0]) && (cmp_x(get_max_v(cv[i]), q) == EQUAL)) || if ((! is_vert(cv[0]) && (cmp_x(get_max_v(cv[i]), q) == EQUAL)) ||
(is_vert(cv[0]) && equal(get_max_v(cv[i]), q))) { (is_vert(cv[0]) && equal(get_max_v(cv[i]), q))) {
// q is the right endpoint of the i'th subcurve: // q is the right endpoint of the i-th subcurve:
if (! to_right) return i; if (! to_right) return i;
else { else {
if (direction == SMALLER) { if (direction == SMALLER) {

View File

@ -598,15 +598,15 @@ public:
if (dir == SMALLER){ if (dir == SMALLER){
// Check whether the split point is xcv[i]'s source or target. // Check whether the split point is xcv[i]'s source or target.
if (equal(max_vertex(xcv[i]), p)) { if (equal(max_vertex(xcv[i]), p)) {
// The entire i'th subcurve belongs to xcv1: // The entire i-th subcurve belongs to xcv1:
xcv1.push_back(xcv[i]); xcv1.push_back(xcv[i]);
} }
else if (equal(min_vertex(xcv[i]), p)) { else if (equal(min_vertex(xcv[i]), p)) {
// The entire i'th subcurves belongs to xcv2: // The entire i-th subcurves belongs to xcv2:
xcv2.push_back(xcv[i]); xcv2.push_back(xcv[i]);
} }
else { else {
// The i'th subcurve should be split: The left part(seg1) // The i-th subcurve should be split: The left part(seg1)
// goes to xcv1, and the right part(seg2) goes to xcv2. // goes to xcv1, and the right part(seg2) goes to xcv2.
X_monotone_subcurve_2 seg1, seg2; X_monotone_subcurve_2 seg1, seg2;
m_poly_traits.subcurve_traits_2()->split_2_object()(xcv[i], p, m_poly_traits.subcurve_traits_2()->split_2_object()(xcv[i], p,

View File

@ -281,7 +281,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const
// ----------- // -----------
// cv1 coincide with the identification curve. In this case we // cv1 coincide with the identification curve. In this case we
// consider the identification to be on the right. All (interior) // consider the identification to be on the right. All (interior)
// points are smaller then the right boundary. // points are smaller than the right boundary.
rc1 = SMALLER; rc1 = SMALLER;
rc2 = cmp_x_pt_ce(p, cv2, ARR_MAX_END); rc2 = cmp_x_pt_ce(p, cv2, ARR_MAX_END);
} }
@ -294,7 +294,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const
// ----------- // -----------
// cv2 coincide with the identification curve. In this case we // cv2 coincide with the identification curve. In this case we
// consider the identification to be on the left. All (interior) // consider the identification to be on the left. All (interior)
// points are larger then the left boundary. // points are larger than the left boundary.
rc1 = cmp_x_pt_ce(p, cv1, ARR_MAX_END); rc1 = cmp_x_pt_ce(p, cv1, ARR_MAX_END);
rc2 = LARGER; rc2 = LARGER;
} }

View File

@ -117,7 +117,7 @@ decompose(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr,
* *
* If the type Vgt2 is the same as the type Gt2, use a * If the type Vgt2 is the same as the type Gt2, use a
* reference to Gt2 to avoid constructing a new one. Otherwise, * reference to Gt2 to avoid constructing a new one. Otherwise,
* instantiate a local variable of the former and provide the later as a * instantiate a local variable of the former and provide the latter as a
* single parameter to the constructor. * single parameter to the constructor.
* *
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has

View File

@ -264,7 +264,7 @@ insert_empty(Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr,
* If the type C_visitor::Geometry_traits_2 is the same as the type * If the type C_visitor::Geometry_traits_2 is the same as the type
* GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing * GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing
* a new one. Otherwise, instantiate a local variable of the former and * a new one. Otherwise, instantiate a local variable of the former and
* provide the later as a single parameter to the constructor. * provide the latter as a single parameter to the constructor.
* *
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
* only an implicit constructor, (which takes *b as a parameter). * only an implicit constructor, (which takes *b as a parameter).
@ -319,7 +319,7 @@ void insert_empty(Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>&
* If the type C_visitor::Geometry_traits_2 is the same as the type * If the type C_visitor::Geometry_traits_2 is the same as the type
* GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing * GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing
* a new one. Otherwise, instantiate a local variable of the former and * a new one. Otherwise, instantiate a local variable of the former and
* provide the later as a single parameter to the constructor. * provide the latter as a single parameter to the constructor.
* *
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
* only an implicit constructor, (which takes *b as a parameter). * only an implicit constructor, (which takes *b as a parameter).
@ -372,7 +372,7 @@ void insert_non_empty(Arrangement_on_surface_2<GeometryTraits_2,
* If the type Igt2 is the same as the type * If the type Igt2 is the same as the type
* GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing * GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing
* a new one. Otherwise, instantiate a local variable of the former and * a new one. Otherwise, instantiate a local variable of the former and
* provide the later as a single parameter to the constructor. * provide the latter as a single parameter to the constructor.
* *
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
* only an implicit constructor, (which takes *b as a parameter). * only an implicit constructor, (which takes *b as a parameter).
@ -972,7 +972,7 @@ non_intersecting_insert_non_empty(Arrangement_on_surface_2<GeometryTraits_2,
* If the type Nxi_visitor::Geometry_traits_2 is the same as the type * If the type Nxi_visitor::Geometry_traits_2 is the same as the type
* GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing * GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing
* a new one. Otherwise, instantiate a local variable of the former and * a new one. Otherwise, instantiate a local variable of the former and
* provide the later as a single parameter to the constructor. * provide the latter as a single parameter to the constructor.
* *
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has * Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
* only an implicit constructor, (which takes *b as a parameter). * only an implicit constructor, (which takes *b as a parameter).

View File

@ -541,7 +541,7 @@ public:
for (i = 1; i <= n_roots; i++) for (i = 1; i <= n_roots; i++)
{ {
// Get the i'th real-valued root. // Get the i-th real-valued root.
*oi = rootOf(poly, i); *oi = rootOf(poly, i);
++oi; ++oi;
} }
@ -603,7 +603,7 @@ public:
for (i = 0; i < root_intervals.size(); i++) for (i = 0; i < root_intervals.size(); i++)
{ {
// Get the i'th real-valued root. // Get the i-th real-valued root.
*oi = rootOf(poly, root_intervals[i]); *oi = rootOf(poly, root_intervals[i]);
++oi; ++oi;
} }

View File

@ -197,11 +197,11 @@ public:
void init_subcurve_in_arrangement_flags(size_t n) void init_subcurve_in_arrangement_flags(size_t n)
{ m_isCurveInArr.resize(n, false); } { m_isCurveInArr.resize(n, false); }
/*! checks if the i'th subcurve is in the arrangement. */ /*! checks if the i-th subcurve is in the arrangement. */
bool is_subcurve_in_arrangement(unsigned int i) const bool is_subcurve_in_arrangement(unsigned int i) const
{ return (m_isCurveInArr[i]); } { return (m_isCurveInArr[i]); }
/*! sets the flag indicating whether the i'th subcurve is in the arrangement. /*! sets the flag indicating whether the i-th subcurve is in the arrangement.
*/ */
void set_subcurve_in_arrangement(unsigned int i, bool flag) void set_subcurve_in_arrangement(unsigned int i, bool flag)
{ m_isCurveInArr[i] = flag; } { m_isCurveInArr[i] = flag; }

View File

@ -25,7 +25,7 @@
#include <cstdlib> #include <cstdlib>
#include <random> #include <random>
#include <CGAL/Qt/Basic_viewer.h> #include <CGAL/Basic_viewer.h>
#include <CGAL/Graphics_scene.h> #include <CGAL/Graphics_scene.h>
#include <CGAL/Graphics_scene_options.h> #include <CGAL/Graphics_scene_options.h>
#include <CGAL/Random.h> #include <CGAL/Random.h>
@ -587,8 +587,6 @@ void add_to_graphics_scene(const CGAL_ARR_TYPE& aos,
add_to_graphics_scene(aos, graphics_scene, gso); add_to_graphics_scene(aos, graphics_scene, gso);
} }
#ifdef CGAL_USE_BASIC_VIEWER
/// Draw an arrangement on surface. /// Draw an arrangement on surface.
template <typename GeometryTraits_2, typename TopologyTraits, class GSOptions> template <typename GeometryTraits_2, typename TopologyTraits, class GSOptions>
void draw(const CGAL_ARR_TYPE& aos, const GSOptions& gso, void draw(const CGAL_ARR_TYPE& aos, const GSOptions& gso,
@ -609,8 +607,6 @@ void draw(const CGAL_ARR_TYPE& aos,
draw_graphics_scene(graphics_scene, title); draw_graphics_scene(graphics_scene, title);
} }
#endif // CGAL_USE_BASIC_VIEWER
#undef CGAL_ARR_TYPE #undef CGAL_ARR_TYPE
} // namespace CGAL } // namespace CGAL

View File

@ -563,7 +563,7 @@ template <typename InputStream_>
bool IO_base_test<Base_geom_traits>::read_segment(InputStream_& is, bool IO_base_test<Base_geom_traits>::read_segment(InputStream_& is,
Subcurve_2& seg) Subcurve_2& seg)
{ {
//we dont need to check this type as it has already been checked in the //we don't need to check this type as it has already been checked in the
//IO_test.h //IO_test.h
char type; char type;
is >> type; is >> type;
@ -600,7 +600,7 @@ template <typename InputStream_>
bool IO_base_test<Base_geom_traits>::read_xsegment(InputStream_& is, bool IO_base_test<Base_geom_traits>::read_xsegment(InputStream_& is,
X_monotone_subcurve_2& xseg) X_monotone_subcurve_2& xseg)
{ {
//we dont need to check this type as it has already been checked in the //we don't need to check this type as it has already been checked in the
//IO_test.h //IO_test.h
char type; char type;
is >> type; is >> type;

View File

@ -116,7 +116,7 @@ int main(int argc, char* argv[])
std::cout << argv[2] std::cout << argv[2]
<< " was generated successfully" << " was generated successfully"
<< ", dont forget to add it to test_construction.cmd" << ", don't forget to add it to test_construction.cmd"
<< std::endl; << std::endl;
return 0; return 0;
} }

View File

@ -586,7 +586,7 @@ so that they <em>virtually</em> become border edges when exploring a seam mesh w
The input mesh is referred to as <em>underlying</em> mesh of the seam mesh. The input mesh is referred to as <em>underlying</em> mesh of the seam mesh.
We denote `tm` and `sm` the underlying mesh and the seam mesh respectively. We denote `tm` and `sm` the underlying mesh and the seam mesh respectively.
Figure \cgalFigureRef{fig_Seam_mesh_1} shows an example of mesh on which two \cgalFigureRef{fig_Seam_mesh_1} shows an example of mesh on which two
edges, defined by the halfedge pairs `h2-h3` and `h6-h7`, are marked as seams. edges, defined by the halfedge pairs `h2-h3` and `h6-h7`, are marked as seams.
The introduction of virtual borders modifies the elementary \bgl graph traversal The introduction of virtual borders modifies the elementary \bgl graph traversal
operations: when we circulate around the target of `h7` in the underlying mesh, operations: when we circulate around the target of `h7` in the underlying mesh,
@ -600,7 +600,7 @@ A seam mesh with two seam edges `(h2, h3)` and `(h6, h7)`.
\cgalFigureEnd \cgalFigureEnd
A vertex of the underlying mesh may correspond to multiple vertices in the seam mesh. A vertex of the underlying mesh may correspond to multiple vertices in the seam mesh.
For example in Figure \cgalFigureRef{fig_Seam_mesh_1}, the target of `h7` corresponds to two For example in \cgalFigureRef{fig_Seam_mesh_1}, the target of `h7` corresponds to two
vertices in the seam mesh, on either side of the virtual border created by the seam edges. vertices in the seam mesh, on either side of the virtual border created by the seam edges.
For this reason, a vertex `v` of the seam mesh is internally represented as a halfedge `h` For this reason, a vertex `v` of the seam mesh is internally represented as a halfedge `h`
of the seam mesh. To obtain a canonical definition, the halfedge `h` is defined as the halfedge of the seam mesh. To obtain a canonical definition, the halfedge `h` is defined as the halfedge
@ -612,7 +612,7 @@ For vertices `v` in the underlying mesh that are not on a seam edge, we choose
\subsubsection BGLSeamMeshTraversal Seam Mesh Traversal \subsubsection BGLSeamMeshTraversal Seam Mesh Traversal
Using the function `next(halfedge_descriptor, FaceGraph)`, we can walk around a face but also around Using the function `next(halfedge_descriptor, FaceGraph)`, we can walk around a face but also around
a border of a mesh. For the seam mesh `sm` from Figure \cgalFigureRef{fig_Seam_mesh_1}, a border of a mesh. For the seam mesh `sm` from \cgalFigureRef{fig_Seam_mesh_1},
we have `opposite(h2, sm) == h3*`, and it holds that `face(h3*, sm) == null_face()`. we have `opposite(h2, sm) == h3*`, and it holds that `face(h3*, sm) == null_face()`.
We can walk along this virtual border: starting at `h3*` and repeatedly calling `next(..,sm)`, We can walk along this virtual border: starting at `h3*` and repeatedly calling `next(..,sm)`,
we will traverse `h6*`, `h7*`, `h2*`, before reaching `h3*` again. we will traverse `h6*`, `h7*`, `h2*`, before reaching `h3*` again.
@ -698,7 +698,7 @@ using one of the following tags:
- `CGAL::Alpha_expansion_boost_adjacency_list_tag` (default) - `CGAL::Alpha_expansion_boost_adjacency_list_tag` (default)
- `CGAL::Alpha_expansion_boost_compressed_sparse_raw_tag` - `CGAL::Alpha_expansion_boost_compressed_sparse_raw_tag`
- `CGAL::Alpha_expansion_MaxFlow_tag`, released under GPL - `CGAL::Alpha_expansion_MaxFlow_tag`, released under GPL
license and provided by the \ref PkgSurfaceMeshSegmentationRef license and provided by the \ref PkgSurfaceMeshSegmentation
package package
All these implementations produce the exact same result but behave All these implementations produce the exact same result but behave

View File

@ -62,7 +62,7 @@ returns one of the halfedges corresponding to `e`.
*/ */
template <typename HalfedgeGraph> template <typename HalfedgeGraph>
boost::graph_traits<HalfedgeGraph>::halfedge_descriptor boost::graph_traits<HalfedgeGraph>::halfedge_descriptor
halfedge(boost::graph_traits<HalfedgeGraph>::edge_descriptor f, const HalfedgeGraph& g); halfedge(boost::graph_traits<HalfedgeGraph>::edge_descriptor e, const HalfedgeGraph& g);
/*! \relates HalfedgeGraph /*! \relates HalfedgeGraph
returns a halfedge with target `v`. returns a halfedge with target `v`.

View File

@ -19,7 +19,8 @@ INPUT += ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/IO/polygon_mesh_io.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/METIS/partition_graph.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/METIS/partition_graph.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/METIS/partition_dual_graph.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/METIS/partition_dual_graph.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/alpha_expansion_graphcut.h \ ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/alpha_expansion_graphcut.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/graph_traits_inheritance_macros.h ${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/graph_traits_inheritance_macros.h \
${CGAL_PACKAGE_INCLUDE_DIR}/CGAL/boost/graph/dijkstra_shortest_path.h
EXAMPLE_PATH += ${CGAL_Surface_mesh_skeletonization_EXAMPLE_DIR} \ EXAMPLE_PATH += ${CGAL_Surface_mesh_skeletonization_EXAMPLE_DIR} \

View File

@ -1,4 +1,4 @@
/// \defgroup PkgBGLRef CGAL and the Boost Graph Library Reference /// \defgroup PkgBGLRef Reference Manual
/*! \defgroup PkgBGLConcepts Concepts /*! \defgroup PkgBGLConcepts Concepts
\ingroup PkgBGLRef \ingroup PkgBGLRef
@ -51,8 +51,8 @@ and adds the requirement for traversal of all vertices in a graph.
<center> <center>
<table> <table>
<tr> <tr>
<th width="800">Associated Type</th> <th class="associated-type">Associated Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`boost::graph_traits<G>::%vertex_iterator`</td> <td>`boost::graph_traits<G>::%vertex_iterator`</td>
@ -66,9 +66,9 @@ and adds the requirement for traversal of all vertices in a graph.
<table> <table>
<tr> <tr>
<th width="392">Valid Expression</th> <th class="valid-expression">Valid Expression</th>
<th width="392">Return Type</th> <th class="return-type">Return Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`vertices(g)`</td> <td>`vertices(g)`</td>
@ -92,8 +92,8 @@ and adds the requirement for traversal of all edges in a graph.
<center> <center>
<table> <table>
<tr> <tr>
<th width="800">Associated Type</th> <th class="associated-type">Associated Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`boost::graph_traits<G>::%edge_iterator`</td> <td>`boost::graph_traits<G>::%edge_iterator`</td>
@ -107,9 +107,9 @@ and adds the requirement for traversal of all edges in a graph.
<table> <table>
<tr> <tr>
<th width="392">Valid Expression</th> <th class="valid-expression">Valid Expression</th>
<th width="392">Return Type</th> <th class="return-type">Return Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`edges(g)`</td> <td>`edges(g)`</td>
@ -143,8 +143,8 @@ and adds the notion of halfedges, where each edge corresponds to two opposite ha
<center> <center>
<table> <table>
<tr> <tr>
<th width="800">Associated Type</th> <th class="associated-type">Associated Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`boost::graph_traits<G>::%halfedge_descriptor`</td> <td>`boost::graph_traits<G>::%halfedge_descriptor`</td>
@ -154,9 +154,9 @@ and adds the notion of halfedges, where each edge corresponds to two opposite ha
<table> <table>
<tr> <tr>
<th width="392">Valid Expression</th> <th class="valid-expression">Valid Expression</th>
<th width="392">Return Type</th> <th class="return-type">Return Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`edge(h, g)`</td> <td>`edge(h, g)`</td>
@ -222,9 +222,9 @@ update the incidence information between vertices and halfedges.
<center> <center>
<table> <table>
<tr> <tr>
<th width="392">Valid Expression</th> <th class="valid-expression">Valid Expression</th>
<th width="392">Return Type</th> <th class="return-type">Return Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`add_vertex(g)`</td> <td>`add_vertex(g)`</td>
@ -272,8 +272,8 @@ and adds the requirements for traversal of all halfedges in the graph.
<center> <center>
<table> <table>
<tr> <tr>
<th width="800">Associated Type</th> <th class="associated-type">Associated Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`boost::graph_traits<G>::%halfedge_iterator`</td> <td>`boost::graph_traits<G>::%halfedge_iterator`</td>
@ -287,9 +287,9 @@ and adds the requirements for traversal of all halfedges in the graph.
<table> <table>
<tr> <tr>
<th width="392">Valid Expression</th> <th class="valid-expression">Valid Expression</th>
<th width="392">Return Type</th> <th class="return-type">Return Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`halfedges(g)`</td> <td>`halfedges(g)`</td>
@ -315,8 +315,8 @@ face.
<center> <center>
<table> <table>
<tr> <tr>
<th width="800">Associated Type</th> <th class="associated-type">Associated Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`boost::graph_traits<G>::%face_descriptor`</td> <td>`boost::graph_traits<G>::%face_descriptor`</td>
@ -326,9 +326,9 @@ face.
<table> <table>
<tr> <tr>
<th width="392">Valid Expression</th> <th class="valid-expression">Valid Expression</th>
<th width="392">Return Type</th> <th class="return-type">Return Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`face(h, g)`</td> <td>`face(h, g)`</td>
@ -361,9 +361,9 @@ the requirement for operations to add faces and to modify face-halfedge relation
<center> <center>
<table> <table>
<tr> <tr>
<th width="392">Valid Expression</th> <th class="valid-expression">Valid Expression</th>
<th width="392">Return Type</th> <th class="return-type">Return Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`add_face(g)`</td> <td>`add_face(g)`</td>
@ -401,8 +401,8 @@ the requirement for traversal of all faces in a graph.
<center> <center>
<table> <table>
<tr> <tr>
<th width="800">Associated Type</th> <th class="associated-type">Associated Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`boost::graph_traits<G>::%face_iterator`</td> <td>`boost::graph_traits<G>::%face_iterator`</td>
@ -416,9 +416,9 @@ the requirement for traversal of all faces in a graph.
<table> <table>
<tr> <tr>
<th width="392">Valid Expression</th> <th class="valid-expression">Valid Expression</th>
<th width="392">Return Type</th> <th class="return-type">Return Type</th>
<th width="800">Description</th> <th class="description">Description</th>
</tr> </tr>
<tr> <tr>
<td>`faces(g)`</td> <td>`faces(g)`</td>
@ -467,6 +467,9 @@ the requirement for traversal of all faces in a graph.
/// \defgroup PkgBGLPartition Partitioning Operations /// \defgroup PkgBGLPartition Partitioning Operations
/// \ingroup PkgBGLRef /// \ingroup PkgBGLRef
/// \defgroup PkgBGLTraversal Graph Traversal
/// \ingroup PkgBGLRef
/// \defgroup PkgBGLIOFct I/O Functions /// \defgroup PkgBGLIOFct I/O Functions
/// \ingroup PkgBGLRef /// \ingroup PkgBGLRef
@ -506,8 +509,7 @@ the requirement for traversal of all faces in a graph.
/// I/O Functions for the \ref IOStream3MF /// I/O Functions for the \ref IOStream3MF
/// \ingroup PkgBGLIOFct /// \ingroup PkgBGLIOFct
/// \defgroup PkgBGLIOFctDeprecated I/O Functions (Deprecated)
/// \ingroup PkgBGLIOFct
/*! /*!
\addtogroup PkgBGLPropertiesDynamic \addtogroup PkgBGLPropertiesDynamic
@ -586,6 +588,12 @@ Methods to split a mesh into subdomains, using the library
implementation. implementation.
*/ */
/*!
\addtogroup PkgBGLTraversal
Methods to traverse a graph, for example to find the shortest path between two vertices.
*/
/*! /*!
\addtogroup PkgBGLIOFct \addtogroup PkgBGLIOFct
@ -762,6 +770,9 @@ user might encounter.
\cgalCRPSection{Conversion Functions} \cgalCRPSection{Conversion Functions}
- `CGAL::split_graph_into_polylines()` - `CGAL::split_graph_into_polylines()`
\cgalCRPSection{Graph Traversal}
- `CGAL::dijkstra_shortest_path()`
\cgalCRPSection{Graph Adaptors} \cgalCRPSection{Graph Adaptors}
- `CGAL::Dual` - `CGAL::Dual`
- `CGAL::Face_filtered_graph` - `CGAL::Face_filtered_graph`

View File

@ -22,6 +22,7 @@
\example BGL_surface_mesh/prim.cpp \example BGL_surface_mesh/prim.cpp
\example BGL_surface_mesh/gwdwg.cpp \example BGL_surface_mesh/gwdwg.cpp
\example BGL_surface_mesh/seam_mesh.cpp \example BGL_surface_mesh/seam_mesh.cpp
\example BGL_surface_mesh/shortest_path.cpp
\example BGL_surface_mesh/write_inp.cpp \example BGL_surface_mesh/write_inp.cpp
\example BGL_surface_mesh/surface_mesh_dual.cpp \example BGL_surface_mesh/surface_mesh_dual.cpp
\example BGL_surface_mesh/connected_components.cpp \example BGL_surface_mesh/connected_components.cpp

View File

@ -7,7 +7,7 @@ project(BGL_OpenMesh_Examples)
# CGAL and its components # CGAL and its components
find_package(CGAL REQUIRED) find_package(CGAL REQUIRED)
find_package(OpenMesh) find_package(OpenMesh QUIET)
if(OpenMesh_FOUND) if(OpenMesh_FOUND)
include(CGAL_OpenMesh_support) include(CGAL_OpenMesh_support)
create_single_source_cgal_program("TriMesh.cpp") create_single_source_cgal_program("TriMesh.cpp")

View File

@ -9,6 +9,7 @@ create_single_source_cgal_program("seam_mesh.cpp")
create_single_source_cgal_program("write_inp.cpp") create_single_source_cgal_program("write_inp.cpp")
create_single_source_cgal_program("surface_mesh_dual.cpp") create_single_source_cgal_program("surface_mesh_dual.cpp")
create_single_source_cgal_program("connected_components.cpp") create_single_source_cgal_program("connected_components.cpp")
create_single_source_cgal_program("shortest_path.cpp")
find_package(METIS QUIET) find_package(METIS QUIET)
include(CGAL_METIS_support) include(CGAL_METIS_support)

View File

@ -0,0 +1,83 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/boost/graph/dijkstra_shortest_path.h>
#include <CGAL/IO/polygon_mesh_io.h>
#include <string>
#include <vector>
#include <fstream>
#include <exception>
#include <algorithm>
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
using Point = K::Point_3;
using Mesh = CGAL::Surface_mesh<Point>;
using vertex_descriptor = boost::graph_traits<Mesh>::vertex_descriptor;
using edge_descriptor = boost::graph_traits<Mesh>::edge_descriptor;
using halfedge_descriptor = boost::graph_traits<Mesh>::halfedge_descriptor;
namespace params = CGAL::parameters;
// Example main
int main(int argc, char** argv)
{
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off");
// Try building a surface_mesh
Mesh sm;
bool ok = CGAL::IO::read_polygon_mesh(filename, sm);
if (!ok || !sm.is_valid() || sm.is_empty())
{
std::cerr << "Error: Invalid facegraph" << std::endl;
std::cerr << "Filename = " << filename << std::endl;
return EXIT_FAILURE;
}
const std::size_t i0 = 0;
const std::size_t i1 = num_vertices(sm) / 2;
// Get the vertex descriptors of the source and target vertices
const vertex_descriptor vs = *vertices(sm).first;
vertex_descriptor vt;
std::size_t vid = 0;
for (const vertex_descriptor v : vertices(sm))
{
if (vid++ == i1)
{
vt = v;
break;
}
}
std::list<halfedge_descriptor> halfedge_sequence;
CGAL::dijkstra_shortest_path(vs, vt, sm,
std::back_inserter(halfedge_sequence));
assert(source(halfedge_sequence.front(), sm)==vs);
assert(target(halfedge_sequence.back(), sm)==vt);
// dump
std::cout << "Shortest path between vertices " << i0 << " and " << i1
<< " is made of " << halfedge_sequence.size() << " halfedges." << std::endl;
// Get the property map of the points of the mesh
auto vpmap = get(CGAL::vertex_point, sm);
std::ofstream out("shortest_path.polylines.txt");
out << halfedge_sequence.size()+1 << " " << get(vpmap, source(halfedge_sequence.front(),sm));
for (const halfedge_descriptor he : halfedge_sequence)
{
const vertex_descriptor v = target(he, sm);
out << " " << get(vpmap, v);
}
out << std::endl;
out.close();
return EXIT_SUCCESS;
}

View File

@ -247,36 +247,7 @@ bool read_OFF(const std::string& fname,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_OFF()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off(std::istream& is, Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_OFF(is, g, np);
}
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::read_OFF()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool read_off(const char* fname, Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::read_OFF(fname, g, np);
}
template <typename Graph>
CGAL_DEPRECATED bool read_off(const std::string& fname, Graph& g)
{
return read_off(fname.c_str(), g, parameters::default_values());
}
#endif // CGAL_NO_DEPRECATED_CODE
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
@ -453,31 +424,6 @@ bool write_OFF(const std::string& fname,
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_OFF()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_off(std::ostream& os, const Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_OFF(os, g, np);
}
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_OFF()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_off(const char* fname, const Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_OFF(fname, g, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL

View File

@ -529,20 +529,7 @@ bool write_VTP(const std::string& fname, const Graph& g, const CGAL_NP_CLASS& np
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_VTP()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_vtp(std::ostream& os, const Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_VTP(os, g, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL

View File

@ -111,20 +111,7 @@ bool write_WRL(const std::string& fname, const Graph& g, const CGAL_NP_CLASS& np
} // namespace IO } // namespace IO
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\ingroup PkgBGLIOFctDeprecated
\deprecated This function is deprecated since \cgal 5.3, `CGAL::IO::write_WRL()` should be used instead.
*/
template <typename Graph, typename CGAL_NP_TEMPLATE_PARAMETERS>
CGAL_DEPRECATED bool write_wrl(std::ostream& os, const Graph& g, const CGAL_NP_CLASS& np = parameters::default_values())
{
return IO::write_WRL(os, g, np);
}
#endif // CGAL_NO_DEPRECATED_CODE
} // namespace CGAL } // namespace CGAL

View File

@ -509,7 +509,8 @@ class Alpha_expansion_MaxFlow_impl;
\cgalParamNEnd \cgalParamNEnd
\cgalNamedParamsEnd \cgalNamedParamsEnd
\note The `MaxFlow` implementation is provided by the \ref PkgSurfaceMeshSegmentationRef
\note The `MaxFlow` implementation is provided by the \ref PkgSurfaceMeshSegmentation package
under GPL license. The header `<CGAL/boost/graph/Alpha_expansion_MaxFlow_tag.h>` under GPL license. The header `<CGAL/boost/graph/Alpha_expansion_MaxFlow_tag.h>`
must be included if users want to use this implementation. must be included if users want to use this implementation.
*/ */

View File

@ -0,0 +1,160 @@
// Copyright (c) 2025 GeometryFactory (France). All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Jane Tournois, Andreas Fabri
//
#ifndef CGAL_BOOST_GRAPH_DIJKSTRA_SHORTEST_PATH_H
#define CGAL_BOOST_GRAPH_DIJKSTRA_SHORTEST_PATH_H
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <CGAL/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <boost/property_map/property_map.hpp>
#include <CGAL/boost/graph/properties.h>
#include <list>
#include <unordered_map>
namespace CGAL {
namespace internal {
/// An exception used while catching a throw that stops Dijkstra's algorithm
/// once the shortest path to a target has been found.
class Dijkstra_end_exception : public std::exception
{
const char* what() const throw ()
{
return "Dijkstra shortest path: reached the target vertex.";
}
};
/// Visitor to stop Dijkstra's algorithm once the given target turns 'BLACK',
/// that is when the target has been examined through all its incident edges and
/// the shortest path is thus known.
template<typename Graph, typename VertexEdgeMap>
class Stop_at_target_Dijkstra_visitor : public boost::default_dijkstra_visitor
{
using vertex_descriptor = typename boost::graph_traits<Graph>::vertex_descriptor;
using edge_descriptor = typename boost::graph_traits<Graph>::edge_descriptor;
public:
vertex_descriptor destination_vd;
VertexEdgeMap& relaxed_edges;
Stop_at_target_Dijkstra_visitor(vertex_descriptor destination_vd,
VertexEdgeMap& relaxed_edges)
: destination_vd(destination_vd), relaxed_edges(relaxed_edges)
{}
void edge_relaxed(const edge_descriptor& e, const Graph& g) const
{
relaxed_edges[target(e, g)] = e;
}
void finish_vertex(const vertex_descriptor& vd, const Graph& /* g*/) const
{
if (vd == destination_vd)
throw Dijkstra_end_exception();
}
};
} // namespace internal
/*!
* \ingroup PkgBGLTraversal
* computes the shortest path between two vertices in a graph `g`, where the vertices must belong to the same connected component of `g`.
*
* @tparam Graph a model of the concept `HalfedgeListGraph`
* @tparam OutputIterator an output iterator with value type `boost::graph_traits<Graph>::%halfedge_descriptor`
* @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
*
* @param vs source vertex
* @param vt target vertex
* @param g the graph
* @param halfedge_sequence_oit the output iterator holding the output sequence
* of halfedges that form the shortest path from `vs` to `vt` on `g`
* @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below
*
* \cgalNamedParamsBegin
* \cgalParamNBegin{edge_weight_map}
* \cgalParamDescription{a property map associating to each edge in the graph its weight or "length".
* The weights must all be non-negative.}
* \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::%edge_descriptor`
* as key type and a value type which as specified in the named parameter `distance_map`of the function
<A href="https://www.boost.org/doc/libs/release/libs/graph/doc/dijkstra_shortest_paths.html">`boost::graph::dijkstra_shortest_paths()`</A>,
with any model of `RingNumberType` fulfilling the requirements. }
* \cgalParamDefault{`get(boost::edge_weight, mesh)`}
* \cgalParamNEnd
*
* \cgalParamNBegin{vertex_index_map}
* \cgalParamDescription{a property map associating to each vertex of `g` a unique index between `0` and `num_vertices(g) - 1`}
* \cgalParamType{a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::%vertex_descriptor`
* as key type and `std::size_t` as value type}
* \cgalParamDefault{an automatically indexed internal map}
* \cgalParamNEnd
* \cgalNamedParamsEnd
*/
template<typename Graph,
typename OutputIterator,
typename NamedParameters = parameters::Default_named_parameters>
OutputIterator dijkstra_shortest_path(
const typename boost::graph_traits<Graph>::vertex_descriptor vs,//source
const typename boost::graph_traits<Graph>::vertex_descriptor vt,//target
const Graph& g,
OutputIterator halfedge_sequence_oit,
const NamedParameters& np = parameters::default_values())
{
using vertex_descriptor = typename boost::graph_traits<Graph>::vertex_descriptor;
using halfedge_descriptor = typename boost::graph_traits<Graph>::halfedge_descriptor;
using edge_descriptor = typename boost::graph_traits<Graph>::edge_descriptor;
using Pred_umap = std::unordered_map<vertex_descriptor, vertex_descriptor>;
using Pred_pmap = boost::associative_property_map<Pred_umap>;
using parameters::get_parameter;
using parameters::choose_parameter;
const auto w_map = choose_parameter(get_parameter(np, internal_np::edge_weight),
get(boost::edge_weight, g));
const auto vim = get_initialized_vertex_index_map(g, np);
Pred_umap predecessor;
Pred_pmap pred_pmap(predecessor);
using VEMap = std::unordered_map<vertex_descriptor, edge_descriptor>;
VEMap relaxed_edges_map;
internal::Stop_at_target_Dijkstra_visitor<Graph, VEMap> vis(vt, relaxed_edges_map);
try
{
boost::dijkstra_shortest_paths(g, vs,
boost::predecessor_map(pred_pmap)
.visitor(vis)
.weight_map(w_map)
.vertex_index_map(vim));
}
catch (const internal::Dijkstra_end_exception& ){}
std::list<halfedge_descriptor> path;
vertex_descriptor t = vt;
do {
path.push_front(halfedge(relaxed_edges_map[t],g));
t = get(pred_pmap, t);
}while (t != vs);
for(auto he : path){
*halfedge_sequence_oit++ = he;
}
return halfedge_sequence_oit;
}
} // namespace CGAL
#endif //CGAL_BOOST_GRAPH_DIJKSTRA_SHORTEST_PATH_H

View File

@ -67,23 +67,8 @@ template <CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS, typename CGAL_XX_YATP>
struct property_map<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \ struct property_map<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \
: property_map<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \ : property_map<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \
{};\ {};\
} /* boost namespace */\ } /* boost namespace */
\
namespace CGAL { \
template <CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS, typename CGAL_XX_YATP>\
typename boost::property_map<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, DTAG<CGAL_XX_YATP> >::type \
get(DTAG<CGAL_XX_YATP> t, CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME& g, const CGAL_XX_YATP& default_value = CGAL_XX_YATP()) \
{ \
return get(t, static_cast<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME&>(g), default_value); \
} \
\
template <CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS, typename CGAL_XX_YATP>\
typename boost::property_map<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, DTAG<CGAL_XX_YATP> >::const_type \
get(DTAG<CGAL_XX_YATP> t, const CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME& g, const CGAL_XX_YATP& default_value = CGAL_XX_YATP()) \
{ \
return get(t, static_cast<const CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME&>(g), default_value); \
}\
} //CGAL namespace
CGAL_PM_DT_SPEC(CGAL::dynamic_vertex_property_t) CGAL_PM_DT_SPEC(CGAL::dynamic_vertex_property_t)
CGAL_PM_DT_SPEC(CGAL::dynamic_halfedge_property_t) CGAL_PM_DT_SPEC(CGAL::dynamic_halfedge_property_t)
@ -94,12 +79,31 @@ CGAL_PM_DT_SPEC(CGAL::dynamic_edge_property_t)
namespace CGAL { namespace CGAL {
template <CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS,
typename Dynamic_property_tag,
typename = std::enable_if_t<is_dynamic_property_tag<Dynamic_property_tag>()>,
typename ...Default_value_args>
auto
get(Dynamic_property_tag t, CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME& g, Default_value_args&&... default_value_args)
{
return get(t, static_cast<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME&>(g), default_value_args...);
}
template <CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS,
typename Dynamic_property_tag,
typename = std::enable_if_t<is_dynamic_property_tag<Dynamic_property_tag>()>,
typename ...Default_value_args>
auto
get(Dynamic_property_tag t, const CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME& g, Default_value_args&&... default_value_args)
{
return get(t, static_cast<const CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME&>(g), default_value_args...);
}
template <CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS, typename CGAL_XX_YATP> template <CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS, typename CGAL_XX_YATP>
struct graph_has_property<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, CGAL_XX_YATP> : struct graph_has_property<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, CGAL_XX_YATP> :
public CGAL::graph_has_property<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, CGAL_XX_YATP> public CGAL::graph_has_property<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, CGAL_XX_YATP>
{}; {};
} // CGAL namespace } // CGAL namespace
#undef CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS #undef CGAL_GRAPH_TRAITS_INHERITANCE_TEMPLATE_PARAMS
@ -126,23 +130,8 @@ template <typename CGAL_XX_YATP> \
struct property_map<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \ struct property_map<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \
: property_map<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \ : property_map<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \
{};\ {};\
} /* boost namespace */\ } /* boost namespace */
\
namespace CGAL { \
template <typename CGAL_XX_YATP>\
typename boost::property_map<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, DTAG<CGAL_XX_YATP> >::type \
get(DTAG<CGAL_XX_YATP> t, CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME& g, const CGAL_XX_YATP& default_value = CGAL_XX_YATP()) \
{ \
return get(t, static_cast<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME&>(g), default_value); \
} \
\
template <typename CGAL_XX_YATP>\
typename boost::property_map<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, DTAG<CGAL_XX_YATP> >::const_type \
get(DTAG<CGAL_XX_YATP> t, const CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME& g, const CGAL_XX_YATP& default_value = CGAL_XX_YATP()) \
{ \
return get(t, static_cast<const CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME&>(g), default_value); \
}\
} //CGAL namespace
CGAL_PM_DT_SPEC(CGAL::dynamic_vertex_property_t) CGAL_PM_DT_SPEC(CGAL::dynamic_vertex_property_t)
CGAL_PM_DT_SPEC(CGAL::dynamic_halfedge_property_t) CGAL_PM_DT_SPEC(CGAL::dynamic_halfedge_property_t)
@ -153,14 +142,32 @@ CGAL_PM_DT_SPEC(CGAL::dynamic_edge_property_t)
namespace CGAL { namespace CGAL {
template <typename Dynamic_property_tag,
typename = std::enable_if_t<is_dynamic_property_tag<Dynamic_property_tag>()>,
typename ...Default_value_args>
auto
get(Dynamic_property_tag t, CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME& g, Default_value_args&&... default_value_args)
{
return get(t, static_cast<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME&>(g), default_value_args...);
}
template <typename Dynamic_property_tag,
typename = std::enable_if_t<is_dynamic_property_tag<Dynamic_property_tag>()>,
typename ...Default_value_args>
auto
get(Dynamic_property_tag t, const CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME& g, Default_value_args&&... default_value_args)
{
return get(t, static_cast<const CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME&>(g), default_value_args...);
}
template <typename CGAL_XX_YATP> template <typename CGAL_XX_YATP>
struct graph_has_property<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, CGAL_XX_YATP> : struct graph_has_property<CGAL_GRAPH_TRAITS_INHERITANCE_CLASS_NAME, CGAL_XX_YATP> :
public CGAL::graph_has_property<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, CGAL_XX_YATP> public CGAL::graph_has_property<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, CGAL_XX_YATP>
{}; {};
} // CGAL namespace } // CGAL namespace
#endif #endif

View File

@ -871,7 +871,54 @@ private:
*/ */
template <typename Graph> template <typename Graph>
class Face_around_face_circulator class Face_around_face_circulator
{}; #ifndef DOXYGEN_RUNNING
: public boost::iterator_adaptor<
Face_around_face_circulator<Graph> // Derived
, Halfedge_around_face_circulator<Graph> // Base
, typename boost::graph_traits<Graph>::face_descriptor // Value
, Bidirectional_circulator_tag // CategoryOrTraversal
, typename boost::graph_traits<Graph>::face_descriptor // Reference
>
#endif
{
internal::Opposite_face<Graph> fct;
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
public:
#ifndef DOXYGEN_RUNNING
typedef std::size_t size_type;
#endif
Face_around_face_circulator()
{}
Face_around_face_circulator(halfedge_descriptor h, const Graph& g)
: Face_around_face_circulator::iterator_adaptor_(Halfedge_around_face_circulator<Graph>(h,g)), fct(g)
{}
#ifndef DOXYGEN_RUNNING
explicit operator bool() const
{
return (! (this->base_reference() == nullptr));
}
bool operator== (void*) const
{
return this->base_reference()== nullptr;
}
bool operator!= (void*) const
{
return this->base_reference()!= nullptr;
}
private:
friend class boost::iterator_core_access;
typename boost::graph_traits<Graph>::face_descriptor dereference() const { return fct(*this->base_reference()); }
#endif
};
/** /**
* \ingroup PkgBGLIterators * \ingroup PkgBGLIterators

View File

@ -227,6 +227,32 @@ struct GetGeomTraits
NamedParametersVPM>::type type; NamedParametersVPM>::type type;
}; };
namespace internal {
// Similar helper for polygon soups
template <typename PointRange, typename PolygonRange>
struct Polygon_types
{
typedef typename boost::range_value<PointRange>::type Point_3;
typedef typename boost::range_value<PolygonRange>::type Polygon_3;
typedef typename boost::range_iterator<Polygon_3>::type V_ID_iterator;
typedef typename std::iterator_traits<V_ID_iterator>::value_type V_ID;
typedef typename std::vector<Polygon_3>::size_type P_ID;
};
}
template <typename PointRange, typename PolygonRange, typename NamedParameters>
struct GetPolygonGeomTraits
{
typedef typename internal_np::Lookup_named_param_def <
internal_np::geom_traits_t,
NamedParameters,
typename CGAL::Kernel_traits<
typename internal::Polygon_types<
PointRange, PolygonRange>::Point_3 >::type
> ::type type;
};
// Define the following structs: // Define the following structs:
// //
// GetInitializedVertexIndexMap // GetInitializedVertexIndexMap

View File

@ -16,7 +16,6 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <utility>
#include <boost/graph/adjacency_list.hpp> #include <boost/graph/adjacency_list.hpp>
#include <CGAL/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/tags.h> #include <CGAL/tags.h>
@ -143,32 +142,27 @@ void duplicate_terminal_vertices(Graph& graph,
{ {
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor; typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
typedef typename boost::graph_traits<Graph>::vertex_iterator vertex_iterator;
typedef typename boost::graph_traits<Graph>::out_edge_iterator out_edge_iterator;
vertex_iterator b,e; auto [b, e] = vertices(graph);
std::tie(b,e) = vertices(graph); std::vector<vertex_descriptor> V(b, e); // copy vertices, because the graph may change
std::vector<vertex_descriptor> V(b,e); std::vector<edge_descriptor> out_edges_of_v; // used to store the out edges of a vertex
// created here to avoid allocating it in the loop
for(vertex_descriptor v : V) for(vertex_descriptor v : V)
{ {
typename boost::graph_traits<OrigGraph>::vertex_descriptor orig_v = graph[v]; auto orig_v = graph[v];
typename boost::graph_traits<Graph>::degree_size_type deg = degree(v, graph); auto deg = degree(v, graph);
if (deg != 2 || is_terminal(orig_v, orig)) if (deg != 2 || is_terminal(orig_v, orig))
{ {
out_edge_iterator b, e; auto [b, e] = out_edges(v, graph);
std::tie(b, e) = out_edges(v, graph); out_edges_of_v.assign(b, e); // same as creating a new vector from the range [b,e)
std::vector<edge_descriptor> out_edges_of_v(b, e);
for (unsigned int i = 1; i < out_edges_of_v.size(); ++i) for (unsigned int i = 1; i < out_edges_of_v.size(); ++i)
{ {
edge_descriptor e = out_edges_of_v[i]; edge_descriptor e = out_edges_of_v[i];
typename boost::graph_traits<OrigGraph>::edge_descriptor orig_e = auto orig_e = graph[e];
graph[e];
vertex_descriptor w = target(e, graph); vertex_descriptor w = target(e, graph);
remove_edge(e, graph); remove_edge(e, graph);
vertex_descriptor vc = add_vertex(graph); vertex_descriptor vc = add_vertex(orig_v, graph);
graph[vc] = orig_v; add_edge(vc, w, orig_e, graph);
const std::pair<edge_descriptor, bool> pair = add_edge(vc, w, graph);
graph[pair.first] = orig_e;
} }
} }
} }
@ -271,8 +265,7 @@ split_graph_into_polylines(const Graph& graph,
V2vmap v2vmap; V2vmap v2vmap;
for(Graph_vertex_descriptor v : make_range(vertices(graph))){ for(Graph_vertex_descriptor v : make_range(vertices(graph))){
vertex_descriptor vc = add_vertex(g_copy); vertex_descriptor vc = add_vertex(v, g_copy);
g_copy[vc] = v;
v2vmap[v] = vc; v2vmap[v] = vc;
} }
@ -281,9 +274,7 @@ split_graph_into_polylines(const Graph& graph,
Graph_vertex_descriptor vt = target(e,graph); Graph_vertex_descriptor vt = target(e,graph);
CGAL_warning_msg(vs != vt, "ignore self loops"); CGAL_warning_msg(vs != vt, "ignore self loops");
if(vs != vt){ if(vs != vt){
const std::pair<edge_descriptor, bool> pair = add_edge(v2vmap[vs], v2vmap[vt], e, g_copy);
add_edge(v2vmap[vs],v2vmap[vt],g_copy);
g_copy[pair.first] = e;
} }
} }
} }

View File

@ -38,7 +38,6 @@ create_single_source_cgal_program("test_graph_traits.cpp")
create_single_source_cgal_program("test_Properties.cpp") create_single_source_cgal_program("test_Properties.cpp")
create_single_source_cgal_program("bench_read_from_stream_vs_add_face_and_add_faces.cpp") create_single_source_cgal_program("bench_read_from_stream_vs_add_face_and_add_faces.cpp")
create_single_source_cgal_program("graph_traits_inheritance.cpp" ) create_single_source_cgal_program("graph_traits_inheritance.cpp" )
create_single_source_cgal_program("test_deprecated_io.cpp")
find_package(OpenMesh QUIET) find_package(OpenMesh QUIET)
if(OpenMesh_FOUND) if(OpenMesh_FOUND)
@ -63,13 +62,12 @@ else()
message(STATUS "NOTICE: Tests that use OpenMesh will not be compiled.") message(STATUS "NOTICE: Tests that use OpenMesh will not be compiled.")
endif() endif()
set(CMAKE_POLICY_DEFAULT_CMP0167 NEW)
find_package(VTK 9.0 QUIET COMPONENTS CommonCore IOCore IOLegacy IOXML FiltersCore FiltersSources) find_package(VTK 9.0 QUIET COMPONENTS CommonCore IOCore IOLegacy IOXML FiltersCore FiltersSources)
if (VTK_FOUND AND VTK_LIBRARIES) if (VTK_FOUND AND VTK_LIBRARIES)
message(STATUS "VTK ${VTK_VERSION} found ${VTK_LIBRARIES}") message(STATUS "VTK ${VTK_VERSION} found ${VTK_LIBRARIES}")
target_link_libraries(test_bgl_read_write PRIVATE ${VTK_LIBRARIES}) target_link_libraries(test_bgl_read_write PRIVATE ${VTK_LIBRARIES})
target_compile_definitions(test_bgl_read_write PRIVATE -DCGAL_USE_VTK -DNOMINMAX) target_compile_definitions(test_bgl_read_write PRIVATE -DCGAL_USE_VTK -DNOMINMAX)
target_link_libraries(test_deprecated_io PRIVATE ${VTK_LIBRARIES})
target_compile_definitions(test_deprecated_io PRIVATE -DCGAL_USE_VTK -DNOMINMAX)
else() else()
message(STATUS "Tests that use VTK will not be compiled.") message(STATUS "Tests that use VTK will not be compiled.")
endif() #VTK_FOUND endif() #VTK_FOUND

View File

@ -4,6 +4,7 @@
#include <CGAL/Surface_mesh.h> #include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/convex_hull_3.h> #include <CGAL/convex_hull_3.h>
#include <CGAL/Polygon_mesh_processing/manifoldness.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
@ -75,5 +76,12 @@ int main()
My_mesh_5 poly5; My_mesh_5 poly5;
CGAL::convex_hull_3(points.begin(), points.end(), poly5); CGAL::convex_hull_3(points.begin(), points.end(), poly5);
CGAL::Polygon_mesh_processing::non_manifold_vertices(poly1, CGAL::Emptyset_iterator());
CGAL::Polygon_mesh_processing::non_manifold_vertices(poly2, CGAL::Emptyset_iterator());
CGAL::Polygon_mesh_processing::non_manifold_vertices(poly3, CGAL::Emptyset_iterator());
CGAL::Polygon_mesh_processing::non_manifold_vertices(poly4, CGAL::Emptyset_iterator());
CGAL::Polygon_mesh_processing::non_manifold_vertices(poly5, CGAL::Emptyset_iterator());
return 0; return 0;
} }

View File

@ -18,6 +18,7 @@ typedef GraphTraits::edge_descriptor edge_descriptor;
typedef GraphTraits::out_edge_iterator out_edge_iterator; typedef GraphTraits::out_edge_iterator out_edge_iterator;
typedef GraphTraits::in_edge_iterator in_edge_iterator; typedef GraphTraits::in_edge_iterator in_edge_iterator;
typedef CGAL::Face_around_face_circulator<Polyhedron> face_around_face_circulator;
typedef CGAL::Halfedge_around_face_circulator<Polyhedron> halfedge_around_face_circulator; typedef CGAL::Halfedge_around_face_circulator<Polyhedron> halfedge_around_face_circulator;
typedef CGAL::Halfedge_around_target_circulator<Polyhedron> halfedge_around_target_circulator; typedef CGAL::Halfedge_around_target_circulator<Polyhedron> halfedge_around_target_circulator;
typedef CGAL::Vertex_around_target_circulator<Polyhedron> vertex_around_target_circulator; typedef CGAL::Vertex_around_target_circulator<Polyhedron> vertex_around_target_circulator;
@ -32,6 +33,7 @@ typedef CGAL::Vertex_around_target_iterator<Polyhedron> vertex_around_target_ite
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<face_around_face_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_face_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_face_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_target_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_target_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<vertex_around_target_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<vertex_around_target_circulator>));
@ -62,6 +64,14 @@ int main(int argc, char* argv[])
}while(hafc != done); }while(hafc != done);
} }
{
face_around_face_circulator fafc(hd,P), done(fafc);
do {
++fafc;
}while(fafc != done);
}
{ {
halfedge_around_target_circulator havc(hd,P), done(havc); halfedge_around_target_circulator havc(hd,P), done(havc);
vertex_descriptor vd = target(hd,P); vertex_descriptor vd = target(hd,P);

View File

@ -1,59 +0,0 @@
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <fstream>
#include <iostream>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/boost/graph/IO/OFF.h>
#include <CGAL/boost/graph/IO/VTK.h>
#include <CGAL/boost/graph/IO/WRL.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> SM;
int main()
{
// OFF
SM sm_in, sm_out;
Point_3 p0(0,0,0), p1(1,0,0), p2(0,1,0);
CGAL::make_triangle(p0, p1, p2, sm_out);
bool ok = CGAL::write_off("tmp_deprecated.off", sm_out);
assert(ok);
ok = CGAL::read_off("tmp_deprecated.off", sm_in);
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
sm_in.clear();
std::ofstream os("tmp_deprecated.off");
ok = CGAL::write_off(os, sm_out);
assert(ok);
os.close();
std::ifstream is("tmp_deprecated.off");
ok = CGAL::read_off(is, sm_in);
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
is.close();
sm_in.clear();
#ifdef CGAL_USE_VTK
//vtk
os.open("tmp_deprecated.vtp");
ok = CGAL::write_vtp(os, sm_out);
assert(ok);
os.close();
ok = CGAL::IO::read_VTP("tmp_deprecated.vtp", sm_in);
assert(ok);
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
sm_in.clear();
#endif
//wrl
os.open("tmp_deprecated.wrl");
ok = CGAL::write_wrl(os, sm_out);
assert(ok);
os.close();
return EXIT_SUCCESS;
}

View File

@ -53,7 +53,7 @@ All analytic barycentric coordinates for polygons can be computed either by inst
or through one of the free functions. Harmonic coordinates can be computed only by or through one of the free functions. Harmonic coordinates can be computed only by
instantiating a class that must be parameterized by a model of the concept `DiscretizedDomain_2`. instantiating a class that must be parameterized by a model of the concept `DiscretizedDomain_2`.
Segment and triangle coordinates can be computed only through the free functions. Segment and triangle coordinates can be computed only through the free functions.
For more information see the \ref PkgBarycentricCoordinates2Ref "Reference Manual". For more information see the \ref PkgBarycentricCoordinates2Ref.
Any point in the plane may be taken as a query point. However, we do not recommend using Any point in the plane may be taken as a query point. However, we do not recommend using
Wachspress and discrete harmonic coordinates with query points outside the closure Wachspress and discrete harmonic coordinates with query points outside the closure

View File

@ -1,8 +1,5 @@
namespace CGAL {
namespace Barycentric_coordinates {
/*! /*!
\defgroup PkgBarycentricCoordinates2Ref 2D Generalized Barycentric Coordinates Reference \defgroup PkgBarycentricCoordinates2Ref Reference Manual
\defgroup PkgBarycentricCoordinates2RefConcepts Concepts \defgroup PkgBarycentricCoordinates2RefConcepts Concepts
\ingroup PkgBarycentricCoordinates2Ref \ingroup PkgBarycentricCoordinates2Ref
@ -77,6 +74,3 @@ coordinates from the Package \ref PkgInterpolation2.}
- `discrete_harmonic_coordinates_2()` - `discrete_harmonic_coordinates_2()`
- `boundary_coordinates_2()` - `boundary_coordinates_2()`
*/ */
} /* namespace Barycentric_coordinates */
} /* namespace CGAL */

View File

@ -131,7 +131,7 @@ Example of drawing of a point cloud and a polyhedron in a same viewer.
\cgalFigureEnd \cgalFigureEnd
<!-- /////////////////////////////////////////////////////////////////////////////// --> <!-- /////////////////////////////////////////////////////////////////////////////// -->
\section BV_BasicViewer The Basic Viewer Class \section BV_BasicViewer The Qt Basic Viewer Class
The class `CGAL::Qt::Basic_viewer` is a \qt widget that inherits from `QGLViewer` and mainly stores a `Graphics_scene` and allows to visualize it and interact with the scene. Since this class is a \qt widget, it can be used into more complex \qt code to create more advanced demos. The class `CGAL::Qt::Basic_viewer` is a \qt widget that inherits from `QGLViewer` and mainly stores a `Graphics_scene` and allows to visualize it and interact with the scene. Since this class is a \qt widget, it can be used into more complex \qt code to create more advanced demos.

View File

@ -102,6 +102,36 @@ public:
/// returns `true` if the scene is in 2D, i.e., lies on the XY or XZ or YZ plane. /// returns `true` if the scene is in 2D, i.e., lies on the XY or XZ or YZ plane.
bool is_two_dimensional() const; bool is_two_dimensional() const;
/// set the default color of faces
void set_default_color_face(const CGAL::IO::Color& c);
/// set the default color of points
void set_default_color_point(const CGAL::IO::Color& c);
/// set the default color of segments
void set_default_color_segment(const CGAL::IO::Color& c);
/// set the default color of rays
void set_default_color_ray(const CGAL::IO::Color& c);
/// set the default color of lines
void set_default_color_line(const CGAL::IO::Color& c);
/// returns the default color of faces
const CGAL::IO::Color &get_default_color_face() const;
/// returns the default color of points
const CGAL::IO::Color &get_default_color_point() const;
/// returns the default color of segments
const CGAL::IO::Color &get_default_color_segment() const;
/// returns the default color of rays
const CGAL::IO::Color &get_default_color_ray() const;
/// returns the default color of lines
const CGAL::IO::Color &get_default_color_line() const;
}; };
} // namespace CGAL } // namespace CGAL

View File

@ -12,119 +12,180 @@ CGAL::QGLViewer is our internal fork of <a href="https://github.com/GillesDebunn
class Basic_viewer : public CGAL::QGLViewer class Basic_viewer : public CGAL::QGLViewer
{ {
public: public:
/// \name Constructors
/// @{
/// Constructor given a pointer on a `QWidget` (can be a `nullptr`) and a `Graphics_scene`. /// Constructor given a pointer on a `QWidget` (can be a `nullptr`) and a `Graphics_scene`.
/// `title` will be the title of the window. /// `title` will be the title of the window.
Basic_viewer(QWidget* parent, Basic_viewer(QWidget* parent,
const Graphics_scene& scene, const Graphics_scene& scene,
const char* title=""); const char* title="");
/// enables or disables the drawing of vertices. /// @}
/// \name Setters
/// @{
/// \brief Set size of vertices.
/// \param s The size of vertices.
void size_vertices(float s);
/// \brief Set size of edges.
/// \param s The size of edges.
void size_edges(float s);
/// \brief Set size of rays.
/// \param s The size of rays.
void size_rays(float s);
/// \brief Set size of lines.
/// \param s The size of lines.
void size_lines(float s);
/// \brief Enables or disables the drawing of vertices.
/// \param b Set to `true` to enable, `false` to disable.
void draw_vertices(bool b); void draw_vertices(bool b);
/// enables or disables the drawing of edges. /// \brief Enables or disables the drawing of edges.
/// \param b Set to `true` to enable, `false` to disable.
void draw_edges(bool b); void draw_edges(bool b);
/// enables or disables the drawing of rays. /// \brief Enables or disables the drawing of rays.
/// \param b Set to `true` to enable, `false` to disable.
void draw_rays(bool b); void draw_rays(bool b);
/// enables or disables the drawing of lines. /// \brief Enables or disables the drawing of lines.
/// \param b Set to `true` to enable, `false` to disable.
void draw_lines(bool b); void draw_lines(bool b);
/// enables or disables the drawing of faces. /// \brief enables or disables the drawing of faces.
/// \param b Set to `true` to enable, `false` to disable.
void draw_faces(bool b); void draw_faces(bool b);
/// enables or disables the use of only one color (if `b` is `true`) or the use of multiple colors (if `b` is `false`).
void use_mono_color(bool b);
/// enables or disables the drawing of texts. /// enables or disables the drawing of texts.
/// \brief enables or disables the drawing of texts.
/// \param b Set to `true` to enable, `false` to disable.
void draw_text(bool b); void draw_text(bool b);
/// sets the color used for vertices in mono color mode. /// \brief Enables or disables the drawing of mesh triangles.
void vertices_mono_color(const CGAL::IO::Color& c); /// \param b Set to `true` to enable, `false` to disable.
void draw_mesh_triangles(bool b);
/// sets the color used for edges in mono color mode. /// \brief Enables or disables the use of only one color or the use of multiple colors.
void edges_mono_color(const CGAL::IO::Color& c); /// \param b Set to `true` to use only one color, `false` to use multiple colors.
void use_default_color(bool b);
/// sets the color used for rays in mono color mode. /// \brief Enables or disables the use of a single color for all normals.
void rays_mono_color(const CGAL::IO::Color& c); /// \param b Set to `true` to enable, `false` to disable.
void use_default_color_normals(bool b);
/// sets the color used for lines in mono color mode. /// \brief enables or disables the use of flat shading or the use of smooth shading.
void lines_mono_color(const CGAL::IO::Color& c); /// \param b Set to `true` for flat shading, `false` for smooth shading.
void flat_shading(bool b);
/// sets the color used for faces in mono color mode. /// \brief Enables or disables the reversal of normals.
void faces_mono_color(const CGAL::IO::Color& c); /// \param b Set to `true` to reverse normals, `false` to keep normals as is.
void reverse_normal(bool b);
/// toggles the drawing of vertices. /// \brief Sets the default color of the normals.
/// \param c The default color of the normals.
void default_color_normals(const CGAL::IO::Color& c);
/// \brief Sets the height factor value of the normals.
/// \param h The height factor value of the normals.
void normal_height_factor(float h);
/// \brief Toggles the drawing of vertices.
void toggle_draw_vertices(); void toggle_draw_vertices();
/// toggles the drawing of edges. /// \brief Toggles the drawing of edges.
void toggle_draw_edges(); void toggle_draw_edges();
/// toggles the drawing of rays. /// \brief Toggles the drawing of rays.
void toggle_draw_rays(); void toggle_draw_rays();
/// toggles the drawing of lines. /// \brief Toggles the drawing of lines.
void toggle_draw_lines(); void toggle_draw_lines();
/// toggles the drawing of faces. /// \brief Toggles the drawing of faces.
void toggle_draw_faces(); void toggle_draw_faces();
/// toggles the use of mono color mode. /// \brief Toggles the use of mono color mode.
void toggle_use_mono_color(); void toggle_use_default_color();
/// toggles the drawing of text. /// \brief Toggles the use of the default color mode for normals.
void toggle_use_default_color_normal();
/// \brief Toggles the use of flat shading.
void toggle_flat_shading();
/// \brief Toggles the drawing of text.
void toggle_draw_text(); void toggle_draw_text();
/// returns `true` if vertices are drawn. /// \brief Reverses all normals of vertices and faces.
void reverse_all_normals();
/// @}
/// \name Getters
/// @{
/// \brief Checks if vertices are drawn.
/// \return `true` if vertices are drawn, `false` otherwise.
bool draw_vertices() const; bool draw_vertices() const;
/// returns `true` if edges are drawn. /// \brief Checks if edges are drawn.
/// \return `true` if edges are drawn, `false` otherwise.
bool draw_edges() const; bool draw_edges() const;
/// returns `true` if rays are drawn. /// \brief Checks if rays are drawn.
/// \return `true` if rays are drawn, `false` otherwise.
bool draw_rays() const; bool draw_rays() const;
/// returns `true` if lines are drawn. /// \brief Checks if lines are drawn.
/// \return `true` if lines are drawn, `false` otherwise.
bool draw_lines() const; bool draw_lines() const;
/// returns `true` if faces are drawn. /// \brief Checks if faces are drawn.
/// \return `true` if faces are drawn, `false` otherwise.
bool draw_faces() const; bool draw_faces() const;
/// returns `true` if mono color mode is used. /// \brief Checks if text is drawn.
bool use_mono_color() const; /// \return `true` if text is drawn, `false` otherwise.
/// returns `true` if normals are reversed.
bool reverse_normal() const;
/// returns `true` if text are drawn.
bool draw_text() const; bool draw_text() const;
/// returns the mono color used for vertices. /// \brief Checks if the default color mode is used.
const CGAL::IO::Color& vertices_mono_color() const; /// \return `true` if mono color mode is used, `false` otherwise.
bool use_default_color() const;
/// returns the mono color used for edges. /// \brief Checks if the default color mode for normals is used.
const CGAL::IO::Color& edges_mono_color() const; /// \return `true` if default color mode for normals is used, `false` otherwise.
bool use_default_color_normal() const;
/// returns the mono color used for rays. /// \brief Checks if normals are reversed.
const CGAL::IO::Color& rays_mono_color() const; /// \return `true` if normals are reversed, `false` otherwise.
bool reverse_normal() const;
/// returns the mono color used for lines. /// \brief Checks if the clipping plane is enabled.
const CGAL::IO::Color& lines_mono_color() const; /// \return `true` if the clipping plane is enabled, `false` otherwise.
/// returns the mono color used for faces.
const CGAL::IO::Color& faces_mono_color() const;
/// returns `true` if the clipping plane is enabled.
bool clipping_plane_enabled() const; bool clipping_plane_enabled() const;
/// returns the clipping plane when it is enabled. /// \brief Checks if m_no_2D_mode is false and the graphics scene is two-dimensional.
/// \return `true` if m_no_2D_mode is false and the scene is 2D, `false` otherwise.
bool is_two_dimensional() const;
/// \brief Gets the clipping plane when enabled.
/// \return The clipping plane as a `CGAL::Exact_predicates_inexact_constructions_kernel::Plane_3` object.
CGAL::Exact_predicates_inexact_constructions_kernel::Plane_3 clipping_plane() const; CGAL::Exact_predicates_inexact_constructions_kernel::Plane_3 clipping_plane() const;
/// returns the graphics scene of the viewer. /// \brief Gets the graphics scene of the viewer.
/// \return A reference to the `Graphics_scene` object.
const Graphics_scene& graphics_scene() const; const Graphics_scene& graphics_scene() const;
/// reverses all normals of vertices and faces. /// @}
void reverse_all_normals();
/// \name Draw
/// @{
/// draws the viewer without recomputing all internal buffers. /// draws the viewer without recomputing all internal buffers.
virtual void draw(); virtual void draw();
@ -132,6 +193,8 @@ public:
/// redraws the viewer, i.e., recompute all internal buffers and update the window. /// redraws the viewer, i.e., recompute all internal buffers and update the window.
virtual void redraw(); virtual void redraw();
/// @}
/// Function called when a key is pressed. Users can define their own function in order /// Function called when a key is pressed. Users can define their own function in order
/// to add specific behavior. /// to add specific behavior.
std::function<bool(QKeyEvent *, CGAL::Qt::Basic_viewer *)> on_key_pressed; std::function<bool(QKeyEvent *, CGAL::Qt::Basic_viewer *)> on_key_pressed;

View File

@ -1,4 +1,4 @@
/// \defgroup PkgBasicViewerRef Basic Viewer Reference /// \defgroup PkgBasicViewerRef Reference Manual
/// \defgroup PkgBasicViewerConcepts Concepts /// \defgroup PkgBasicViewerConcepts Concepts
/// \ingroup PkgBasicViewerRef /// \ingroup PkgBasicViewerRef

View File

@ -15,8 +15,6 @@ find_package(Eigen3 3.1.0)
include(CGAL_Eigen3_support) include(CGAL_Eigen3_support)
create_single_source_cgal_program("draw_lcc.cpp") create_single_source_cgal_program("draw_lcc.cpp")
create_single_source_cgal_program("draw_mesh_and_points.cpp")
create_single_source_cgal_program("draw_several_windows.cpp")
create_single_source_cgal_program("draw_surface_mesh_height.cpp") create_single_source_cgal_program("draw_surface_mesh_height.cpp")
create_single_source_cgal_program("draw_surface_mesh_small_faces.cpp") create_single_source_cgal_program("draw_surface_mesh_small_faces.cpp")
create_single_source_cgal_program("draw_surface_mesh_vcolor.cpp") create_single_source_cgal_program("draw_surface_mesh_vcolor.cpp")
@ -24,18 +22,19 @@ create_single_source_cgal_program("draw_surface_mesh_vcolor.cpp")
if(CGAL_Qt6_FOUND) if(CGAL_Qt6_FOUND)
#link it with the required CGAL libraries #link it with the required CGAL libraries
target_link_libraries(draw_lcc PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(draw_lcc PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(draw_mesh_and_points PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(draw_several_windows PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(draw_surface_mesh_height PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_height PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(draw_surface_mesh_small_faces PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_small_faces PRIVATE CGAL::CGAL_Basic_viewer)
target_link_libraries(draw_surface_mesh_vcolor PRIVATE CGAL::CGAL_Basic_viewer) target_link_libraries(draw_surface_mesh_vcolor PRIVATE CGAL::CGAL_Basic_viewer)
if(TARGET CGAL::Eigen3_support)
create_single_source_cgal_program("draw_mesh_and_points.cpp")
create_single_source_cgal_program("draw_several_windows.cpp")
target_link_libraries(draw_mesh_and_points PRIVATE CGAL::Eigen3_support CGAL::CGAL_Basic_viewer)
target_link_libraries(draw_several_windows PRIVATE CGAL::Eigen3_support CGAL::CGAL_Basic_viewer)
else()
message("Eigen3 is not found, examples that require Eigen3 will not be compiled.")
endif()
else() else()
message("CGAL_Qt6 not configured: examples that require Qt will not be compiled.") message("CGAL_Qt6 not configured: examples that require Qt will not be compiled.")
endif() endif()
if(TARGET CGAL::Eigen3_support)
target_link_libraries(draw_mesh_and_points PRIVATE CGAL::Eigen3_support)
target_link_libraries(draw_several_windows PRIVATE CGAL::Eigen3_support)
endif()
#end of the file #end of the file

View File

@ -5,7 +5,7 @@
#include <CGAL/draw_polyhedron.h> #include <CGAL/draw_polyhedron.h>
#include <CGAL/draw_point_set_3.h> #include <CGAL/draw_point_set_3.h>
#include <CGAL/Graphics_scene_options.h> #include <CGAL/Graphics_scene_options.h>
#include <CGAL/Qt/Basic_viewer.h> #include <CGAL/Basic_viewer.h>
#include <vector> #include <vector>
#include <iostream> #include <iostream>

View File

@ -5,7 +5,7 @@
#include <CGAL/draw_polyhedron.h> #include <CGAL/draw_polyhedron.h>
#include <CGAL/draw_point_set_3.h> #include <CGAL/draw_point_set_3.h>
#include <CGAL/Graphics_scene_options.h> #include <CGAL/Graphics_scene_options.h>
#include <CGAL/Qt/Basic_viewer.h> #include <CGAL/Basic_viewer.h>
#ifdef CGAL_USE_BASIC_VIEWER #ifdef CGAL_USE_BASIC_VIEWER
#include <QMainWindow> #include <QMainWindow>

View File

@ -17,131 +17,299 @@
namespace CGAL namespace CGAL
{ {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
const char vertex_source_color[]=R"DELIM( const char VERTEX_SOURCE_COLOR[]=R"DELIM(
#version 150 #version 150
in highp vec4 vertex; in highp vec3 a_Pos;
in highp vec3 normal; in highp vec3 a_Normal;
in highp vec3 color; in mediump vec3 a_Color;
uniform highp mat4 mvp_matrix; out highp vec4 vs_fP; // view space position
uniform highp mat4 mv_matrix; out highp vec4 ls_fP; // local space position
uniform highp float point_size;
out highp vec4 fP;
out highp vec3 fN; out highp vec3 fN;
out highp vec4 fColor; out mediump vec4 fColor;
out highp vec4 m_vertex;
uniform highp mat4 u_Mvp;
uniform highp mat4 u_Mv;
uniform mediump float u_PointSize;
uniform mediump vec3 u_DefaultColor;
uniform bool u_UseDefaultColor;
void main(void) void main(void)
{ {
fP = mv_matrix * vertex; fColor = vec4(a_Color, 1.0);
fN = mat3(mv_matrix)* normal; if (u_UseDefaultColor)
fColor = vec4(color, 1.0); {
gl_PointSize = point_size; fColor = vec4(u_DefaultColor, 1.0);
}
m_vertex = vertex; vec4 pos = vec4(a_Pos, 1.0);
gl_Position = mvp_matrix * vertex; ls_fP = pos;
vs_fP = u_Mv * pos;
fN = mat3(u_Mv)* a_Normal;
gl_Position = u_Mvp * pos;
gl_PointSize = u_PointSize;
} }
)DELIM"; )DELIM";
const char fragment_source_color[]=R"DELIM( const char FRAGMENT_SOURCE_COLOR[]=R"DELIM(
#version 150 #version 150
in highp vec4 fP; in highp vec4 vs_fP;
in highp vec4 ls_fP;
in highp vec3 fN; in highp vec3 fN;
in highp vec4 fColor; in mediump vec4 fColor;
in highp vec4 m_vertex;
uniform highp vec4 light_pos; out mediump vec4 out_color;
uniform highp vec4 light_diff;
uniform highp vec4 light_spec;
uniform highp vec4 light_amb;
uniform highp float spec_power;
uniform highp vec4 clipPlane; uniform highp vec4 u_LightPos;
uniform highp vec4 pointPlane; uniform mediump vec4 u_LightDiff;
uniform highp float rendering_mode; uniform mediump vec4 u_LightSpec;
uniform highp float rendering_transparency; uniform mediump vec4 u_LightAmb;
uniform mediump float u_SpecPower;
out highp vec4 out_color; uniform highp vec4 u_ClipPlane;
uniform highp vec4 u_PointPlane;
uniform mediump float u_RenderingMode;
uniform mediump float u_RenderingTransparency;
void main(void) void main(void)
{ {
highp vec3 L = light_pos.xyz - fP.xyz; highp vec3 L = u_LightPos.xyz - vs_fP.xyz;
highp vec3 V = -fP.xyz; highp vec3 V = -vs_fP.xyz;
highp vec3 N = normalize(fN); highp vec3 a_Normal = normalize(fN);
L = normalize(L); L = normalize(L);
V = normalize(V); V = normalize(V);
highp vec3 R = reflect(-L, N); highp vec3 R = reflect(-L, a_Normal);
highp vec4 diffuse = vec4(max(dot(N,L), 0.0) * light_diff.rgb * fColor.rgb, 1.0); highp vec4 diffuse = vec4(max(dot(a_Normal,L), 0.0) * u_LightDiff.rgb * fColor.rgb, 1.0);
highp vec4 ambient = vec4(light_amb.rgb * fColor.rgb, 1.0); highp vec4 ambient = vec4(u_LightAmb.rgb * fColor.rgb, 1.0);
highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; highp vec4 specular = pow(max(dot(R,V), 0.0), u_SpecPower) * u_LightSpec;
// onPlane == 1: inside clipping plane, should be solid; // onPlane == 1: inside clipping plane, should be solid;
// onPlane == -1: outside clipping plane, should be transparent; // onPlane == -1: outside clipping plane, should be transparent;
// onPlane == 0: on clipping plane, whatever; // onPlane == 0: on clipping plane, whatever;
float onPlane = sign(dot((m_vertex.xyz-pointPlane.xyz), clipPlane.xyz)); float onPlane = sign(dot((ls_fP.xyz-u_PointPlane.xyz), u_ClipPlane.xyz));
// rendering_mode == -1: draw all solid; // rendering_mode == -1: draw all solid;
// rendering_mode == 0: draw solid only; // rendering_mode == 0: draw solid only;
// rendering_mode == 1: draw transparent only; // rendering_mode == 1: draw transparent only;
if (rendering_mode == (onPlane+1)/2) { if (u_RenderingMode == (onPlane+1)/2) {
// discard other than the corresponding half when rendering // discard other than the corresponding half when rendering
discard; discard;
} }
// draw corresponding part // draw corresponding part
out_color = rendering_mode < 1 ? (diffuse + ambient) : out_color = u_RenderingMode < 1 ? (diffuse + ambient) :
vec4(diffuse.rgb + ambient.rgb, rendering_transparency); vec4(diffuse.rgb + ambient.rgb, u_RenderingTransparency);
} }
)DELIM"; )DELIM";
const char vertex_source_p_l[]=R"DELIM( const char VERTEX_SOURCE_P_L[]=R"DELIM(
#version 150 #version 150
in highp vec4 vertex; in highp vec3 a_Pos;
in highp vec3 color; in mediump vec3 a_Color;
uniform highp mat4 mvp_matrix; out mediump vec4 fColor;
uniform highp float point_size; out highp vec4 ls_fP; // local space
out highp vec4 fColor; uniform highp mat4 u_Mvp;
out highp vec4 m_vertex; uniform mediump float u_PointSize;
uniform bool u_IsOrthographic;
uniform mediump vec3 u_DefaultColor;
uniform bool u_UseDefaultColor;
bool EqualZero(float value)
{
return abs(value) < 0.00001;
}
void main(void) void main(void)
{ {
gl_PointSize = point_size; fColor = vec4(a_Color, 1.0);
fColor = vec4(color, 1.0); if (u_UseDefaultColor)
m_vertex = vertex; {
gl_Position = mvp_matrix * vertex; fColor = vec4(u_DefaultColor, 1.0);
}
vec4 pos = vec4(a_Pos, 1.0);
ls_fP = pos;
gl_Position = u_Mvp * pos;
float distance = gl_Position.w;
if (u_IsOrthographic)
{
distance = u_PointSize;
}
float effectiveDistance = EqualZero(distance) ? 0.00001 : distance;
gl_PointSize = u_PointSize / effectiveDistance * 5.0;
} }
)DELIM"; )DELIM";
const char fragment_source_p_l[]=R"DELIM( const char VERTEX_SOURCE_SHAPE[]=R"DELIM(
#version 150 #version 150
in highp vec4 fColor; in highp vec3 a_Pos;
in highp vec4 m_vertex; in mediump vec3 a_Color;
uniform highp vec4 clipPlane; out mediump vec4 gColor;
uniform highp vec4 pointPlane; out highp vec4 ls_fP;
uniform highp float rendering_mode;
out highp vec4 out_color; uniform highp mat4 u_Mvp;
uniform mediump vec3 u_DefaultColor;
uniform bool u_UseDefaultColor;
void main(void)
{
gColor = vec4(a_Color, 1.0);
if (u_UseDefaultColor)
{
gColor = vec4(u_DefaultColor, 1.0);
}
gl_Position = vec4(a_Pos, 1.0);
}
)DELIM";
const char GEOMETRY_SOURCE_SPHERE[]=R"DELIM(
#version 150
layout(points) in;
layout(triangle_strip, max_vertices = 72) out; // max_vertices = (resolution+1) * 2 * latResolution
#define PI 3.14159265358979323846
in mediump vec4 gColor[];
out mediump vec4 fColor;
out highp vec4 ls_fP;
uniform highp mat4 u_Mvp;
uniform mediump float u_Radius;
void drawSphere(in vec4 center, in float radius, in float resolution)
{
float latResolution = resolution*0.5;
float stepTheta = PI/latResolution;
float stepPhi = 2*PI/resolution;
for(int i=0; i<latResolution; ++i)
{
float theta1 = stepTheta*i;
float theta2 = stepTheta*(i+1);
for(int j=0; j<=resolution; ++j)
{
float phi = stepPhi*j;
float x1 = center.x + radius * sin(theta1) * cos(phi);
float y1 = center.y + radius * sin(theta1) * sin(phi);
float z1 = center.z + radius * cos(theta1);
ls_fP = vec4(x1, y1, z1, 1.0);
gl_Position = u_Mvp * ls_fP;
EmitVertex();
float x2 = center.x + radius * sin(theta2) * cos(phi);
float y2 = center.y + radius * sin(theta2) * sin(phi);
float z2 = center.z + radius * cos(theta2);
ls_fP = vec4(x2, y2, z2, 1.0);
gl_Position = u_Mvp * ls_fP;
EmitVertex();
}
EndPrimitive();
}
}
void main(void)
{
fColor = gColor[0];
int resolution = 8;
vec4 center = gl_in[0].gl_Position;
drawSphere(center, u_Radius, resolution);
}
)DELIM";
const char GEOMETRY_SOURCE_CYLINDER[]=R"DELIM(
#version 150
layout(lines) in;
layout(triangle_strip, max_vertices = 22) out;
#define PI 3.14159265358979323846
in mediump vec4 gColor[];
out mediump vec4 fColor;
out highp vec4 ls_fP;
uniform highp mat4 u_Mvp;
uniform mediump float u_Radius;
void drawCylinder(in vec3 u, in vec3 v, in vec4 bot, in vec4 top, in float radius, in float resolution)
{
float step = 2*PI/resolution;
for(int i=0; i<=resolution; ++i)
{
float theta = step*i;
float cosf = radius*cos(theta);
float sinf = radius*sin(theta);
vec3 xAxis = cosf*u.xyz;
vec3 yAxis = sinf*v.xyz;
ls_fP = vec4(top.xyz+xAxis.xyz+yAxis.xyz, 1.0);
gl_Position = u_Mvp * ls_fP;
EmitVertex();
ls_fP = vec4(bot.xyz+xAxis.xyz+yAxis.xyz, 1.0);
gl_Position = u_Mvp * ls_fP;
EmitVertex();
}
EndPrimitive();
}
void main(void)
{
fColor = gColor[0];
vec4 a = gl_in[0].gl_Position;
vec4 b = gl_in[1].gl_Position;
vec3 n = normalize(vec3(b.x-a.x, b.y-a.y, b.z-a.z)); // compute top normal
vec3 w = normalize(vec3(-n.z, n.x, n.y));
// Axis vectors
vec3 u = normalize(cross(n, w));
vec3 v = normalize(cross(n, u));
int resolution = 10;
drawCylinder(u, v, a, b, u_Radius, resolution);
}
)DELIM";
const char FRAGMENT_SOURCE_P_L[]=R"DELIM(
#version 150
in mediump vec4 fColor;
in highp vec4 ls_fP;
out mediump vec4 out_color;
uniform highp vec4 u_ClipPlane;
uniform highp vec4 u_PointPlane;
uniform mediump float u_RenderingMode;
void main(void) void main(void)
{ {
// onPlane == 1: inside clipping plane, should be solid; // onPlane == 1: inside clipping plane, should be solid;
// onPlane == -1: outside clipping plane, should be transparent; // onPlane == -1: outside clipping plane, should be transparent;
// onPlane == 0: on clipping plane, whatever; // onPlane == 0: on clipping plane, whatever;
float onPlane = sign(dot((m_vertex.xyz-pointPlane.xyz), clipPlane.xyz)); float onPlane = sign(dot((ls_fP.xyz-u_PointPlane.xyz), u_ClipPlane.xyz));
// rendering_mode == -1: draw both inside and outside; // rendering_mode == -1: draw both inside and outside;
// rendering_mode == 0: draw inside only; // rendering_mode == 0: draw inside only;
// rendering_mode == 1: draw outside only; // rendering_mode == 1: draw outside only;
if (rendering_mode == (onPlane+1)/2) { if (u_RenderingMode == (onPlane+1)/2) {
// discard other than the corresponding half when rendering // discard other than the corresponding half when rendering
discard; discard;
} }
@ -150,106 +318,554 @@ void main(void)
} }
)DELIM"; )DELIM";
const char vertex_source_clipping_plane[]=R"DELIM( const char VERTEX_SOURCE_CLIPPING_PLANE[]=R"DELIM(
#version 150 #version 150
in highp vec4 vertex; in highp vec3 a_Pos;
uniform highp mat4 vp_matrix; uniform highp mat4 u_Vp;
uniform highp mat4 m_matrix; uniform highp mat4 u_M;
void main(void) void main(void)
{ {
gl_Position = vp_matrix * m_matrix * vertex; gl_Position = u_Vp * u_M * vec4(a_Pos, 1.0);
} }
)DELIM"; )DELIM";
const char fragment_source_clipping_plane[]=R"DELIM( const char FRAGMENT_SOURCE_CLIPPING_PLANE[]=R"DELIM(
#version 150 #version 150
out highp vec4 out_color;
out mediump vec4 out_color;
void main(void) void main(void)
{ {
out_color = vec4(0.0, 0.0, 0.0, 1.0); out_color = vec4(0.0, 0.0, 0.0, 1.0);
} }
)DELIM"; )DELIM";
//------------------------------------------------------------------------------ const char VERTEX_SOURCE_LINE[]=R"DELIM(
// compatibility shaders #version 150
in highp vec3 a_Pos;
in mediump vec3 a_Color;
const char vertex_source_color_comp[]=R"DELIM( out VS_OUT {
varying highp vec4 vertex; mediump vec4 color;
varying highp vec3 normal; } vs_out; // vertex shader output
varying highp vec3 color;
uniform highp mat4 mvp_matrix; uniform mediump vec3 u_DefaultColor;
uniform highp mat4 mv_matrix; uniform bool u_UseDefaultColor;
uniform highp float point_size;
varying highp vec4 fP;
varying highp vec3 fN;
varying highp vec4 fColor;
void main(void) void main(void)
{ {
fP = mv_matrix * vertex; vs_out.color = vec4(a_Color, 1.0);
if (u_UseDefaultColor)
{
vs_out.color = vec4(u_DefaultColor, 1.0);
}
gl_Position = vec4(a_Pos, 1.0);
}
)DELIM";
const char GEOMETRY_SOURCE_ARROW[]=R"DELIM(
#version 150
layout(lines) in;
layout(triangle_strip, max_vertices = 82) out; // max_vertices = resolution * 2 + 2 (cylinder) + resolution * 3 (disc) + resolution * 3 (cone)
#define PI 3.14159265358979323846
in VS_OUT {
mediump vec4 color;
} gs_in[]; // geometry shader input
out mediump vec4 fColor;
uniform highp mat4 u_Mvp;
uniform mediump float u_SceneRadius;
void drawTriangle(in vec4 v1, in vec4 v2, in vec4 v3)
{
gl_Position = u_Mvp*v1;
EmitVertex();
gl_Position = u_Mvp*v2;
EmitVertex();
gl_Position = u_Mvp*v3;
EmitVertex();
EndPrimitive();
}
void drawTriangleFan(in vec3 u, in vec3 v, in vec4 center, in vec4 edge0, in float radius, in int resolution)
{
float step = 2*PI/resolution;
for(int i=0; i<resolution; ++i)
{
float theta = step*i;
float cosf = radius*cos(theta);
float sinf = radius*sin(theta);
vec3 xAxis = cosf*u.xyz;
vec3 yAxis = sinf*v.xyz;
vec4 edge1 = vec4(edge0.xyz+xAxis.xyz+yAxis.xyz, 1.0);
theta = step*(i+1);
cosf = radius*cos(theta);
sinf = radius*sin(theta);
xAxis = cosf*u.xyz;
yAxis = sinf*v.xyz;
vec4 edge2 = vec4(edge0.xyz+xAxis.xyz+yAxis.xyz, 1.0);
drawTriangle(center, edge1, edge2);
}
}
void drawDisc(in vec3 u, in vec3 v, in vec4 center, in float radius, in int resolution)
{
drawTriangleFan(u, v, center, center, radius, resolution);
}
void drawCone(in vec3 u, in vec3 v, in vec3 n, in vec4 center, in float radius, in float height, in int resolution)
{
drawTriangleFan(u, v, center, vec4(center.xyz-height*n.xyz, 1.0), radius, resolution);
}
void drawCylinder(in vec3 u, in vec3 v, in vec4 bot, in vec4 top, in float radius, in float resolution)
{
float step = 2*PI/resolution;
for(int i=0; i<=resolution; ++i)
{
float theta = step*i;
float cosf = radius*cos(theta);
float sinf = radius*sin(theta);
vec3 xAxis = cosf*u.xyz;
vec3 yAxis = sinf*v.xyz;
gl_Position = u_Mvp * vec4(top.xyz+xAxis.xyz+yAxis.xyz, 1.0);
EmitVertex();
gl_Position = u_Mvp * vec4(bot.xyz+xAxis.xyz+yAxis.xyz, 1.0);
EmitVertex();
}
EndPrimitive();
}
void main(void)
{
fColor = gs_in[0].color;
vec4 a = gl_in[0].gl_Position;
vec4 b = gl_in[1].gl_Position;
vec3 n = normalize(vec3(b.x-a.x, b.y-a.y, b.z-a.z)); // compute top normal
vec3 w = normalize(vec3(-n.z, n.x, n.y));
// Axis vectors
vec3 u = normalize(cross(n, w));
vec3 v = normalize(cross(n, u));
float radius = 0.013 * u_SceneRadius;
float height = 0.035 * u_SceneRadius;
int resolution = 10;
vec4 c = vec4(b.xyz-height*n.xyz, 1.0);
drawDisc(u, v, c, radius, resolution);
drawCone(u, v, n, b, radius, height, resolution);
drawCylinder(u, v, a, c, radius*0.5, resolution);
}
)DELIM";
const char GEOMETRY_SOURCE_LINE[]=R"DELIM(
#version 150
layout(lines) in;
layout(line_strip, max_vertices = 2) out;
in VS_OUT {
mediump vec4 color;
} gs_in[]; // geometry shader input
out mediump vec4 fColor;
uniform highp mat4 u_Mvp;
void main(void)
{
fColor = gs_in[0].color;
gl_Position = u_Mvp * gl_in[0].gl_Position;
EmitVertex();
gl_Position = u_Mvp * gl_in[1].gl_Position;
EmitVertex();
EndPrimitive();
}
)DELIM";
const char FRAGMENT_SOURCE_LINE[]=R"DELIM(
#version 150
in mediump vec4 fColor;
out mediump vec4 out_color;
void main(void)
{
out_color = fColor;
}
)DELIM";
const char VERTEX_SOURCE_NORMAL[]=R"DELIM(
#version 150
in highp vec3 a_Pos;
in highp vec3 a_Normal;
out VS_OUT {
mediump vec4 color;
highp vec3 normal;
} vs_out; // vertex shader output
uniform highp mat4 u_Mv;
uniform mediump vec3 u_DefaultColor;
uniform bool u_UseDefaultColor;
void main(void)
{
vs_out.color = vec4(abs(normalize(a_Normal)), 1.0);
if (u_UseDefaultColor)
{
vs_out.color = vec4(u_DefaultColor, 1.0);
}
mat3 normalMatrix = mat3(transpose(inverse(u_Mv)));
vs_out.normal = normalize(vec3(vec4(normalMatrix * a_Normal, 0.0)));
gl_Position = vec4(a_Pos, 1.0);
}
)DELIM";
const char GEOMETRY_SOURCE_NORMAL[]=R"DELIM(
#version 150
layout (triangles) in;
layout (line_strip, max_vertices = 6) out;
in VS_OUT {
mediump vec4 color;
highp vec3 normal;
} gs_in[]; // geometry shader input
out mediump vec4 fColor;
out highp vec4 ls_fP;
uniform highp mat4 u_Projection;
uniform mediump float u_Factor;
uniform mediump float u_SceneRadius;
uniform highp mat4 u_Mv;
uniform bool u_DisplayFaceNormal;
void GenerateLine(int index)
{
fColor = gs_in[index].color;
ls_fP = gl_in[index].gl_Position;
gl_Position = u_Projection * u_Mv * gl_in[index].gl_Position;
EmitVertex();
vec4 newPosition = u_Mv * gl_in[index].gl_Position + vec4(gs_in[index].normal, 0.0) * u_SceneRadius * u_Factor;
ls_fP = inverse(u_Mv) * newPosition;
gl_Position = u_Projection * newPosition;
EmitVertex();
EndPrimitive();
}
void DrawVerticesNormal()
{
GenerateLine(0); // first vertex normal
GenerateLine(1); // second vertex normal
GenerateLine(2); // third vertex normal
}
void DrawFaceNormal()
{
fColor = (gs_in[0].color + gs_in[1].color + gs_in[2].color) / 3;
vec4 center = (gl_in[0].gl_Position + gl_in[1].gl_Position + gl_in[2].gl_Position) / 3;
ls_fP = center;
gl_Position = u_Projection * u_Mv * center;
EmitVertex();
vec3 n = normalize((gs_in[0].normal.xyz + gs_in[1].normal.xyz + gs_in[2].normal.xyz) / 3);
vec4 newPosition = u_Mv * center + vec4(n, 0.0) * u_SceneRadius * u_Factor;
ls_fP = inverse(u_Mv) * newPosition;
gl_Position = u_Projection * newPosition;
EmitVertex();
}
void main()
{
if (u_DisplayFaceNormal)
{
DrawFaceNormal();
}
else
{
DrawVerticesNormal();
}
}
)DELIM";
const char VERTEX_SOURCE_TRIANGLE[]=R"DELIM(
#version 150
in highp vec3 a_Pos;
out VS_OUT {
mediump vec4 color;
highp vec4 ls_fP;
} vs_out;
uniform highp mat4 u_Mvp;
void main(void)
{
vec4 pos = vec4(a_Pos, 1.0);
vs_out.color = vec4(0.85, 0.85, 0.85, 1.0);
vs_out.ls_fP = pos;
gl_Position = u_Mvp * pos;
}
)DELIM";
const char GEOMETRY_SOURCE_TRIANGLE[]=R"DELIM(
#version 150
layout (triangles) in;
layout (line_strip, max_vertices=4) out;
in VS_OUT {
mediump vec4 color;
highp vec4 ls_fP;
} gs_in[];
out mediump vec4 fColor;
out highp vec4 ls_fP;
void main(void)
{
fColor = gs_in[0].color;
ls_fP = gs_in[0].ls_fP;
gl_Position = gl_in[0].gl_Position;
EmitVertex();
ls_fP = gs_in[1].ls_fP;
gl_Position = gl_in[1].gl_Position;
EmitVertex();
ls_fP = gs_in[2].ls_fP;
gl_Position = gl_in[2].gl_Position;
EmitVertex();
ls_fP = gs_in[0].ls_fP;
gl_Position = gl_in[0].gl_Position;
EmitVertex();
}
)DELIM";
const char VERTEX_SOURCE_LINE_WIDTH[]=R"DELIM(
#version 150
in highp vec3 a_Pos;
in mediump vec3 a_Color;
out VS_OUT {
mediump float pointSize;
mediump vec4 color;
highp vec4 ls_fP;
} vs_out;
uniform highp mat4 u_Mvp;
uniform mediump float u_PointSize;
uniform bool u_IsOrthographic;
uniform mediump vec3 u_DefaultColor;
uniform bool u_UseDefaultColor;
bool EqualZero(float value)
{
return abs(value) < 0.00001;
}
void main(void)
{
vec4 pos = vec4(a_Pos, 1.0);
vs_out.ls_fP = pos;
vs_out.color = vec4(a_Color, 1.0);
if (u_UseDefaultColor)
{
vs_out.color = vec4(u_DefaultColor, 1.0);
}
gl_Position = u_Mvp * pos;
float distance = gl_Position.w;
if (u_IsOrthographic)
{
distance = u_PointSize;
}
float effectiveDistance = EqualZero(distance) ? 0.00001 : distance;
vs_out.pointSize = u_PointSize / effectiveDistance;
}
)DELIM";
const char GEOMETRY_SOURCE_LINE_WIDTH[]=R"DELIM(
#version 150
layout (lines) in;
layout (triangle_strip, max_vertices = 4) out;
in mediump vec4 g_Color[];
in VS_OUT {
mediump float pointSize;
mediump vec4 color;
highp vec4 ls_fP;
} gs_in[];
out mediump vec4 fColor;
out highp vec4 ls_fP;
uniform mediump float u_PointSize;
uniform mediump vec2 u_Viewport;
uniform highp mat4 u_Mvp;
vec2 ToScreenSpace(vec4 vertex)
{
return vec2(vertex.xy / vertex.w) * u_Viewport;
}
vec4 ToWorldSpace(vec4 vertex)
{
return vec4((vertex.xy * vertex.w) / u_Viewport, vertex.zw);
}
void main(void)
{
vec2 p0 = ToScreenSpace(gl_in[0].gl_Position);
vec2 p1 = ToScreenSpace(gl_in[1].gl_Position);
vec2 v0 = normalize(p1 - p0);
vec2 n0 = vec2(-v0.y, v0.x) * u_PointSize * 0.5;
// line start
gl_Position = ToWorldSpace(vec4(p0 - n0 * gs_in[0].pointSize, gl_in[0].gl_Position.zw));
fColor = gs_in[0].color;
ls_fP = inverse(u_Mvp) * gl_Position;
EmitVertex();
gl_Position = ToWorldSpace(vec4(p0 + n0 * gs_in[0].pointSize, gl_in[0].gl_Position.zw));
fColor = gs_in[0].color;
ls_fP = inverse(u_Mvp) * gl_Position;
EmitVertex();
// line end
gl_Position = ToWorldSpace(vec4(p1 - n0 * gs_in[1].pointSize, gl_in[1].gl_Position.zw));
fColor = gs_in[1].color;
ls_fP = inverse(u_Mvp) * gl_Position;
EmitVertex();
gl_Position = ToWorldSpace(vec4(p1 + n0 * gs_in[1].pointSize, gl_in[1].gl_Position.zw));
fColor = gs_in[1].color;
ls_fP = inverse(u_Mvp) * gl_Position;
EmitVertex();
}
)DELIM";
//------------------------------------------------------------------------------
// compatibility shaders
const char VERTEX_SOURCE_COLOR_COMP[]=R"DELIM(
varying highp vec3 a_Pos;
varying highp vec3 a_Normal;
varying mediump vec3 a_Color;
varying highp vec4 vs_fP; // view space position
varying highp vec3 fN;
varying mediump vec4 fColor;
uniform highp mat4 u_Mvp;
uniform highp mat4 u_Mv;
uniform mediump float u_PointSize;
uniform mediump vec3 u_DefaultColor;
uniform bool u_UseDefaultColor;
void main(void)
{
vec4 pos = vec4(a_Pos, 1.0);
vs_fP = u_Mv * pos;
highp mat3 mv_matrix_3; highp mat3 mv_matrix_3;
mv_matrix_3[0] = mv_matrix[0].xyz; mv_matrix_3[0] = mv_matrix[0].xyz;
mv_matrix_3[1] = mv_matrix[1].xyz; mv_matrix_3[1] = mv_matrix[1].xyz;
mv_matrix_3[2] = mv_matrix[2].xyz; mv_matrix_3[2] = mv_matrix[2].xyz;
fN = mv_matrix_3* normal; fN = mv_matrix_3* a_Normal;
fColor = vec4(color, 1.0);
gl_PointSize = point_size;
gl_Position = mvp_matrix * vertex; fColor = vec4(a_Color, 1.0);
if (u_UseDefaultColor)
{
fColor = vec4(u_DefaultColor, 1.0);
}
gl_PointSize = u_PointSize;
gl_Position = u_Mvp * pos;
} }
)DELIM"; )DELIM";
const char fragment_source_color_comp[]=R"DELIM( const char FRAGMENT_SOURCE_COLOR_COMP[]=R"DELIM(
varying highp vec4 fP; varying highp vec4 vs_fP;
varying highp vec3 fN; varying highp vec3 fN;
varying highp vec4 fColor; varying mediump vec4 fColor;
uniform highp vec4 light_pos; uniform highp vec4 u_LightPos;
uniform highp vec4 light_diff; uniform mediump vec4 u_LightDiff;
uniform highp vec4 light_spec; uniform mediump vec4 u_LightSpec;
uniform highp vec4 light_amb; uniform mediump vec4 u_LightAmb;
uniform highp float spec_power ; uniform mediump float u_SpecPower ;
void main(void) void main(void)
{ {
highp vec3 L = light_pos.xyz - fP.xyz; highp vec3 L = u_LightPos.xyz - vs_fP.xyz;
highp vec3 V = -fP.xyz; highp vec3 V = -vs_fP.xyz;
highp vec3 N = normalize(fN); highp vec3 a_Normal = normalize(fN);
L = normalize(L); L = normalize(L);
V = normalize(V); V = normalize(V);
highp vec3 R = reflect(-L, N); highp vec3 R = reflect(-L, a_Normal);
highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; highp vec4 diffuse = max(dot(a_Normal,L), 0.0) * u_LightDiff * fColor;
highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; highp vec4 specular = pow(max(dot(R,V), 0.0), u_SpecPower) * u_LightSpec;
gl_FragColor = light_amb*fColor + diffuse; gl_FragColor = u_LightAmb*fColor + diffuse;
} }
)DELIM"; )DELIM";
const char vertex_source_p_l_comp[]=R"DELIM( const char VERTEX_SOURCE_P_L_COMP[]=R"DELIM(
varying highp vec4 vertex; varying highp vec3 a_Pos;
varying highp vec3 color; varying mediump vec3 a_Color;
uniform highp mat4 mvp_matrix; varying mediump vec4 fColor;
uniform highp float point_size;
varying highp vec4 fColor; uniform highp mat4 u_Mvp;
uniform mediump float u_PointSize;
uniform mediump vec3 u_DefaultColor;
uniform bool u_UseDefaultColor;
void main(void) void main(void)
{ {
gl_PointSize = point_size; fColor = vec4(a_Color, 1.0);
fColor = vec4(color, 1.0); if (u_UseDefaultColor)
gl_Position = mvp_matrix * vertex; {
fColor = vec4(u_DefaultColor, 1.0);
}
gl_PointSize = u_PointSize;
gl_Position = u_Mvp * vec4(a_Pos, 1.0);
} }
)DELIM"; )DELIM";
const char fragment_source_p_l_comp[]=R"DELIM( const char FRAGMENT_SOURCE_P_L_COMP[]=R"DELIM(
varying highp vec4 fColor; varying mediump vec4 fColor;
void main(void) void main(void)
{ {
gl_FragColor = fColor; gl_FragColor = fColor;

View File

@ -0,0 +1,44 @@
// Copyright (c) 2018 GeometryFactory Sarl (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) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
#ifndef CGAL_BASIC_VIEWER_H
#define CGAL_BASIC_VIEWER_H
#include <CGAL/license/GraphicsView.h>
#include <CGAL/Graphics_scene.h>
// compatibility
#if defined(CGAL_USE_BASIC_VIEWER) && !defined(CGAL_USE_BASIC_VIEWER_QT)
#define CGAL_USE_BASIC_VIEWER_QT 1
#endif
#if defined(CGAL_USE_BASIC_VIEWER_QT) && !defined(CGAL_USE_BASIC_VIEWER)
#define CGAL_USE_BASIC_VIEWER 1
#endif
#if defined(CGAL_USE_BASIC_VIEWER_QT)
#include <CGAL/Qt/Basic_viewer.h>
// #elif defined(CGAL_USE_BASIC_VIEWER_GLFW)
// #include <CGAL/GLFW/Basic_viewer.h>
#else
namespace CGAL
{
inline
void draw_graphics_scene(const Graphics_scene&,
const char* ="CGAL Basic Viewer")
{
std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."<<std::endl;
}
} // End namespace CGAL
#endif
#endif // CGAL_BASIC_VIEWER_H

View File

@ -146,7 +146,7 @@ namespace internal
{ {
typename CDT::Edge e(fh,i); typename CDT::Edge e(fh,i);
auto n = fh->neighbor(i); auto n = fh->neighbor(i);
if (n->info().m_nesting_level==-1) if (n!=nullptr && n->info().m_nesting_level==-1)
{ {
if (tri.is_constrained(e)) { border.push(e); } if (tri.is_constrained(e)) { border.push(e); }
else { queue.push(n); } else { queue.push(n); }
@ -884,13 +884,13 @@ protected:
typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS, Itag> CDT; typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS, Itag> CDT;
protected: protected:
std::vector<BufferType>* m_pos_buffer; std::vector<BufferType>* m_pos_buffer=nullptr;
std::vector<IndexType>* m_index_buffer; std::vector<IndexType>* m_index_buffer=nullptr;
std::vector<BufferType>* m_color_buffer; std::vector<BufferType>* m_color_buffer=nullptr;
mutable std::vector<BufferType>* m_flat_normal_buffer; mutable std::vector<BufferType>* m_flat_normal_buffer=nullptr;
mutable std::vector<BufferType>* m_gouraud_normal_buffer; mutable std::vector<BufferType>* m_gouraud_normal_buffer=nullptr;
CGAL::Bbox_3* m_bb; CGAL::Bbox_3* m_bb=nullptr;
bool m_zero_x; /// True iff all points have x==0 bool m_zero_x; /// True iff all points have x==0
bool m_zero_y; /// True iff all points have y==0 bool m_zero_y; /// True iff all points have y==0

View File

@ -64,64 +64,82 @@ public:
typedef Local_kernel::Vector_3 Local_vector; typedef Local_kernel::Vector_3 Local_vector;
Graphics_scene() Graphics_scene()
: m_buffer_for_mono_points(&arrays[POS_MONO_POINTS], nullptr, : m_buffer_for_points(&arrays[POS_POINTS], nullptr,
&m_bounding_box, nullptr, nullptr, nullptr), &m_bounding_box, &arrays[COLOR_POINTS]),
m_buffer_for_colored_points(&arrays[POS_COLORED_POINTS], nullptr, m_buffer_for_segments(&arrays[POS_SEGMENTS], nullptr,
&m_bounding_box, &arrays[COLOR_POINTS], &m_bounding_box, &arrays[COLOR_SEGMENTS]),
nullptr, nullptr), m_buffer_for_rays(&arrays[POS_RAYS], nullptr, &m_bounding_box,
m_buffer_for_mono_segments(&arrays[POS_MONO_SEGMENTS], nullptr, &arrays[COLOR_RAYS]),
&m_bounding_box, nullptr, nullptr, nullptr), m_buffer_for_lines(&arrays[POS_RAYS], nullptr,
m_buffer_for_colored_segments(&arrays[POS_COLORED_SEGMENTS], nullptr, &m_bounding_box, &arrays[COLOR_LINES]),
&m_bounding_box, &arrays[COLOR_SEGMENTS], m_buffer_for_faces(&arrays[POS_FACES], nullptr, &m_bounding_box, &arrays[COLOR_FACES],
nullptr, nullptr), &arrays[FLAT_NORMAL_FACES], &arrays[SMOOTH_NORMAL_FACES]),
m_buffer_for_mono_rays(&arrays[POS_MONO_RAYS], nullptr, &m_bounding_box, m_default_color_face(60, 60, 200),
nullptr, nullptr), m_default_color_point(200, 60, 60),
m_buffer_for_colored_rays(&arrays[POS_COLORED_RAYS], nullptr, m_default_color_segment(0, 0, 0),
&m_bounding_box, &arrays[COLOR_RAYS], nullptr, m_default_color_ray(0, 0, 0),
nullptr), m_default_color_line(0, 0, 0)
m_buffer_for_mono_lines(&arrays[POS_MONO_RAYS], nullptr,
&m_bounding_box, nullptr, nullptr),
m_buffer_for_colored_lines(&arrays[POS_COLORED_LINES], nullptr,
&m_bounding_box, &arrays[COLOR_LINES],
nullptr, nullptr),
m_buffer_for_mono_faces(
&arrays[POS_MONO_FACES], nullptr, &m_bounding_box, nullptr,
&arrays[FLAT_NORMAL_MONO_FACES], &arrays[SMOOTH_NORMAL_MONO_FACES]),
m_buffer_for_colored_faces(&arrays[POS_COLORED_FACES], nullptr,
&m_bounding_box, &arrays[COLOR_FACES],
&arrays[FLAT_NORMAL_COLORED_FACES],
&arrays[SMOOTH_NORMAL_COLORED_FACES])
{} {}
const Buffer_for_vao &get_buffer_for_mono_points() const inline
{ return m_buffer_for_mono_points; } const CGAL::IO::Color &get_default_color_face() const
{ return m_default_color_face; }
const Buffer_for_vao &get_buffer_for_colored_points() const inline
{ return m_buffer_for_colored_points; } const CGAL::IO::Color &get_default_color_point() const
{ return m_default_color_point; }
const Buffer_for_vao &get_buffer_for_mono_segments() const inline
{ return m_buffer_for_mono_segments; } const CGAL::IO::Color &get_default_color_segment() const
{ return m_default_color_segment; }
const Buffer_for_vao &get_buffer_for_colored_segments() const inline
{ return m_buffer_for_colored_segments; } const CGAL::IO::Color &get_default_color_ray() const
{ return m_default_color_ray; }
const Buffer_for_vao &get_buffer_for_mono_rays() const inline
{ return m_buffer_for_mono_rays; } const CGAL::IO::Color &get_default_color_line() const
{ return m_default_color_line; }
const Buffer_for_vao &get_buffer_for_colored_rays() const inline
{ return m_buffer_for_colored_rays; } const Buffer_for_vao &get_buffer_for_points() const
{ return m_buffer_for_points; }
const Buffer_for_vao &get_buffer_for_mono_lines() const inline
{ return m_buffer_for_mono_lines; } void set_default_color_face(const CGAL::IO::Color& c)
{ m_default_color_face = c; }
const Buffer_for_vao &get_buffer_for_colored_lines() const inline
{ return m_buffer_for_colored_lines; } void set_default_color_point(const CGAL::IO::Color& c)
{ m_default_color_point = c; }
const Buffer_for_vao &get_buffer_for_mono_faces() const inline
{ return m_buffer_for_mono_faces; } void set_default_color_segment(const CGAL::IO::Color& c)
{ m_default_color_segment = c; }
const Buffer_for_vao &get_buffer_for_colored_faces() const inline
{ return m_buffer_for_colored_faces; } void set_default_color_ray(const CGAL::IO::Color& c)
{ m_default_color_ray = c; }
inline
void set_default_color_line(const CGAL::IO::Color& c)
{ m_default_color_line = c; }
inline
const Buffer_for_vao &get_buffer_for_segments() const
{ return m_buffer_for_segments; }
inline
const Buffer_for_vao &get_buffer_for_rays() const
{ return m_buffer_for_rays; }
inline
const Buffer_for_vao &get_buffer_for_lines() const
{ return m_buffer_for_lines; }
inline
const Buffer_for_vao &get_buffer_for_faces() const
{ return m_buffer_for_faces; }
const CGAL::Bbox_3 &bounding_box() const { return m_bounding_box; } const CGAL::Bbox_3 &bounding_box() const { return m_bounding_box; }
@ -159,31 +177,30 @@ public:
void reverse_all_normals() const void reverse_all_normals() const
{ {
m_buffer_for_mono_faces.negate_normals(); m_buffer_for_faces.negate_normals();
m_buffer_for_colored_faces.negate_normals();
} }
template <typename KPoint> void add_point(const KPoint &p) template <typename KPoint> void add_point(const KPoint &p)
{ m_buffer_for_mono_points.add_point(p); } { m_buffer_for_points.add_point(p, m_default_color_point); }
template <typename KPoint> template <typename KPoint>
void add_point(const KPoint &p, const CGAL::IO::Color &acolor) void add_point(const KPoint &p, const CGAL::IO::Color &acolor)
{ m_buffer_for_colored_points.add_point(p, acolor); } { m_buffer_for_points.add_point(p, acolor); }
template <typename KPoint> template <typename KPoint>
void add_segment(const KPoint &p1, const KPoint &p2) void add_segment(const KPoint &p1, const KPoint &p2)
{ m_buffer_for_mono_segments.add_segment(p1, p2); } { m_buffer_for_segments.add_segment(p1, p2, m_default_color_segment); }
template <typename KPoint> template <typename KPoint>
void add_segment(const KPoint &p1, const KPoint &p2, void add_segment(const KPoint &p1, const KPoint &p2,
const CGAL::IO::Color &acolor) const CGAL::IO::Color &acolor)
{ m_buffer_for_colored_segments.add_segment(p1, p2, acolor); } { m_buffer_for_segments.add_segment(p1, p2, acolor); }
template <typename KPoint, typename KVector> template <typename KPoint, typename KVector>
void add_ray(const KPoint &p, const KVector &v) void add_ray(const KPoint &p, const KVector &v)
{ {
double bigNumber = 1e30; double bigNumber = 1e30;
m_buffer_for_mono_rays.add_ray_segment(p, (p + (bigNumber)*v)); m_buffer_for_rays.add_ray_segment(p, (p + (bigNumber)*v), m_default_color_ray);
} }
template <typename KPoint, typename KVector> template <typename KPoint, typename KVector>
@ -191,15 +208,15 @@ public:
const CGAL::IO::Color &acolor) const CGAL::IO::Color &acolor)
{ {
double bigNumber = 1e30; double bigNumber = 1e30;
m_buffer_for_colored_rays.add_ray_segment(p, (p + (bigNumber)*v), acolor); m_buffer_for_rays.add_ray_segment(p, (p + (bigNumber)*v), acolor);
} }
template <typename KPoint, typename KVector> template <typename KPoint, typename KVector>
void add_line(const KPoint &p, const KVector &v) void add_line(const KPoint &p, const KVector &v)
{ {
double bigNumber = 1e30; double bigNumber = 1e30;
m_buffer_for_mono_lines.add_line_segment((p - (bigNumber)*v), m_buffer_for_lines.add_line_segment((p - (bigNumber)*v),
(p + (bigNumber)*v)); (p + (bigNumber)*v), m_default_color_line);
} }
template <typename KPoint, typename KVector> template <typename KPoint, typename KVector>
@ -207,33 +224,28 @@ public:
const CGAL::IO::Color &acolor) const CGAL::IO::Color &acolor)
{ {
double bigNumber = 1e30; double bigNumber = 1e30;
m_buffer_for_colored_lines.add_line_segment((p - (bigNumber)*v), m_buffer_for_lines.add_line_segment((p - (bigNumber)*v),
(p + (bigNumber)*v), acolor); (p + (bigNumber)*v), acolor);
} }
template <typename KPoint> bool add_point_in_face(const KPoint &kp) template <typename KPoint> bool add_point_in_face(const KPoint &kp)
{ {
if (m_buffer_for_mono_faces.is_a_face_started()) if (m_buffer_for_faces.is_a_face_started())
{ return m_buffer_for_mono_faces.add_point_in_face(kp); } { return m_buffer_for_faces.add_point_in_face(kp); }
else if (m_buffer_for_colored_faces.is_a_face_started())
{ return m_buffer_for_colored_faces.add_point_in_face(kp); }
return false; return false;
} }
template <typename KPoint, typename KVector> template <typename KPoint, typename KVector>
bool add_point_in_face(const KPoint &kp, const KVector &p_normal) bool add_point_in_face(const KPoint &kp, const KVector &p_normal)
{ {
if (m_buffer_for_mono_faces.is_a_face_started()) if (m_buffer_for_faces.is_a_face_started())
{ return m_buffer_for_mono_faces.add_point_in_face(kp, p_normal); } { return m_buffer_for_faces.add_point_in_face(kp, p_normal); }
else if (m_buffer_for_colored_faces.is_a_face_started())
{ return m_buffer_for_colored_faces.add_point_in_face(kp, p_normal); }
return false; return false;
} }
bool a_face_started() const bool a_face_started() const
{ {
return m_buffer_for_mono_faces.is_a_face_started() || return m_buffer_for_faces.is_a_face_started();
m_buffer_for_colored_faces.is_a_face_started();
} }
void face_begin() void face_begin()
@ -245,7 +257,7 @@ public:
<< std::endl; << std::endl;
} }
else else
{ m_buffer_for_mono_faces.face_begin(); } { m_buffer_for_faces.face_begin(m_default_color_face); }
} }
void face_begin(const CGAL::IO::Color &acolor) void face_begin(const CGAL::IO::Color &acolor)
@ -257,15 +269,13 @@ public:
<< std::endl; << std::endl;
} }
else else
{ m_buffer_for_colored_faces.face_begin(acolor); } { m_buffer_for_faces.face_begin(acolor); }
} }
void face_end() void face_end()
{ {
if (m_buffer_for_mono_faces.is_a_face_started()) if (m_buffer_for_faces.is_a_face_started())
{ m_buffer_for_mono_faces.face_end(); } { m_buffer_for_faces.face_end(); }
else if (m_buffer_for_colored_faces.is_a_face_started())
{ m_buffer_for_colored_faces.face_end(); }
} }
template <typename KPoint> template <typename KPoint>
@ -281,58 +291,38 @@ public:
bool empty() const bool empty() const
{ {
return (m_buffer_for_mono_points.is_empty() && return (m_buffer_for_points.is_empty() &&
m_buffer_for_colored_points.is_empty() && m_buffer_for_segments.is_empty() &&
m_buffer_for_mono_segments.is_empty() && m_buffer_for_rays.is_empty() &&
m_buffer_for_colored_segments.is_empty() && m_buffer_for_lines.is_empty() &&
m_buffer_for_mono_rays.is_empty() && m_buffer_for_faces.is_empty());
m_buffer_for_colored_rays.is_empty() &&
m_buffer_for_mono_lines.is_empty() &&
m_buffer_for_colored_lines.is_empty() &&
m_buffer_for_mono_faces.is_empty() &&
m_buffer_for_colored_faces.is_empty());
} }
bool has_zero_x() const bool has_zero_x() const
{ {
return m_buffer_for_mono_points.has_zero_x() && return m_buffer_for_points.has_zero_x() &&
m_buffer_for_colored_points.has_zero_x() && m_buffer_for_segments.has_zero_x() &&
m_buffer_for_mono_segments.has_zero_x() && m_buffer_for_faces.has_zero_x() &&
m_buffer_for_colored_segments.has_zero_x() && m_buffer_for_rays.has_zero_x() &&
m_buffer_for_mono_faces.has_zero_x() && m_buffer_for_lines.has_zero_x();
m_buffer_for_colored_faces.has_zero_x() &&
m_buffer_for_mono_rays.has_zero_x() &&
m_buffer_for_colored_rays.has_zero_x() &&
m_buffer_for_mono_lines.has_zero_x() &&
m_buffer_for_colored_lines.has_zero_x();
} }
bool has_zero_y() const bool has_zero_y() const
{ {
return m_buffer_for_mono_points.has_zero_y() && return m_buffer_for_points.has_zero_y() &&
m_buffer_for_colored_points.has_zero_y() && m_buffer_for_segments.has_zero_y() &&
m_buffer_for_mono_segments.has_zero_y() && m_buffer_for_faces.has_zero_y() &&
m_buffer_for_colored_segments.has_zero_y() && m_buffer_for_rays.has_zero_y() &&
m_buffer_for_mono_faces.has_zero_y() && m_buffer_for_lines.has_zero_y();
m_buffer_for_colored_faces.has_zero_y() &&
m_buffer_for_mono_rays.has_zero_y() &&
m_buffer_for_colored_rays.has_zero_y() &&
m_buffer_for_mono_lines.has_zero_y() &&
m_buffer_for_colored_lines.has_zero_y();
} }
bool has_zero_z() const bool has_zero_z() const
{ {
return m_buffer_for_mono_points.has_zero_z() && return m_buffer_for_points.has_zero_z() &&
m_buffer_for_colored_points.has_zero_z() && m_buffer_for_segments.has_zero_z() &&
m_buffer_for_mono_segments.has_zero_z() && m_buffer_for_faces.has_zero_z() &&
m_buffer_for_colored_segments.has_zero_z() && m_buffer_for_rays.has_zero_z() &&
m_buffer_for_mono_faces.has_zero_z() && m_buffer_for_lines.has_zero_z();
m_buffer_for_colored_faces.has_zero_z() &&
m_buffer_for_mono_rays.has_zero_z() &&
m_buffer_for_colored_rays.has_zero_z() &&
m_buffer_for_mono_lines.has_zero_z() &&
m_buffer_for_colored_lines.has_zero_z();
} }
// Returns true if the data structure lies on a XY or XZ or YZ plane // Returns true if the data structure lies on a XY or XZ or YZ plane
@ -343,16 +333,11 @@ public:
void clear() void clear()
{ {
m_buffer_for_mono_points.clear(); m_buffer_for_points.clear();
m_buffer_for_colored_points.clear(); m_buffer_for_segments.clear();
m_buffer_for_mono_segments.clear(); m_buffer_for_rays.clear();
m_buffer_for_colored_segments.clear(); m_buffer_for_lines.clear();
m_buffer_for_mono_rays.clear(); m_buffer_for_faces.clear();
m_buffer_for_colored_rays.clear();
m_buffer_for_mono_lines.clear();
m_buffer_for_colored_lines.clear();
m_buffer_for_mono_faces.clear();
m_buffer_for_colored_faces.clear();
m_texts.clear(); m_texts.clear();
m_bounding_box=CGAL::Bbox_3(); m_bounding_box=CGAL::Bbox_3();
} }
@ -385,16 +370,11 @@ public:
// vectors. // vectors.
enum Buffers { enum Buffers {
BEGIN_POS = 0, BEGIN_POS = 0,
POS_MONO_POINTS = BEGIN_POS, POS_POINTS = BEGIN_POS,
POS_COLORED_POINTS, POS_SEGMENTS,
POS_MONO_SEGMENTS, POS_RAYS,
POS_COLORED_SEGMENTS, POS_LINES,
POS_MONO_RAYS, POS_FACES,
POS_COLORED_RAYS,
POS_MONO_LINES,
POS_COLORED_LINES,
POS_MONO_FACES,
POS_COLORED_FACES,
END_POS, END_POS,
BEGIN_COLOR = END_POS, BEGIN_COLOR = END_POS,
COLOR_POINTS = BEGIN_COLOR, COLOR_POINTS = BEGIN_COLOR,
@ -404,25 +384,24 @@ public:
COLOR_FACES, COLOR_FACES,
END_COLOR, END_COLOR,
BEGIN_NORMAL = END_COLOR, BEGIN_NORMAL = END_COLOR,
SMOOTH_NORMAL_MONO_FACES = BEGIN_NORMAL, SMOOTH_NORMAL_FACES = BEGIN_NORMAL,
FLAT_NORMAL_MONO_FACES, FLAT_NORMAL_FACES,
SMOOTH_NORMAL_COLORED_FACES,
FLAT_NORMAL_COLORED_FACES,
END_NORMAL, END_NORMAL,
LAST_INDEX = END_NORMAL LAST_INDEX = END_NORMAL
}; };
protected: protected:
Buffer_for_vao m_buffer_for_mono_points; Buffer_for_vao m_buffer_for_points;
Buffer_for_vao m_buffer_for_colored_points; Buffer_for_vao m_buffer_for_segments;
Buffer_for_vao m_buffer_for_mono_segments; Buffer_for_vao m_buffer_for_rays;
Buffer_for_vao m_buffer_for_colored_segments; Buffer_for_vao m_buffer_for_lines;
Buffer_for_vao m_buffer_for_mono_rays; Buffer_for_vao m_buffer_for_faces;
Buffer_for_vao m_buffer_for_colored_rays;
Buffer_for_vao m_buffer_for_mono_lines; CGAL::IO::Color m_default_color_face;
Buffer_for_vao m_buffer_for_colored_lines; CGAL::IO::Color m_default_color_point;
Buffer_for_vao m_buffer_for_mono_faces; CGAL::IO::Color m_default_color_segment;
Buffer_for_vao m_buffer_for_colored_faces; CGAL::IO::Color m_default_color_ray;
CGAL::IO::Color m_default_color_line;
std::vector<std::tuple<Local_point, std::string>> m_texts; std::vector<std::tuple<Local_point, std::string>> m_texts;

File diff suppressed because it is too large Load Diff

View File

@ -116,7 +116,7 @@ In our context, a polygon must uphold the following conditions:
<OL> <OL>
<LI><I>Closed Boundary</I> - the polygon's outer boundary must be a connected sequence of curves, that start and end at the same vertex. <LI><I>Closed Boundary</I> - the polygon's outer boundary must be a connected sequence of curves, that start and end at the same vertex.
<LI><I>Simplicity</I> - the polygon must be simple. <LI><I>Simplicity</I> - the polygon must be simple.
<LI><I>Orientation</I> - the polygon's outer boundary must be <I>counter-clockwise oriented</I>. <LI><I>Orientation</I> - the polygon's outer boundary must be <I>counterclockwise oriented</I>.
</OL> </OL>
\subsection bso_ssecpolygon_with_holes_validation Conditions for Valid Polygons with Holes \subsection bso_ssecpolygon_with_holes_validation Conditions for Valid Polygons with Holes

View File

@ -1,4 +1,4 @@
/// \defgroup PkgBooleanSetOperations2Ref 2D Regularized Boolean Set-Operations Reference /// \defgroup PkgBooleanSetOperations2Ref Reference Manual
/// \defgroup PkgBooleanSetOperations2Concepts Concepts /// \defgroup PkgBooleanSetOperations2Concepts Concepts
/// \ingroup PkgBooleanSetOperations2Ref /// \ingroup PkgBooleanSetOperations2Ref

View File

@ -52,7 +52,7 @@ public:
return (ic % 2) == 1; return (ic % 2) == 1;
} }
//! after_scan post-processing after bfs scan. //! after_scan postprocessing after bfs scan.
/*! The function fixes some of the curves, to be in the same direction as the /*! The function fixes some of the curves, to be in the same direction as the
half-edges. half-edges.

View File

@ -540,7 +540,7 @@ template <class Traits_, class TopTraits_, class ValidationPolicy>
} }
//insert non-sipmle poloygons with holes (non incident edges may have //insert non-sipmle poloygons with holes (non incident edges may have
// common vertex, but they dont intersect at their interior // common vertex, but they don't intersect at their interior
template <class Traits_, class TopTraits_, class ValidationPolicy> template <class Traits_, class TopTraits_, class ValidationPolicy>
void Gps_on_surface_base_2<Traits_, TopTraits_, ValidationPolicy>:: void Gps_on_surface_base_2<Traits_, TopTraits_, ValidationPolicy>::
_insert(const Polygon_with_holes_2 & pgn, Arrangement_on_surface_2 & arr) _insert(const Polygon_with_holes_2 & pgn, Arrangement_on_surface_2 & arr)

View File

@ -407,7 +407,7 @@ is_crossover_outer_boundary(const typename Traits_2::Polygon_with_holes_2& pgn,
Vertex_const_handle cver; Vertex_const_handle cver;
Point_2 second_point; Point_2 second_point;
if (cmp_endpoints(*next) == SMALLER) { if (cmp_endpoints(*next) == SMALLER) {
// next curve's minimum is the joint vertex. Look if it's max exists in // next curve's minimum is the joint vertex. Look if its max exists in
// the arrangement and insert lexicographically // the arrangement and insert lexicographically
second_point = max_functor(*next); second_point = max_functor(*next);
obj = pl.locate(second_point); obj = pl.locate(second_point);
@ -622,7 +622,7 @@ bool are_holes_and_boundary_pairwise_disjoint
Topology_traits; Topology_traits;
typedef CGAL::Gps_on_surface_base_2<Traits_2, Topology_traits> typedef CGAL::Gps_on_surface_base_2<Traits_2, Topology_traits>
Polygon_set_2; Polygon_set_2;
typedef typename Polygon_set_2::Size Size; // typedef typename Polygon_set_2::Size Size;
typedef typename Traits_2::Polygon_2 Polygon_2; typedef typename Traits_2::Polygon_2 Polygon_2;
typedef typename Traits_2::Polygon_with_holes_2 Polygon_with_holes_2; typedef typename Traits_2::Polygon_with_holes_2 Polygon_with_holes_2;
typedef typename Polygon_with_holes_2::Hole_const_iterator typedef typename Polygon_with_holes_2::Hole_const_iterator
@ -639,8 +639,7 @@ bool are_holes_and_boundary_pairwise_disjoint
typedef typename Polygon_set_2::Arrangement_on_surface_2 typedef typename Polygon_set_2::Arrangement_on_surface_2
Arrangement_2; Arrangement_2;
/* Should be perfored more efficeintly than using sweep and than /* Should be perfored more efficiently than using sweep and then difference().
* difference().
* *
* Use sweep to find intersections on the interior of curves (not on vertices) * Use sweep to find intersections on the interior of curves (not on vertices)
* and overlapping edges which are not allowed (note that 0/1 dimension * and overlapping edges which are not allowed (note that 0/1 dimension
@ -677,7 +676,7 @@ bool are_holes_and_boundary_pairwise_disjoint
Polygon_set_2 gps(traits); Polygon_set_2 gps(traits);
// check for 2D intersections of holes (holes must be disjoint except for // check for 2D intersections of holes (holes must be disjoint except for
// vertices) // vertices)
Size num_of_holes = 0; // Size num_of_holes = 0;
// functors for creating a pwh needed for inserting pgns into the arrangement // functors for creating a pwh needed for inserting pgns into the arrangement
// quickly // quickly
Construct_polygon_with_holes_2 construct_pwh_functor = Construct_polygon_with_holes_2 construct_pwh_functor =
@ -701,7 +700,7 @@ bool are_holes_and_boundary_pairwise_disjoint
// traits.Construct_polygon_with_holes_2 (hole); // traits.Construct_polygon_with_holes_2 (hole);
// Polygon_with_holes_2 empty_pwh(hole); // Polygon_with_holes_2 empty_pwh(hole);
gps.insert(empty_pwh); gps.insert(empty_pwh);
num_of_holes++; // num_of_holes++;
} }
} }
/* not good - doesn't work if intersection at vertices is legal. /* not good - doesn't work if intersection at vertices is legal.
@ -758,7 +757,7 @@ bool are_holes_and_boundary_pairwise_disjoint
/* A valid polygon with holes is : /* A valid polygon with holes is :
* 1 - Has empty or closed boundary and all the holes are closed * 1 - Has empty or closed boundary and all the holes are closed
* 2 - The PWH is relatively simple polygon (holes are simple...) * 2 - The PWH is relatively simple polygon (holes are simple...)
* 3 - Has it's boundary oriented counterclockwise and the holes oriented * 3 - Has its boundary oriented counterclockwise and the holes oriented
* clockwise * clockwise
* 4 - All the segments (boundary and holes) do not cross or intersect in their * 4 - All the segments (boundary and holes) do not cross or intersect in their
* relative interior * relative interior

View File

@ -19,10 +19,10 @@
#include <CGAL/license/Boolean_set_operations_2.h> #include <CGAL/license/Boolean_set_operations_2.h>
#include <CGAL/Qt/Basic_viewer.h>
#include <CGAL/Graphics_scene.h> #include <CGAL/Graphics_scene.h>
#include <CGAL/Graphics_scene_options.h> #include <CGAL/Graphics_scene_options.h>
#include <CGAL/Polygon_set_2.h> #include <CGAL/Polygon_set_2.h>
#include <CGAL/Basic_viewer.h>
namespace CGAL { namespace CGAL {
@ -166,7 +166,7 @@ void compute_elements(const PWH& pwh,
} // End namespace draw_function_for_boolean_set_2 } // End namespace draw_function_for_boolean_set_2
#ifdef CGAL_USE_BASIC_VIEWER #if defined(CGAL_USE_BASIC_VIEWER)
template <typename PolygonSet_2, typename GSOptions> template <typename PolygonSet_2, typename GSOptions>
class Polygon_set_2_basic_viewer_qt : public Basic_viewer class Polygon_set_2_basic_viewer_qt : public Basic_viewer
@ -196,6 +196,8 @@ public:
CGAL::qglviewer::Vec maxv(bbox.xmax(), bbox.ymax(), 0); CGAL::qglviewer::Vec maxv(bbox.xmax(), bbox.ymax(), 0);
auto diameter = (maxv - minv).norm(); auto diameter = (maxv - minv).norm();
m_pixel_ratio = diameter / gso.height(); m_pixel_ratio = diameter / gso.height();
add_elements();
} }
/*! Intercept the resizing of the window. /*! Intercept the resizing of the window.
@ -281,13 +283,16 @@ void add_to_graphics_scene(const CGAL_PS2_TYPE& ap2,
draw_function_for_boolean_set_2::compute_elements(ap2, graphics_scene, gso); draw_function_for_boolean_set_2::compute_elements(ap2, graphics_scene, gso);
} }
#ifdef CGAL_USE_BASIC_VIEWER
// Specialization of draw function. // Specialization of draw function.
template<class T, class C, class D, class GSOptions> template<class T, class C, class D, class GSOptions>
void draw(const CGAL_PS2_TYPE& ps, GSOptions& gso, void draw(const CGAL_PS2_TYPE& ps, GSOptions& gso,
const char* title = "Polygon_set_2 Basic Viewer") const char* title = "Polygon_set_2 Basic Viewer")
{ {
CGAL_USE(ps);
CGAL_USE(gso);
CGAL_USE(title);
#ifdef CGAL_USE_BASIC_VIEWER
#if defined(CGAL_TEST_SUITE) #if defined(CGAL_TEST_SUITE)
bool cgal_test_suite = true; bool cgal_test_suite = true;
#else #else
@ -306,6 +311,7 @@ void draw(const CGAL_PS2_TYPE& ps, GSOptions& gso,
basic_viewer.show(); basic_viewer.show();
app.exec(); app.exec();
} }
#endif // CGAL_USE_BASIC_VIEWER
} }
template<class T, class C, class D> template<class T, class C, class D>
@ -319,7 +325,6 @@ void draw(const CGAL_PS2_TYPE& ps,
draw(ps, gso, title); draw(ps, gso, title);
} }
#endif // CGAL_USE_BASIC_VIEWER
#undef CGAL_PS2_TYPE #undef CGAL_PS2_TYPE

View File

@ -227,7 +227,7 @@ int main(int argc, char *argv[])
write_complement_to_file(out, p1); write_complement_to_file(out, p1);
write_complement_to_file(out, p2); write_complement_to_file(out, p2);
std::cout<<argv[3] << std::cout<<argv[3] <<
" was generated successfully, dont forget to add it to test_bop.cmd" " was generated successfully, don't forget to add it to test_bop.cmd"
<< std::endl; << std::endl;
return (0); return (0);
@ -239,7 +239,7 @@ int main(int argc, char *argv[])
write_complement_to_file(out, p1); write_complement_to_file(out, p1);
write_complement_to_file(out, pwh2); write_complement_to_file(out, pwh2);
std::cout<<argv[3] << std::cout<<argv[3] <<
" was generated successfully, dont forget to add it to test_bop.cmd" " was generated successfully, don't forget to add it to test_bop.cmd"
<< std::endl; << std::endl;
return (0); return (0);
@ -251,7 +251,7 @@ int main(int argc, char *argv[])
write_complement_to_file(out, pwh1); write_complement_to_file(out, pwh1);
write_complement_to_file(out, p2); write_complement_to_file(out, p2);
std::cout<<argv[3] << std::cout<<argv[3] <<
" was generated successfully, dont forget to add it to test_bop.cmd" " was generated successfully, don't forget to add it to test_bop.cmd"
<< std::endl; << std::endl;
return (0); return (0);
@ -263,7 +263,7 @@ int main(int argc, char *argv[])
write_complement_to_file(out, pwh1); write_complement_to_file(out, pwh1);
write_complement_to_file(out, pwh2); write_complement_to_file(out, pwh2);
std::cout<<argv[3] << std::cout<<argv[3] <<
" was generated successfully, dont forget to add it to test_bop.cmd" " was generated successfully, don't forget to add it to test_bop.cmd"
<< std::endl; << std::endl;
return (0); return (0);

View File

@ -5,7 +5,7 @@ namespace CGAL {
\ingroup PkgBoundingVolumesRef \ingroup PkgBoundingVolumesRef
An object of the class `Min_ellipse_2` is the unique ellipse of smallest area An object of the class `Min_ellipse_2` is the unique ellipse of smallest area
enclosing a finite (multi)set of points in two-dimensional euclidean enclosing a finite (multi)set of points in two-dimensional Euclidean
space \f$ \E^2\f$. For a point set \f$ P\f$ we denote by \f$ me(P)\f$ the smallest space \f$ \E^2\f$. For a point set \f$ P\f$ we denote by \f$ me(P)\f$ the smallest
ellipse that contains all points of \f$ P\f$. Note that \f$ me(P)\f$ can be ellipse that contains all points of \f$ P\f$. Note that \f$ me(P)\f$ can be
degenerate, degenerate,

View File

@ -16,7 +16,6 @@ optimization algorithms using the two-dimensional \cgal kernel.
\sa `CGAL::Min_annulus_d<Traits>` \sa `CGAL::Min_annulus_d<Traits>`
\sa `CGAL::Min_sphere_annulus_d_traits_3<K,ET,NT>` \sa `CGAL::Min_sphere_annulus_d_traits_3<K,ET,NT>`
\sa `CGAL::Min_sphere_annulus_d_traits_d<K,ET,NT>` \sa `CGAL::Min_sphere_annulus_d_traits_d<K,ET,NT>`
\sa `MinSphereAnnulusDTraits`
*/ */
template< typename K, typename ET, typename NT > template< typename K, typename ET, typename NT >

Some files were not shown because too many files have changed in this diff Show More