mirror of https://github.com/CGAL/cgal
Merge branch 'main' into gsoc2021-Barycentric_coordinates_3-antoniospg
This commit is contained in:
commit
07fe32849e
|
|
@ -16,7 +16,7 @@
|
|||
*.py text
|
||||
*.xml text
|
||||
*.js text
|
||||
*.hmtl text
|
||||
*.html text
|
||||
*.bib text
|
||||
*.css text
|
||||
*.ui text
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ permissions:
|
|||
|
||||
jobs:
|
||||
pre_build_checks:
|
||||
if: ${{ inputs.pr_number || startsWith(github.event.comment.body, '/build:') || startsWith(github.event.comment.body, '/force-build:') }}
|
||||
runs-on: ubuntu-latest
|
||||
name: Trigger the build?
|
||||
outputs:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
build
|
||||
/*build*
|
||||
/*/*/*/build
|
||||
/*/*/*/VC*
|
||||
|
|
@ -1147,3 +1148,27 @@ Polygonal_surface_reconstruction/examples/build*
|
|||
Polygonal_surface_reconstruction/test/build*
|
||||
Solver_interface/examples/build*
|
||||
/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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgAABBTreeRef AABB Tree Reference
|
||||
/// \defgroup PkgAABBTreeRef Reference Manual
|
||||
|
||||
/// \defgroup PkgAABBTreeConcepts Concepts
|
||||
/// \ingroup PkgAABBTreeRef
|
||||
|
|
|
|||
|
|
@ -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
|
||||
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,
|
||||
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.
|
||||
|
||||
\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"
|
||||
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
|
||||
triangles are stored into a single array so as to form a triangle
|
||||
soup. The primitive internally uses a `boost::iterator_adaptor` so as
|
||||
to provide the three functions `AABBPrimitive::id()`, `AABBPrimitive::datum()`,
|
||||
triangles are stored into a single array as to form a triangle
|
||||
soup. The primitive internally uses a `boost::iterator_adaptor`
|
||||
as to provide the three functions `AABBPrimitive::id()`, `AABBPrimitive::datum()`,
|
||||
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
|
||||
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
|
||||
second for a variety of intersection and distance queries. The machine
|
||||
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
|
||||
program has been compiled with Visual C++ 2005 compiler with the O2
|
||||
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
|
||||
point per primitive (the default mode when calling the function
|
||||
`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
|
||||
internally. When explicitly storing a 3D triangle in the primitive the
|
||||
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
|
||||
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
|
||||
to use with satisfactory performances. While the tree construction
|
||||
times and memory occupancy do not fluctuate much in our experiments
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ void triangle_mesh(std::string fname)
|
|||
typedef CGAL::AABB_tree<Traits> Tree;
|
||||
|
||||
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;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -395,15 +395,15 @@ public:
|
|||
public:
|
||||
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()
|
||||
(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::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()
|
||||
(p, GeomTraits().compute_squared_distance_2_object()(p, bound)), bb)?
|
||||
CGAL::SMALLER : CGAL::LARGER;
|
||||
|
|
@ -433,6 +433,45 @@ public:
|
|||
CGAL::SMALLER :
|
||||
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);}
|
||||
|
|
|
|||
|
|
@ -302,12 +302,11 @@ public:
|
|||
typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
|
||||
ConstPrimitiveIterator beyond) const
|
||||
{
|
||||
typename AT::Bounding_box bbox = m_traits.compute_bbox(*first,m_traits.bbm);
|
||||
for(++first; first != beyond; ++first)
|
||||
{
|
||||
bbox = bbox + m_traits.compute_bbox(*first,m_traits.bbm);
|
||||
}
|
||||
return bbox;
|
||||
return std::accumulate(first, beyond,
|
||||
typename AT::Bounding_box{} /* empty bbox */,
|
||||
[this](const typename AT::Bounding_box& bbox, const Primitive& pr) {
|
||||
return bbox + m_traits.compute_bbox(pr, m_traits.bbm);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -199,9 +199,7 @@ namespace CGAL {
|
|||
}
|
||||
|
||||
/// returns the axis-aligned bounding box of the whole tree.
|
||||
/// \pre `!empty()`
|
||||
const Bounding_box bbox() const {
|
||||
CGAL_precondition(!empty());
|
||||
if(size() > 1)
|
||||
return root_node()->bbox();
|
||||
else
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ We describe next the algorithm and provide examples.
|
|||
|
||||
\note A \ref tuto_reconstruction "detailed tutorial on surface reconstruction"
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgAdvancingFrontSurfaceReconstructionRef Advancing Front Surface Reconstruction Reference
|
||||
/// \defgroup PkgAdvancingFrontSurfaceReconstructionRef Reference Manual
|
||||
|
||||
/// \defgroup PkgAdvancingFrontSurfaceReconstructionRefConcepts Concepts
|
||||
/// \ingroup PkgAdvancingFrontSurfaceReconstructionRef
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ namespace CGAL {
|
|||
int _facet_number;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// For post-processing
|
||||
// For postprocessing
|
||||
mutable int _postprocessing_counter;
|
||||
int _size_before_postprocessing;
|
||||
|
||||
|
|
@ -2432,7 +2432,7 @@ namespace CGAL {
|
|||
|
||||
std::size_t itmp, L_v_size_mem;
|
||||
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))
|
||||
{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ As a consequence types representing polynomials, algebraic extensions and
|
|||
finite fields play a more important role in related implementations.
|
||||
This package has been introduced to stay abreast of these changes.
|
||||
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
|
||||
the real axis, or <I>real embeddable</I> for short.
|
||||
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
|
||||
corresponds to integral domains in the algebraic sense, the
|
||||
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.
|
||||
Note that `Field` refines `IntegralDomain`. This is because
|
||||
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
|
||||
refinement of one of the more advanced ring concepts.
|
||||
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
|
||||
accessible through global functions defined within namespace `CGAL`,
|
||||
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
|
||||
Section \ref PkgAlgebraicFoundationsRef in the reference manual.
|
||||
the according functor of the traits class. For an overview see the section "Global Functions" in the
|
||||
\ref PkgAlgebraicFoundationsRef.
|
||||
|
||||
\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>`
|
||||
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.,
|
||||
`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`
|
||||
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
|
||||
arithmetic. We expect that `Is_numerical_sensitive` is used for dispatching
|
||||
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.
|
||||
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
|
||||
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.
|
||||
All these properties are gathered in the concept `::RealEmbeddable`.
|
||||
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.
|
||||
This level of interoperability is reflected by the concept
|
||||
`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`
|
||||
giving access to the coercion type via \link Coercion_traits::Type `Coercion_traits<A,B>::Type` \endlink
|
||||
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`.
|
||||
However, the coercion type is not necessarily one of the input types,
|
||||
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
|
||||
by the experience with the number type support in \exacus \cgalCite{beh-eeeafcs-05},
|
||||
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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgAlgebraicFoundationsRef Algebraic Foundations Reference
|
||||
/// \defgroup PkgAlgebraicFoundationsRef Reference Manual
|
||||
|
||||
/// \defgroup PkgAlgebraicFoundationsAlgebraicStructuresConcepts Concepts
|
||||
/// \ingroup PkgAlgebraicFoundationsRef
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ polynomial is not computed yet.
|
|||
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.
|
||||
Hence, the design does
|
||||
not allow a direct access to any, seemingly obvious, members of an
|
||||
`AlgebraicKernel_d_1::Algebraic_real_1`. Instead there is, e.g.,
|
||||
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::Compute_polynomial_1` which emphasizes
|
||||
that the requested polynomial may not be computed yet. Similarly,
|
||||
there is no way to directly ask for the refinement of the current
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgAlgebraicKernelDRef Algebraic Kernel Reference
|
||||
/// \defgroup PkgAlgebraicKernelDRef Reference Manual
|
||||
|
||||
/// \defgroup PkgAlgebraicKernelDConcepts Concepts
|
||||
/// \ingroup PkgAlgebraicKernelDRef
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
: 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()) ||
|
||||
// (r1.gamma() == r2.gamma()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
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
|
||||
ice-cream except the chocolate points themselves. Thus we already see
|
||||
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
|
||||
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$
|
||||
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 its generalization, the regular triangulation
|
||||
(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
|
||||
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,
|
||||
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.
|
||||
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.
|
||||
|
||||
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
|
||||
covering if possible. Note that a periodic triangulation in 9-sheeted
|
||||
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.
|
||||
|
||||
\cgalExample{Alpha_shapes_2/ex_periodic_alpha_shapes_2.cpp}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgAlphaShapes2Ref 2D Alpha Shapes Reference
|
||||
/// \defgroup PkgAlphaShapes2Ref Reference Manual
|
||||
/// \defgroup PkgAlphaShapes2Concepts Concepts
|
||||
/// \ingroup PkgAlphaShapes2Ref
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
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
|
||||
ice-cream except the chocolate points themselves. Thus we already see
|
||||
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
|
||||
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$
|
||||
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 its generalization, the regular triangulation
|
||||
(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.
|
||||
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).
|
||||
|
||||
\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
|
||||
|
||||
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$.
|
||||
For a given value of \f$ \alpha\f$,
|
||||
the weighted alpha complex is formed with the simplices of the
|
||||
regular triangulation triangulation
|
||||
such that there is a sphere orthogonal to the weighted points associated
|
||||
regular triangulation such that there is a sphere
|
||||
orthogonal to the weighted points associated
|
||||
with the vertices of the simplex and suborthogonal to all the other
|
||||
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.
|
||||
|
||||
\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`)
|
||||
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.
|
||||
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.
|
||||
|
||||
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
|
||||
covering if possible. Note that a periodic triangulation in 27-sheeted
|
||||
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.
|
||||
|
||||
\cgalExample{Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgAlphaShapes3Ref 3D Alpha Shapes Reference
|
||||
/// \defgroup PkgAlphaShapes3Ref Reference Manual
|
||||
/// \defgroup PkgAlphaShapes3Concepts Concepts
|
||||
/// \ingroup PkgAlphaShapes3Ref
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -134,13 +134,13 @@ def main(argv):
|
|||
avg_diff_str = str(format(abs(avg_diff_to_goal), '.2f'))
|
||||
if key == "Mean_Min_Angle_(degree)" or key == "Mean_Max_Angle_(degree)":
|
||||
if avg_diff_to_goal < 0 :
|
||||
title += "\nIn average we loose "
|
||||
title += "\nIn average we lose "
|
||||
else :
|
||||
title += "\nIn average we gain "
|
||||
title += avg_diff_str + "° toward 60°"
|
||||
elif key == "Mean_Radius_Ratio" or key == "Mean_Edge_Ratio" or key == "Mean_Aspect_Ratio" :
|
||||
if avg_diff_to_goal < 0 :
|
||||
title += "\nIn average we loose "
|
||||
title += "\nIn average we lose "
|
||||
else :
|
||||
title += "\nIn average we gain "
|
||||
title += avg_diff_str + " of ratio toward 1"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgAlphaWrap3Ref 3D Alpha Wrapping
|
||||
/// \defgroup PkgAlphaWrap3Ref Reference Manual
|
||||
|
||||
/// \defgroup AW3_free_functions_grp Free Functions
|
||||
/// Functions to create a wrap from point clouds, triangle soups, and triangle meshes.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
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.
|
||||
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.
|
||||
|
||||
\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 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.
|
||||
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
|
||||
|
||||
\cgalFigureAnchor{7}
|
||||
|
|
@ -346,15 +346,15 @@ The charts below plots the computation times of the wrapping algorithm on the Th
|
|||
\cgalFigureCaptionBegin{9}
|
||||
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.
|
||||
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 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 color and diameter of the dots represent the number of faces in the input triangle soup,
|
||||
ranging from 10 (green) to 3154000 (blue).
|
||||
\cgalFigureCaptionEnd
|
||||
|
||||
\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).
|
||||
|
||||
\cgalExample{Alpha_wrap_3/triangle_mesh_wrap.cpp}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,9 @@ int main(int argc, char** argv)
|
|||
// edge length of regular tetrahedron with circumradius alpha
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ public:
|
|||
|
||||
#ifdef CGAL_AW3_TIMER
|
||||
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.start();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,12 +17,11 @@ concept `ApolloniusSite_2`.
|
|||
|
||||
\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.
|
||||
|
||||
\sa `CGAL::Qt_widget`
|
||||
\sa `CGAL::Apollonius_graph_traits_2<K,Method_tag>`
|
||||
\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
|
||||
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`.
|
||||
\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
|
||||
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`.
|
||||
\relates Apollonius_site_2
|
||||
*/
|
||||
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 */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgApolloniusGraph2Ref 2D Apollonius Graphs (Delaunay Graphs of Disks) Reference
|
||||
/// \defgroup PkgApolloniusGraph2Ref Reference Manual
|
||||
/// \defgroup PkgApolloniusGraph2Concepts Concepts
|
||||
/// \ingroup PkgApolloniusGraph2Ref
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ private:
|
|||
|
||||
public:
|
||||
typedef Voronoi_radius_2<K> Voronoi_radius;
|
||||
typedef typename K::Bounded_side Bounded_dide;
|
||||
typedef typename K::Bounded_side Bounded_side;
|
||||
|
||||
public:
|
||||
template<class Tag>
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ struct Parabola_segment_2 : public Parabola_2< Gt >
|
|||
}
|
||||
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@
|
|||
or at least issues warnings about returning a reference to temporary
|
||||
variable. Can you prompt the INRIA people to fix this?
|
||||
(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 ...)
|
||||
- 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
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ protected: // methods
|
|||
// Assumes that clippingRect is valid.
|
||||
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 );
|
||||
|
||||
protected: // members
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ Kml::Nodes Kml::generate_ids_approx(Placemarks& placemarks, const double eps) {
|
|||
|
||||
for (const auto& node : lring->nodes) {
|
||||
// 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) {
|
||||
const auto dist = node.distance_to(nodes[i]);
|
||||
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
|
||||
nodes.push_back(node);
|
||||
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
|
||||
double min_dist = std::numeric_limits<double>::max();
|
||||
double min_dist = (std::numeric_limits<double>::max)();
|
||||
std::size_t ni1 = 0;
|
||||
std::size_t ni2 = 0;
|
||||
std::size_t num_nodes = nodes.size();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
line segments), and (iii) handles overlaps. (Observe that the original
|
||||
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
|
||||
foundation of a family of concrete operations described in the rest of
|
||||
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`.
|
||||
\cgalFootnote{They also model the refined concept
|
||||
\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
|
||||
instance `Arr_non_caching_segment_basic_traits_2<Kernel>`, which
|
||||
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
|
||||
`AosLandmarkTraits_2` concept. It also models the refined
|
||||
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,
|
||||
so it is impossible to use the landmark point-location strategy with
|
||||
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
|
||||
`AosLandmarkTraits_2` concept). It also models the refined
|
||||
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}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ namespace CGAL {
|
|||
/*! \ingroup PkgArrangementOnSurface2Ref
|
||||
*
|
||||
* `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
|
||||
* is an instance of the template
|
||||
* `CGAL::Arrangement_on_surface_2<GeometryTraits, TopologyTraits>`.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgArrangementOnSurface2Ref 2D Arrangement Reference
|
||||
/// \defgroup PkgArrangementOnSurface2Ref Reference Manual
|
||||
|
||||
/// \defgroup PkgArrangementOnSurface2Concepts Concepts
|
||||
/// \ingroup PkgArrangementOnSurface2Ref
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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.
|
||||
*
|
||||
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
|
||||
|
|
|
|||
|
|
@ -127,7 +127,11 @@ private:
|
|||
public:
|
||||
/*! 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.
|
||||
*/
|
||||
|
|
@ -2500,7 +2504,7 @@ public:
|
|||
double min_dist = -1;
|
||||
Integer aux_coeffs[6];
|
||||
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[1] = (k == 1) ? s_1 : s_2;
|
||||
aux_rat_coeffs[2] = (k == 1) ? t_1 : t_2;
|
||||
|
|
@ -2516,7 +2520,7 @@ public:
|
|||
(CGAL::sign(aux_coeffs[2]) == ZERO)) ? 1 : 2;
|
||||
|
||||
// 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,
|
||||
base_coeffs[0], base_coeffs[1],
|
||||
base_coeffs[2],
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ bool _Bezier_cache<NtTraits>::_intersection_params
|
|||
|
||||
// Construct the bivariate polynomial that corresponds to Equation I.
|
||||
// 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.
|
||||
const int degX_2 = nt_traits.degree (polyX_2);
|
||||
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.
|
||||
// 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.
|
||||
const int degX = nt_traits.degree (polyX);
|
||||
CGAL_assertion(degX > 0);
|
||||
|
|
@ -771,7 +771,7 @@ _Bezier_cache<NtTraits>::_compute_resultant
|
|||
if (nt_traits.degree (mat[i][i]) < 0)
|
||||
{
|
||||
// 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.
|
||||
|
||||
found_row = false;
|
||||
|
|
@ -786,7 +786,7 @@ _Bezier_cache<NtTraits>::_compute_resultant
|
|||
|
||||
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
|
||||
// higher should be zero by now).
|
||||
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++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
// 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
|
||||
// the exponent of mat[i][i] in the normalization factor.
|
||||
exp_fact[i] = exp_fact[i] + 1;
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ public:
|
|||
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
|
||||
* points.
|
||||
*/
|
||||
|
|
@ -681,7 +681,7 @@ void _Bezier_curve_2_rep<RatKer, AlgKer, NtTrt,
|
|||
px = pts_begin->x();
|
||||
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:
|
||||
//
|
||||
// n-k
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ public:
|
|||
int 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[1] = (k == 1) ? s_1 : s_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
|
||||
// conic and the k'th auxiliary conic.
|
||||
// conic and the k-th auxiliary conic.
|
||||
n_xs = compute_resultant_roots(nt_traits,
|
||||
base_coeffs[0], base_coeffs[1],
|
||||
base_coeffs[2],
|
||||
|
|
|
|||
|
|
@ -1078,7 +1078,7 @@ private:
|
|||
}
|
||||
|
||||
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 i The order of the derivatives (either 1, 2 or 3).
|
||||
* \param slope_numer The numerator of the slope.
|
||||
|
|
@ -1187,7 +1187,7 @@ public:
|
|||
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 i The order of the derivatives (either 1, 2 or 3).
|
||||
* \param slope_numer The numerator of the slope.
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ bisect_control_polygon_2(InputIterator ctrl_pts_begin,
|
|||
while (last_index > 0)
|
||||
{
|
||||
// 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)
|
||||
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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
vec[i] = _Point_2(comp_t0*vec[i].x() + t0*vec[i + 1].x(),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* GeomTraits, use a reference to GeomTraits to avoid constructing a new one.
|
||||
* 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
|
||||
* only an implicit constructor, (which takes *b as a parameter).
|
||||
|
|
|
|||
|
|
@ -1992,10 +1992,10 @@ public:
|
|||
determines according to pre defined conditions whether the
|
||||
current Trapezoidal_decomposition_2<Traits> needs update
|
||||
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
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2625,7 +2625,7 @@ protected:
|
|||
|
||||
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))) {
|
||||
// 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;
|
||||
else {
|
||||
// to_left
|
||||
|
|
@ -2642,7 +2642,7 @@ protected:
|
|||
|
||||
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))) {
|
||||
// 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;
|
||||
else {
|
||||
if (direction == SMALLER) {
|
||||
|
|
|
|||
|
|
@ -598,15 +598,15 @@ public:
|
|||
if (dir == SMALLER){
|
||||
// Check whether the split point is xcv[i]'s source or target.
|
||||
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]);
|
||||
}
|
||||
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]);
|
||||
}
|
||||
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.
|
||||
X_monotone_subcurve_2 seg1, seg2;
|
||||
m_poly_traits.subcurve_traits_2()->split_2_object()(xcv[i], p,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// 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;
|
||||
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
|
||||
// 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);
|
||||
rc2 = LARGER;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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.
|
||||
*
|
||||
* Use the form 'A a(*b);' and not ''A a = b;' to handle the case where A has
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing
|
||||
* 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
|
||||
* 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
|
||||
* GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing
|
||||
* 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
|
||||
* 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
|
||||
* GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing
|
||||
* 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
|
||||
* 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
|
||||
* GeometryTraits_2, use a reference to GeometryTraits_2 to avoid constructing
|
||||
* 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
|
||||
* only an implicit constructor, (which takes *b as a parameter).
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ public:
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
@ -603,7 +603,7 @@ public:
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,11 +197,11 @@ public:
|
|||
void init_subcurve_in_arrangement_flags(size_t n)
|
||||
{ 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
|
||||
{ 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)
|
||||
{ m_isCurveInArr[i] = flag; }
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <cstdlib>
|
||||
#include <random>
|
||||
|
||||
#include <CGAL/Qt/Basic_viewer.h>
|
||||
#include <CGAL/Basic_viewer.h>
|
||||
#include <CGAL/Graphics_scene.h>
|
||||
#include <CGAL/Graphics_scene_options.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);
|
||||
}
|
||||
|
||||
#ifdef CGAL_USE_BASIC_VIEWER
|
||||
|
||||
/// Draw an arrangement on surface.
|
||||
template <typename GeometryTraits_2, typename TopologyTraits, class GSOptions>
|
||||
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);
|
||||
}
|
||||
|
||||
#endif // CGAL_USE_BASIC_VIEWER
|
||||
|
||||
#undef CGAL_ARR_TYPE
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ template <typename InputStream_>
|
|||
bool IO_base_test<Base_geom_traits>::read_segment(InputStream_& is,
|
||||
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
|
||||
char type;
|
||||
is >> type;
|
||||
|
|
@ -600,7 +600,7 @@ template <typename InputStream_>
|
|||
bool IO_base_test<Base_geom_traits>::read_xsegment(InputStream_& is,
|
||||
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
|
||||
char type;
|
||||
is >> type;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
std::cout << argv[2]
|
||||
<< " was generated successfully"
|
||||
<< ", dont forget to add it to test_construction.cmd"
|
||||
<< ", don't forget to add it to test_construction.cmd"
|
||||
<< std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
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.
|
||||
The introduction of virtual borders modifies the elementary \bgl graph traversal
|
||||
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
|
||||
|
||||
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.
|
||||
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
|
||||
|
|
@ -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
|
||||
|
||||
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 can walk along this virtual border: starting at `h3*` and repeatedly calling `next(..,sm)`,
|
||||
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_compressed_sparse_raw_tag`
|
||||
- `CGAL::Alpha_expansion_MaxFlow_tag`, released under GPL
|
||||
license and provided by the \ref PkgSurfaceMeshSegmentationRef
|
||||
license and provided by the \ref PkgSurfaceMeshSegmentation
|
||||
package
|
||||
|
||||
All these implementations produce the exact same result but behave
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ returns one of the halfedges corresponding to `e`.
|
|||
*/
|
||||
template <typename HalfedgeGraph>
|
||||
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
|
||||
returns a halfedge with target `v`.
|
||||
|
|
|
|||
|
|
@ -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_dual_graph.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} \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgBGLRef CGAL and the Boost Graph Library Reference
|
||||
/// \defgroup PkgBGLRef Reference Manual
|
||||
|
||||
/*! \defgroup PkgBGLConcepts Concepts
|
||||
\ingroup PkgBGLRef
|
||||
|
|
@ -51,8 +51,8 @@ and adds the requirement for traversal of all vertices in a graph.
|
|||
<center>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="800">Associated Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="associated-type">Associated Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<tr>
|
||||
<th width="392">Valid Expression</th>
|
||||
<th width="392">Return Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="valid-expression">Valid Expression</th>
|
||||
<th class="return-type">Return Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`vertices(g)`</td>
|
||||
|
|
@ -92,8 +92,8 @@ and adds the requirement for traversal of all edges in a graph.
|
|||
<center>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="800">Associated Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="associated-type">Associated Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<tr>
|
||||
<th width="392">Valid Expression</th>
|
||||
<th width="392">Return Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="valid-expression">Valid Expression</th>
|
||||
<th class="return-type">Return Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`edges(g)`</td>
|
||||
|
|
@ -143,8 +143,8 @@ and adds the notion of halfedges, where each edge corresponds to two opposite ha
|
|||
<center>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="800">Associated Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="associated-type">Associated Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<tr>
|
||||
<th width="392">Valid Expression</th>
|
||||
<th width="392">Return Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="valid-expression">Valid Expression</th>
|
||||
<th class="return-type">Return Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`edge(h, g)`</td>
|
||||
|
|
@ -222,9 +222,9 @@ update the incidence information between vertices and halfedges.
|
|||
<center>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="392">Valid Expression</th>
|
||||
<th width="392">Return Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="valid-expression">Valid Expression</th>
|
||||
<th class="return-type">Return Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`add_vertex(g)`</td>
|
||||
|
|
@ -272,8 +272,8 @@ and adds the requirements for traversal of all halfedges in the graph.
|
|||
<center>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="800">Associated Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="associated-type">Associated Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<tr>
|
||||
<th width="392">Valid Expression</th>
|
||||
<th width="392">Return Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="valid-expression">Valid Expression</th>
|
||||
<th class="return-type">Return Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`halfedges(g)`</td>
|
||||
|
|
@ -315,8 +315,8 @@ face.
|
|||
<center>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="800">Associated Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="associated-type">Associated Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`boost::graph_traits<G>::%face_descriptor`</td>
|
||||
|
|
@ -326,9 +326,9 @@ face.
|
|||
|
||||
<table>
|
||||
<tr>
|
||||
<th width="392">Valid Expression</th>
|
||||
<th width="392">Return Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="valid-expression">Valid Expression</th>
|
||||
<th class="return-type">Return Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`face(h, g)`</td>
|
||||
|
|
@ -361,9 +361,9 @@ the requirement for operations to add faces and to modify face-halfedge relation
|
|||
<center>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="392">Valid Expression</th>
|
||||
<th width="392">Return Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="valid-expression">Valid Expression</th>
|
||||
<th class="return-type">Return Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`add_face(g)`</td>
|
||||
|
|
@ -401,8 +401,8 @@ the requirement for traversal of all faces in a graph.
|
|||
<center>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="800">Associated Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="associated-type">Associated Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`boost::graph_traits<G>::%face_iterator`</td>
|
||||
|
|
@ -416,9 +416,9 @@ the requirement for traversal of all faces in a graph.
|
|||
|
||||
<table>
|
||||
<tr>
|
||||
<th width="392">Valid Expression</th>
|
||||
<th width="392">Return Type</th>
|
||||
<th width="800">Description</th>
|
||||
<th class="valid-expression">Valid Expression</th>
|
||||
<th class="return-type">Return Type</th>
|
||||
<th class="description">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>`faces(g)`</td>
|
||||
|
|
@ -467,6 +467,9 @@ the requirement for traversal of all faces in a graph.
|
|||
/// \defgroup PkgBGLPartition Partitioning Operations
|
||||
/// \ingroup PkgBGLRef
|
||||
|
||||
/// \defgroup PkgBGLTraversal Graph Traversal
|
||||
/// \ingroup PkgBGLRef
|
||||
|
||||
/// \defgroup PkgBGLIOFct I/O Functions
|
||||
/// \ingroup PkgBGLRef
|
||||
|
||||
|
|
@ -506,8 +509,7 @@ the requirement for traversal of all faces in a graph.
|
|||
/// I/O Functions for the \ref IOStream3MF
|
||||
/// \ingroup PkgBGLIOFct
|
||||
|
||||
/// \defgroup PkgBGLIOFctDeprecated I/O Functions (Deprecated)
|
||||
/// \ingroup PkgBGLIOFct
|
||||
|
||||
|
||||
/*!
|
||||
\addtogroup PkgBGLPropertiesDynamic
|
||||
|
|
@ -586,6 +588,12 @@ Methods to split a mesh into subdomains, using the library
|
|||
implementation.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\addtogroup PkgBGLTraversal
|
||||
|
||||
Methods to traverse a graph, for example to find the shortest path between two vertices.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\addtogroup PkgBGLIOFct
|
||||
|
||||
|
|
@ -762,6 +770,9 @@ user might encounter.
|
|||
\cgalCRPSection{Conversion Functions}
|
||||
- `CGAL::split_graph_into_polylines()`
|
||||
|
||||
\cgalCRPSection{Graph Traversal}
|
||||
- `CGAL::dijkstra_shortest_path()`
|
||||
|
||||
\cgalCRPSection{Graph Adaptors}
|
||||
- `CGAL::Dual`
|
||||
- `CGAL::Face_filtered_graph`
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
\example BGL_surface_mesh/prim.cpp
|
||||
\example BGL_surface_mesh/gwdwg.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/surface_mesh_dual.cpp
|
||||
\example BGL_surface_mesh/connected_components.cpp
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ project(BGL_OpenMesh_Examples)
|
|||
# CGAL and its components
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
find_package(OpenMesh)
|
||||
find_package(OpenMesh QUIET)
|
||||
if(OpenMesh_FOUND)
|
||||
include(CGAL_OpenMesh_support)
|
||||
create_single_source_cgal_program("TriMesh.cpp")
|
||||
|
|
|
|||
|
|
@ -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("surface_mesh_dual.cpp")
|
||||
create_single_source_cgal_program("connected_components.cpp")
|
||||
create_single_source_cgal_program("shortest_path.cpp")
|
||||
|
||||
find_package(METIS QUIET)
|
||||
include(CGAL_METIS_support)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -247,36 +247,7 @@ bool read_OFF(const std::string& fname,
|
|||
|
||||
} // 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
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
|||
|
|
@ -529,20 +529,7 @@ bool write_VTP(const std::string& fname, const Graph& g, const CGAL_NP_CLASS& np
|
|||
|
||||
} // 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
|
||||
|
||||
|
|
|
|||
|
|
@ -111,20 +111,7 @@ bool write_WRL(const std::string& fname, const Graph& g, const CGAL_NP_CLASS& np
|
|||
|
||||
} // 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
|
||||
|
||||
|
|
|
|||
|
|
@ -509,7 +509,8 @@ class Alpha_expansion_MaxFlow_impl;
|
|||
\cgalParamNEnd
|
||||
\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>`
|
||||
must be included if users want to use this implementation.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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> > \
|
||||
: property_map<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \
|
||||
{};\
|
||||
} /* 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
|
||||
} /* boost namespace */
|
||||
|
||||
|
||||
CGAL_PM_DT_SPEC(CGAL::dynamic_vertex_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 {
|
||||
|
||||
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>
|
||||
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>
|
||||
{};
|
||||
|
||||
|
||||
} // CGAL namespace
|
||||
|
||||
#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> > \
|
||||
: property_map<CGAL_GRAPH_TRAITS_INHERITANCE_BASE_CLASS_NAME, DTAG<CGAL_XX_YATP> > \
|
||||
{};\
|
||||
} /* 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
|
||||
} /* boost namespace */
|
||||
|
||||
|
||||
CGAL_PM_DT_SPEC(CGAL::dynamic_vertex_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 {
|
||||
|
||||
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>
|
||||
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>
|
||||
{};
|
||||
|
||||
|
||||
} // CGAL namespace
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -871,7 +871,54 @@ private:
|
|||
*/
|
||||
template <typename Graph>
|
||||
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
|
||||
|
|
|
|||
|
|
@ -227,6 +227,32 @@ struct GetGeomTraits
|
|||
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:
|
||||
//
|
||||
// GetInitializedVertexIndexMap
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <CGAL/assertions.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>::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;
|
||||
std::tie(b,e) = vertices(graph);
|
||||
std::vector<vertex_descriptor> V(b,e);
|
||||
auto [b, e] = vertices(graph);
|
||||
std::vector<vertex_descriptor> V(b, e); // copy vertices, because the graph may change
|
||||
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)
|
||||
{
|
||||
typename boost::graph_traits<OrigGraph>::vertex_descriptor orig_v = graph[v];
|
||||
typename boost::graph_traits<Graph>::degree_size_type deg = degree(v, graph);
|
||||
auto orig_v = graph[v];
|
||||
auto deg = degree(v, graph);
|
||||
if (deg != 2 || is_terminal(orig_v, orig))
|
||||
{
|
||||
out_edge_iterator b, e;
|
||||
std::tie(b, e) = out_edges(v, graph);
|
||||
std::vector<edge_descriptor> out_edges_of_v(b, e);
|
||||
auto [b, e] = out_edges(v, graph);
|
||||
out_edges_of_v.assign(b, e); // same as creating a new vector from the range [b,e)
|
||||
for (unsigned int i = 1; i < out_edges_of_v.size(); ++i)
|
||||
{
|
||||
edge_descriptor e = out_edges_of_v[i];
|
||||
typename boost::graph_traits<OrigGraph>::edge_descriptor orig_e =
|
||||
graph[e];
|
||||
auto orig_e = graph[e];
|
||||
vertex_descriptor w = target(e, graph);
|
||||
remove_edge(e, graph);
|
||||
vertex_descriptor vc = add_vertex(graph);
|
||||
graph[vc] = orig_v;
|
||||
const std::pair<edge_descriptor, bool> pair = add_edge(vc, w, graph);
|
||||
graph[pair.first] = orig_e;
|
||||
vertex_descriptor vc = add_vertex(orig_v, graph);
|
||||
add_edge(vc, w, orig_e, graph);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -271,8 +265,7 @@ split_graph_into_polylines(const Graph& graph,
|
|||
V2vmap v2vmap;
|
||||
|
||||
for(Graph_vertex_descriptor v : make_range(vertices(graph))){
|
||||
vertex_descriptor vc = add_vertex(g_copy);
|
||||
g_copy[vc] = v;
|
||||
vertex_descriptor vc = add_vertex(v, g_copy);
|
||||
v2vmap[v] = vc;
|
||||
}
|
||||
|
||||
|
|
@ -281,9 +274,7 @@ split_graph_into_polylines(const Graph& graph,
|
|||
Graph_vertex_descriptor vt = target(e,graph);
|
||||
CGAL_warning_msg(vs != vt, "ignore self loops");
|
||||
if(vs != vt){
|
||||
const std::pair<edge_descriptor, bool> pair =
|
||||
add_edge(v2vmap[vs],v2vmap[vt],g_copy);
|
||||
g_copy[pair.first] = e;
|
||||
add_edge(v2vmap[vs], v2vmap[vt], e, g_copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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("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("test_deprecated_io.cpp")
|
||||
|
||||
find_package(OpenMesh QUIET)
|
||||
if(OpenMesh_FOUND)
|
||||
|
|
@ -63,13 +62,12 @@ else()
|
|||
message(STATUS "NOTICE: Tests that use OpenMesh will not be compiled.")
|
||||
endif()
|
||||
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0167 NEW)
|
||||
find_package(VTK 9.0 QUIET COMPONENTS CommonCore IOCore IOLegacy IOXML FiltersCore FiltersSources)
|
||||
if (VTK_FOUND AND VTK_LIBRARIES)
|
||||
message(STATUS "VTK ${VTK_VERSION} found ${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_link_libraries(test_deprecated_io PRIVATE ${VTK_LIBRARIES})
|
||||
target_compile_definitions(test_deprecated_io PRIVATE -DCGAL_USE_VTK -DNOMINMAX)
|
||||
else()
|
||||
message(STATUS "Tests that use VTK will not be compiled.")
|
||||
endif() #VTK_FOUND
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
|
||||
#include <CGAL/convex_hull_3.h>
|
||||
#include <CGAL/Polygon_mesh_processing/manifoldness.h>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||
|
||||
|
|
@ -75,5 +76,12 @@ int main()
|
|||
My_mesh_5 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ typedef GraphTraits::edge_descriptor edge_descriptor;
|
|||
typedef GraphTraits::out_edge_iterator out_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_target_circulator<Polyhedron> halfedge_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[])
|
||||
{
|
||||
|
||||
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_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);
|
||||
}
|
||||
|
||||
{
|
||||
face_around_face_circulator fafc(hd,P), done(fafc);
|
||||
|
||||
do {
|
||||
++fafc;
|
||||
}while(fafc != done);
|
||||
}
|
||||
|
||||
{
|
||||
halfedge_around_target_circulator havc(hd,P), done(havc);
|
||||
vertex_descriptor vd = target(hd,P);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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
|
||||
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.
|
||||
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
|
||||
Wachspress and discrete harmonic coordinates with query points outside the closure
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
namespace CGAL {
|
||||
namespace Barycentric_coordinates {
|
||||
|
||||
/*!
|
||||
\defgroup PkgBarycentricCoordinates2Ref 2D Generalized Barycentric Coordinates Reference
|
||||
\defgroup PkgBarycentricCoordinates2Ref Reference Manual
|
||||
|
||||
\defgroup PkgBarycentricCoordinates2RefConcepts Concepts
|
||||
\ingroup PkgBarycentricCoordinates2Ref
|
||||
|
|
@ -77,6 +74,3 @@ coordinates from the Package \ref PkgInterpolation2.}
|
|||
- `discrete_harmonic_coordinates_2()`
|
||||
- `boundary_coordinates_2()`
|
||||
*/
|
||||
|
||||
} /* namespace Barycentric_coordinates */
|
||||
} /* namespace CGAL */
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ Example of drawing of a point cloud and a polyhedron in a same viewer.
|
|||
\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.
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,36 @@ public:
|
|||
|
||||
/// returns `true` if the scene is in 2D, i.e., lies on the XY or XZ or YZ plane.
|
||||
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
|
||||
|
|
|
|||
|
|
@ -12,119 +12,180 @@ CGAL::QGLViewer is our internal fork of <a href="https://github.com/GillesDebunn
|
|||
class Basic_viewer : public CGAL::QGLViewer
|
||||
{
|
||||
public:
|
||||
/// \name Constructors
|
||||
/// @{
|
||||
|
||||
/// Constructor given a pointer on a `QWidget` (can be a `nullptr`) and a `Graphics_scene`.
|
||||
/// `title` will be the title of the window.
|
||||
Basic_viewer(QWidget* parent,
|
||||
const Graphics_scene& scene,
|
||||
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);
|
||||
|
||||
/// 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);
|
||||
|
||||
/// 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);
|
||||
|
||||
/// 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);
|
||||
|
||||
/// 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);
|
||||
|
||||
/// 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.
|
||||
/// \brief enables or disables the drawing of texts.
|
||||
/// \param b Set to `true` to enable, `false` to disable.
|
||||
void draw_text(bool b);
|
||||
|
||||
/// sets the color used for vertices in mono color mode.
|
||||
void vertices_mono_color(const CGAL::IO::Color& c);
|
||||
/// \brief Enables or disables the drawing of mesh triangles.
|
||||
/// \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.
|
||||
void edges_mono_color(const CGAL::IO::Color& c);
|
||||
/// \brief Enables or disables the use of only one color or the use of multiple colors.
|
||||
/// \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.
|
||||
void rays_mono_color(const CGAL::IO::Color& c);
|
||||
/// \brief Enables or disables the use of a single color for all normals.
|
||||
/// \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.
|
||||
void lines_mono_color(const CGAL::IO::Color& c);
|
||||
/// \brief enables or disables the use of flat shading or the use of smooth shading.
|
||||
/// \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.
|
||||
void faces_mono_color(const CGAL::IO::Color& c);
|
||||
/// \brief Enables or disables the reversal of normals.
|
||||
/// \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();
|
||||
|
||||
/// toggles the drawing of edges.
|
||||
/// \brief Toggles the drawing of edges.
|
||||
void toggle_draw_edges();
|
||||
|
||||
/// toggles the drawing of rays.
|
||||
/// \brief Toggles the drawing of rays.
|
||||
void toggle_draw_rays();
|
||||
|
||||
/// toggles the drawing of lines.
|
||||
/// \brief Toggles the drawing of lines.
|
||||
void toggle_draw_lines();
|
||||
|
||||
/// toggles the drawing of faces.
|
||||
/// \brief Toggles the drawing of faces.
|
||||
void toggle_draw_faces();
|
||||
|
||||
/// toggles the use of mono color mode.
|
||||
void toggle_use_mono_color();
|
||||
/// \brief Toggles the use of mono color mode.
|
||||
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();
|
||||
|
||||
/// 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;
|
||||
|
||||
/// returns `true` if edges are drawn.
|
||||
/// \brief Checks if edges are drawn.
|
||||
/// \return `true` if edges are drawn, `false` otherwise.
|
||||
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;
|
||||
|
||||
/// returns `true` if lines are drawn.
|
||||
/// \brief Checks if lines are drawn.
|
||||
/// \return `true` if lines are drawn, `false` otherwise.
|
||||
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;
|
||||
|
||||
/// returns `true` if mono color mode is used.
|
||||
bool use_mono_color() const;
|
||||
|
||||
/// returns `true` if normals are reversed.
|
||||
bool reverse_normal() const;
|
||||
|
||||
/// returns `true` if text are drawn.
|
||||
/// \brief Checks if text is drawn.
|
||||
/// \return `true` if text is drawn, `false` otherwise.
|
||||
bool draw_text() const;
|
||||
|
||||
/// returns the mono color used for vertices.
|
||||
const CGAL::IO::Color& vertices_mono_color() const;
|
||||
/// \brief Checks if the default color mode is used.
|
||||
/// \return `true` if mono color mode is used, `false` otherwise.
|
||||
bool use_default_color() const;
|
||||
|
||||
/// returns the mono color used for edges.
|
||||
const CGAL::IO::Color& edges_mono_color() const;
|
||||
/// \brief Checks if the default color mode for normals is used.
|
||||
/// \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.
|
||||
const CGAL::IO::Color& rays_mono_color() const;
|
||||
/// \brief Checks if normals are reversed.
|
||||
/// \return `true` if normals are reversed, `false` otherwise.
|
||||
bool reverse_normal() const;
|
||||
|
||||
/// returns the mono color used for lines.
|
||||
const CGAL::IO::Color& lines_mono_color() const;
|
||||
|
||||
/// returns the mono color used for faces.
|
||||
const CGAL::IO::Color& faces_mono_color() const;
|
||||
|
||||
/// returns `true` if the clipping plane is enabled.
|
||||
/// \brief Checks if the clipping plane is enabled.
|
||||
/// \return `true` if the clipping plane is enabled, `false` otherwise.
|
||||
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;
|
||||
|
||||
/// 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;
|
||||
|
||||
/// reverses all normals of vertices and faces.
|
||||
void reverse_all_normals();
|
||||
/// @}
|
||||
|
||||
/// \name Draw
|
||||
/// @{
|
||||
|
||||
/// draws the viewer without recomputing all internal buffers.
|
||||
virtual void draw();
|
||||
|
|
@ -132,6 +193,8 @@ public:
|
|||
/// redraws the viewer, i.e., recompute all internal buffers and update the window.
|
||||
virtual void redraw();
|
||||
|
||||
/// @}
|
||||
|
||||
/// Function called when a key is pressed. Users can define their own function in order
|
||||
/// to add specific behavior.
|
||||
std::function<bool(QKeyEvent *, CGAL::Qt::Basic_viewer *)> on_key_pressed;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgBasicViewerRef Basic Viewer Reference
|
||||
/// \defgroup PkgBasicViewerRef Reference Manual
|
||||
|
||||
/// \defgroup PkgBasicViewerConcepts Concepts
|
||||
/// \ingroup PkgBasicViewerRef
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ find_package(Eigen3 3.1.0)
|
|||
include(CGAL_Eigen3_support)
|
||||
|
||||
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_small_faces.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)
|
||||
#link it with the required CGAL libraries
|
||||
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_small_faces 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()
|
||||
message("CGAL_Qt6 not configured: examples that require Qt will not be compiled.")
|
||||
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
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <CGAL/draw_polyhedron.h>
|
||||
#include <CGAL/draw_point_set_3.h>
|
||||
#include <CGAL/Graphics_scene_options.h>
|
||||
#include <CGAL/Qt/Basic_viewer.h>
|
||||
#include <CGAL/Basic_viewer.h>
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <CGAL/draw_polyhedron.h>
|
||||
#include <CGAL/draw_point_set_3.h>
|
||||
#include <CGAL/Graphics_scene_options.h>
|
||||
#include <CGAL/Qt/Basic_viewer.h>
|
||||
#include <CGAL/Basic_viewer.h>
|
||||
|
||||
#ifdef CGAL_USE_BASIC_VIEWER
|
||||
#include <QMainWindow>
|
||||
|
|
|
|||
|
|
@ -17,131 +17,299 @@
|
|||
|
||||
namespace CGAL
|
||||
{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char vertex_source_color[]=R"DELIM(
|
||||
const char VERTEX_SOURCE_COLOR[]=R"DELIM(
|
||||
#version 150
|
||||
in highp vec4 vertex;
|
||||
in highp vec3 normal;
|
||||
in highp vec3 color;
|
||||
in highp vec3 a_Pos;
|
||||
in highp vec3 a_Normal;
|
||||
in mediump vec3 a_Color;
|
||||
|
||||
uniform highp mat4 mvp_matrix;
|
||||
uniform highp mat4 mv_matrix;
|
||||
uniform highp float point_size;
|
||||
|
||||
out highp vec4 fP;
|
||||
out highp vec4 vs_fP; // view space position
|
||||
out highp vec4 ls_fP; // local space position
|
||||
out highp vec3 fN;
|
||||
out highp vec4 fColor;
|
||||
out highp vec4 m_vertex;
|
||||
out 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)
|
||||
{
|
||||
fP = mv_matrix * vertex;
|
||||
fN = mat3(mv_matrix)* normal;
|
||||
fColor = vec4(color, 1.0);
|
||||
gl_PointSize = point_size;
|
||||
fColor = vec4(a_Color, 1.0);
|
||||
if (u_UseDefaultColor)
|
||||
{
|
||||
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";
|
||||
|
||||
const char fragment_source_color[]=R"DELIM(
|
||||
const char FRAGMENT_SOURCE_COLOR[]=R"DELIM(
|
||||
#version 150
|
||||
in highp vec4 fP;
|
||||
in highp vec4 vs_fP;
|
||||
in highp vec4 ls_fP;
|
||||
in highp vec3 fN;
|
||||
in highp vec4 fColor;
|
||||
in highp vec4 m_vertex;
|
||||
in mediump vec4 fColor;
|
||||
|
||||
uniform highp vec4 light_pos;
|
||||
uniform highp vec4 light_diff;
|
||||
uniform highp vec4 light_spec;
|
||||
uniform highp vec4 light_amb;
|
||||
uniform highp float spec_power;
|
||||
out mediump vec4 out_color;
|
||||
|
||||
uniform highp vec4 clipPlane;
|
||||
uniform highp vec4 pointPlane;
|
||||
uniform highp float rendering_mode;
|
||||
uniform highp float rendering_transparency;
|
||||
uniform highp vec4 u_LightPos;
|
||||
uniform mediump vec4 u_LightDiff;
|
||||
uniform mediump vec4 u_LightSpec;
|
||||
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)
|
||||
{
|
||||
highp vec3 L = light_pos.xyz - fP.xyz;
|
||||
highp vec3 V = -fP.xyz;
|
||||
highp vec3 L = u_LightPos.xyz - vs_fP.xyz;
|
||||
highp vec3 V = -vs_fP.xyz;
|
||||
|
||||
highp vec3 N = normalize(fN);
|
||||
highp vec3 a_Normal = normalize(fN);
|
||||
L = normalize(L);
|
||||
V = normalize(V);
|
||||
|
||||
highp vec3 R = reflect(-L, N);
|
||||
highp vec4 diffuse = vec4(max(dot(N,L), 0.0) * light_diff.rgb * fColor.rgb, 1.0);
|
||||
highp vec4 ambient = vec4(light_amb.rgb * fColor.rgb, 1.0);
|
||||
highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec;
|
||||
highp vec3 R = reflect(-L, a_Normal);
|
||||
highp vec4 diffuse = vec4(max(dot(a_Normal,L), 0.0) * u_LightDiff.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), u_SpecPower) * u_LightSpec;
|
||||
|
||||
// onPlane == 1: inside clipping plane, should be solid;
|
||||
// onPlane == -1: outside clipping plane, should be transparent;
|
||||
// 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 == 0: draw solid 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;
|
||||
}
|
||||
|
||||
// draw corresponding part
|
||||
out_color = rendering_mode < 1 ? (diffuse + ambient) :
|
||||
vec4(diffuse.rgb + ambient.rgb, rendering_transparency);
|
||||
out_color = u_RenderingMode < 1 ? (diffuse + ambient) :
|
||||
vec4(diffuse.rgb + ambient.rgb, u_RenderingTransparency);
|
||||
}
|
||||
)DELIM";
|
||||
|
||||
const char vertex_source_p_l[]=R"DELIM(
|
||||
const char VERTEX_SOURCE_P_L[]=R"DELIM(
|
||||
#version 150
|
||||
in highp vec4 vertex;
|
||||
in highp vec3 color;
|
||||
in highp vec3 a_Pos;
|
||||
in mediump vec3 a_Color;
|
||||
|
||||
uniform highp mat4 mvp_matrix;
|
||||
uniform highp float point_size;
|
||||
out mediump vec4 fColor;
|
||||
out highp vec4 ls_fP; // local space
|
||||
|
||||
out highp vec4 fColor;
|
||||
out highp vec4 m_vertex;
|
||||
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)
|
||||
{
|
||||
gl_PointSize = point_size;
|
||||
fColor = vec4(color, 1.0);
|
||||
m_vertex = vertex;
|
||||
gl_Position = mvp_matrix * vertex;
|
||||
fColor = vec4(a_Color, 1.0);
|
||||
if (u_UseDefaultColor)
|
||||
{
|
||||
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";
|
||||
|
||||
const char fragment_source_p_l[]=R"DELIM(
|
||||
const char VERTEX_SOURCE_SHAPE[]=R"DELIM(
|
||||
#version 150
|
||||
in highp vec4 fColor;
|
||||
in highp vec4 m_vertex;
|
||||
in highp vec3 a_Pos;
|
||||
in mediump vec3 a_Color;
|
||||
|
||||
uniform highp vec4 clipPlane;
|
||||
uniform highp vec4 pointPlane;
|
||||
uniform highp float rendering_mode;
|
||||
out mediump vec4 gColor;
|
||||
out highp vec4 ls_fP;
|
||||
|
||||
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)
|
||||
{
|
||||
// onPlane == 1: inside clipping plane, should be solid;
|
||||
// onPlane == -1: outside clipping plane, should be transparent;
|
||||
// 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 == 0: draw inside 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;
|
||||
}
|
||||
|
|
@ -150,106 +318,554 @@ void main(void)
|
|||
}
|
||||
)DELIM";
|
||||
|
||||
const char vertex_source_clipping_plane[]=R"DELIM(
|
||||
const char VERTEX_SOURCE_CLIPPING_PLANE[]=R"DELIM(
|
||||
#version 150
|
||||
in highp vec4 vertex;
|
||||
in highp vec3 a_Pos;
|
||||
|
||||
uniform highp mat4 vp_matrix;
|
||||
uniform highp mat4 m_matrix;
|
||||
uniform highp mat4 u_Vp;
|
||||
uniform highp mat4 u_M;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = vp_matrix * m_matrix * vertex;
|
||||
gl_Position = u_Vp * u_M * vec4(a_Pos, 1.0);
|
||||
}
|
||||
)DELIM";
|
||||
|
||||
const char fragment_source_clipping_plane[]=R"DELIM(
|
||||
const char FRAGMENT_SOURCE_CLIPPING_PLANE[]=R"DELIM(
|
||||
#version 150
|
||||
out highp vec4 out_color;
|
||||
|
||||
out mediump vec4 out_color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
out_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
)DELIM";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// compatibility shaders
|
||||
const char VERTEX_SOURCE_LINE[]=R"DELIM(
|
||||
#version 150
|
||||
in highp vec3 a_Pos;
|
||||
in mediump vec3 a_Color;
|
||||
|
||||
const char vertex_source_color_comp[]=R"DELIM(
|
||||
varying highp vec4 vertex;
|
||||
varying highp vec3 normal;
|
||||
varying highp vec3 color;
|
||||
out VS_OUT {
|
||||
mediump vec4 color;
|
||||
} vs_out; // vertex shader output
|
||||
|
||||
uniform highp mat4 mvp_matrix;
|
||||
uniform highp mat4 mv_matrix;
|
||||
uniform highp float point_size;
|
||||
|
||||
varying highp vec4 fP;
|
||||
varying highp vec3 fN;
|
||||
varying highp vec4 fColor;
|
||||
uniform mediump vec3 u_DefaultColor;
|
||||
uniform bool u_UseDefaultColor;
|
||||
|
||||
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;
|
||||
mv_matrix_3[0] = mv_matrix[0].xyz;
|
||||
mv_matrix_3[1] = mv_matrix[1].xyz;
|
||||
mv_matrix_3[2] = mv_matrix[2].xyz;
|
||||
fN = mv_matrix_3* normal;
|
||||
fColor = vec4(color, 1.0);
|
||||
gl_PointSize = point_size;
|
||||
fN = mv_matrix_3* a_Normal;
|
||||
|
||||
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";
|
||||
|
||||
const char fragment_source_color_comp[]=R"DELIM(
|
||||
varying highp vec4 fP;
|
||||
const char FRAGMENT_SOURCE_COLOR_COMP[]=R"DELIM(
|
||||
varying highp vec4 vs_fP;
|
||||
varying highp vec3 fN;
|
||||
varying highp vec4 fColor;
|
||||
varying mediump vec4 fColor;
|
||||
|
||||
uniform highp vec4 light_pos;
|
||||
uniform highp vec4 light_diff;
|
||||
uniform highp vec4 light_spec;
|
||||
uniform highp vec4 light_amb;
|
||||
uniform highp float spec_power ;
|
||||
uniform highp vec4 u_LightPos;
|
||||
uniform mediump vec4 u_LightDiff;
|
||||
uniform mediump vec4 u_LightSpec;
|
||||
uniform mediump vec4 u_LightAmb;
|
||||
uniform mediump float u_SpecPower ;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
highp vec3 L = light_pos.xyz - fP.xyz;
|
||||
highp vec3 V = -fP.xyz;
|
||||
highp vec3 L = u_LightPos.xyz - vs_fP.xyz;
|
||||
highp vec3 V = -vs_fP.xyz;
|
||||
|
||||
highp vec3 N = normalize(fN);
|
||||
highp vec3 a_Normal = normalize(fN);
|
||||
L = normalize(L);
|
||||
V = normalize(V);
|
||||
|
||||
highp vec3 R = reflect(-L, N);
|
||||
highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor;
|
||||
highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec;
|
||||
highp vec3 R = reflect(-L, a_Normal);
|
||||
highp vec4 diffuse = max(dot(a_Normal,L), 0.0) * u_LightDiff * fColor;
|
||||
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";
|
||||
|
||||
const char vertex_source_p_l_comp[]=R"DELIM(
|
||||
varying highp vec4 vertex;
|
||||
varying highp vec3 color;
|
||||
const char VERTEX_SOURCE_P_L_COMP[]=R"DELIM(
|
||||
varying highp vec3 a_Pos;
|
||||
varying mediump vec3 a_Color;
|
||||
|
||||
uniform highp mat4 mvp_matrix;
|
||||
uniform highp float point_size;
|
||||
varying mediump vec4 fColor;
|
||||
|
||||
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)
|
||||
{
|
||||
gl_PointSize = point_size;
|
||||
fColor = vec4(color, 1.0);
|
||||
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 * vec4(a_Pos, 1.0);
|
||||
}
|
||||
)DELIM";
|
||||
|
||||
const char fragment_source_p_l_comp[]=R"DELIM(
|
||||
varying highp vec4 fColor;
|
||||
const char FRAGMENT_SOURCE_P_L_COMP[]=R"DELIM(
|
||||
varying mediump vec4 fColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_FragColor = fColor;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -146,7 +146,7 @@ namespace internal
|
|||
{
|
||||
typename CDT::Edge e(fh,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); }
|
||||
else { queue.push(n); }
|
||||
|
|
@ -884,13 +884,13 @@ protected:
|
|||
typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits, TDS, Itag> CDT;
|
||||
|
||||
protected:
|
||||
std::vector<BufferType>* m_pos_buffer;
|
||||
std::vector<IndexType>* m_index_buffer;
|
||||
std::vector<BufferType>* m_color_buffer;
|
||||
mutable std::vector<BufferType>* m_flat_normal_buffer;
|
||||
mutable std::vector<BufferType>* m_gouraud_normal_buffer;
|
||||
std::vector<BufferType>* m_pos_buffer=nullptr;
|
||||
std::vector<IndexType>* m_index_buffer=nullptr;
|
||||
std::vector<BufferType>* m_color_buffer=nullptr;
|
||||
mutable std::vector<BufferType>* m_flat_normal_buffer=nullptr;
|
||||
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_y; /// True iff all points have y==0
|
||||
|
|
|
|||
|
|
@ -64,64 +64,82 @@ public:
|
|||
typedef Local_kernel::Vector_3 Local_vector;
|
||||
|
||||
Graphics_scene()
|
||||
: m_buffer_for_mono_points(&arrays[POS_MONO_POINTS], nullptr,
|
||||
&m_bounding_box, nullptr, nullptr, nullptr),
|
||||
m_buffer_for_colored_points(&arrays[POS_COLORED_POINTS], nullptr,
|
||||
&m_bounding_box, &arrays[COLOR_POINTS],
|
||||
nullptr, nullptr),
|
||||
m_buffer_for_mono_segments(&arrays[POS_MONO_SEGMENTS], nullptr,
|
||||
&m_bounding_box, nullptr, nullptr, nullptr),
|
||||
m_buffer_for_colored_segments(&arrays[POS_COLORED_SEGMENTS], nullptr,
|
||||
&m_bounding_box, &arrays[COLOR_SEGMENTS],
|
||||
nullptr, nullptr),
|
||||
m_buffer_for_mono_rays(&arrays[POS_MONO_RAYS], nullptr, &m_bounding_box,
|
||||
nullptr, nullptr),
|
||||
m_buffer_for_colored_rays(&arrays[POS_COLORED_RAYS], nullptr,
|
||||
&m_bounding_box, &arrays[COLOR_RAYS], nullptr,
|
||||
nullptr),
|
||||
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])
|
||||
: m_buffer_for_points(&arrays[POS_POINTS], nullptr,
|
||||
&m_bounding_box, &arrays[COLOR_POINTS]),
|
||||
m_buffer_for_segments(&arrays[POS_SEGMENTS], nullptr,
|
||||
&m_bounding_box, &arrays[COLOR_SEGMENTS]),
|
||||
m_buffer_for_rays(&arrays[POS_RAYS], nullptr, &m_bounding_box,
|
||||
&arrays[COLOR_RAYS]),
|
||||
m_buffer_for_lines(&arrays[POS_RAYS], nullptr,
|
||||
&m_bounding_box, &arrays[COLOR_LINES]),
|
||||
m_buffer_for_faces(&arrays[POS_FACES], nullptr, &m_bounding_box, &arrays[COLOR_FACES],
|
||||
&arrays[FLAT_NORMAL_FACES], &arrays[SMOOTH_NORMAL_FACES]),
|
||||
m_default_color_face(60, 60, 200),
|
||||
m_default_color_point(200, 60, 60),
|
||||
m_default_color_segment(0, 0, 0),
|
||||
m_default_color_ray(0, 0, 0),
|
||||
m_default_color_line(0, 0, 0)
|
||||
{}
|
||||
|
||||
const Buffer_for_vao &get_buffer_for_mono_points() const
|
||||
{ return m_buffer_for_mono_points; }
|
||||
inline
|
||||
const CGAL::IO::Color &get_default_color_face() const
|
||||
{ return m_default_color_face; }
|
||||
|
||||
const Buffer_for_vao &get_buffer_for_colored_points() const
|
||||
{ return m_buffer_for_colored_points; }
|
||||
inline
|
||||
const CGAL::IO::Color &get_default_color_point() const
|
||||
{ return m_default_color_point; }
|
||||
|
||||
const Buffer_for_vao &get_buffer_for_mono_segments() const
|
||||
{ return m_buffer_for_mono_segments; }
|
||||
inline
|
||||
const CGAL::IO::Color &get_default_color_segment() const
|
||||
{ return m_default_color_segment; }
|
||||
|
||||
const Buffer_for_vao &get_buffer_for_colored_segments() const
|
||||
{ return m_buffer_for_colored_segments; }
|
||||
inline
|
||||
const CGAL::IO::Color &get_default_color_ray() const
|
||||
{ return m_default_color_ray; }
|
||||
|
||||
const Buffer_for_vao &get_buffer_for_mono_rays() const
|
||||
{ return m_buffer_for_mono_rays; }
|
||||
inline
|
||||
const CGAL::IO::Color &get_default_color_line() const
|
||||
{ return m_default_color_line; }
|
||||
|
||||
const Buffer_for_vao &get_buffer_for_colored_rays() const
|
||||
{ return m_buffer_for_colored_rays; }
|
||||
inline
|
||||
const Buffer_for_vao &get_buffer_for_points() const
|
||||
{ return m_buffer_for_points; }
|
||||
|
||||
const Buffer_for_vao &get_buffer_for_mono_lines() const
|
||||
{ return m_buffer_for_mono_lines; }
|
||||
inline
|
||||
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
|
||||
{ return m_buffer_for_colored_lines; }
|
||||
inline
|
||||
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
|
||||
{ return m_buffer_for_mono_faces; }
|
||||
inline
|
||||
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
|
||||
{ return m_buffer_for_colored_faces; }
|
||||
inline
|
||||
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; }
|
||||
|
||||
|
|
@ -159,31 +177,30 @@ public:
|
|||
|
||||
void reverse_all_normals() const
|
||||
{
|
||||
m_buffer_for_mono_faces.negate_normals();
|
||||
m_buffer_for_colored_faces.negate_normals();
|
||||
m_buffer_for_faces.negate_normals();
|
||||
}
|
||||
|
||||
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>
|
||||
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>
|
||||
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>
|
||||
void add_segment(const KPoint &p1, const KPoint &p2,
|
||||
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>
|
||||
void add_ray(const KPoint &p, const KVector &v)
|
||||
{
|
||||
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>
|
||||
|
|
@ -191,15 +208,15 @@ public:
|
|||
const CGAL::IO::Color &acolor)
|
||||
{
|
||||
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>
|
||||
void add_line(const KPoint &p, const KVector &v)
|
||||
{
|
||||
double bigNumber = 1e30;
|
||||
m_buffer_for_mono_lines.add_line_segment((p - (bigNumber)*v),
|
||||
(p + (bigNumber)*v));
|
||||
m_buffer_for_lines.add_line_segment((p - (bigNumber)*v),
|
||||
(p + (bigNumber)*v), m_default_color_line);
|
||||
}
|
||||
|
||||
template <typename KPoint, typename KVector>
|
||||
|
|
@ -207,33 +224,28 @@ public:
|
|||
const CGAL::IO::Color &acolor)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
template <typename KPoint> bool add_point_in_face(const KPoint &kp)
|
||||
{
|
||||
if (m_buffer_for_mono_faces.is_a_face_started())
|
||||
{ return m_buffer_for_mono_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); }
|
||||
if (m_buffer_for_faces.is_a_face_started())
|
||||
{ return m_buffer_for_faces.add_point_in_face(kp); }
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename KPoint, typename KVector>
|
||||
bool add_point_in_face(const KPoint &kp, const KVector &p_normal)
|
||||
{
|
||||
if (m_buffer_for_mono_faces.is_a_face_started())
|
||||
{ return m_buffer_for_mono_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); }
|
||||
if (m_buffer_for_faces.is_a_face_started())
|
||||
{ return m_buffer_for_faces.add_point_in_face(kp, p_normal); }
|
||||
return false;
|
||||
}
|
||||
|
||||
bool a_face_started() const
|
||||
{
|
||||
return m_buffer_for_mono_faces.is_a_face_started() ||
|
||||
m_buffer_for_colored_faces.is_a_face_started();
|
||||
return m_buffer_for_faces.is_a_face_started();
|
||||
}
|
||||
|
||||
void face_begin()
|
||||
|
|
@ -245,7 +257,7 @@ public:
|
|||
<< std::endl;
|
||||
}
|
||||
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)
|
||||
|
|
@ -257,15 +269,13 @@ public:
|
|||
<< std::endl;
|
||||
}
|
||||
else
|
||||
{ m_buffer_for_colored_faces.face_begin(acolor); }
|
||||
{ m_buffer_for_faces.face_begin(acolor); }
|
||||
}
|
||||
|
||||
void face_end()
|
||||
{
|
||||
if (m_buffer_for_mono_faces.is_a_face_started())
|
||||
{ m_buffer_for_mono_faces.face_end(); }
|
||||
else if (m_buffer_for_colored_faces.is_a_face_started())
|
||||
{ m_buffer_for_colored_faces.face_end(); }
|
||||
if (m_buffer_for_faces.is_a_face_started())
|
||||
{ m_buffer_for_faces.face_end(); }
|
||||
}
|
||||
|
||||
template <typename KPoint>
|
||||
|
|
@ -281,58 +291,38 @@ public:
|
|||
|
||||
bool empty() const
|
||||
{
|
||||
return (m_buffer_for_mono_points.is_empty() &&
|
||||
m_buffer_for_colored_points.is_empty() &&
|
||||
m_buffer_for_mono_segments.is_empty() &&
|
||||
m_buffer_for_colored_segments.is_empty() &&
|
||||
m_buffer_for_mono_rays.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());
|
||||
return (m_buffer_for_points.is_empty() &&
|
||||
m_buffer_for_segments.is_empty() &&
|
||||
m_buffer_for_rays.is_empty() &&
|
||||
m_buffer_for_lines.is_empty() &&
|
||||
m_buffer_for_faces.is_empty());
|
||||
}
|
||||
|
||||
bool has_zero_x() const
|
||||
{
|
||||
return m_buffer_for_mono_points.has_zero_x() &&
|
||||
m_buffer_for_colored_points.has_zero_x() &&
|
||||
m_buffer_for_mono_segments.has_zero_x() &&
|
||||
m_buffer_for_colored_segments.has_zero_x() &&
|
||||
m_buffer_for_mono_faces.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();
|
||||
return m_buffer_for_points.has_zero_x() &&
|
||||
m_buffer_for_segments.has_zero_x() &&
|
||||
m_buffer_for_faces.has_zero_x() &&
|
||||
m_buffer_for_rays.has_zero_x() &&
|
||||
m_buffer_for_lines.has_zero_x();
|
||||
}
|
||||
|
||||
bool has_zero_y() const
|
||||
{
|
||||
return m_buffer_for_mono_points.has_zero_y() &&
|
||||
m_buffer_for_colored_points.has_zero_y() &&
|
||||
m_buffer_for_mono_segments.has_zero_y() &&
|
||||
m_buffer_for_colored_segments.has_zero_y() &&
|
||||
m_buffer_for_mono_faces.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();
|
||||
return m_buffer_for_points.has_zero_y() &&
|
||||
m_buffer_for_segments.has_zero_y() &&
|
||||
m_buffer_for_faces.has_zero_y() &&
|
||||
m_buffer_for_rays.has_zero_y() &&
|
||||
m_buffer_for_lines.has_zero_y();
|
||||
}
|
||||
|
||||
bool has_zero_z() const
|
||||
{
|
||||
return m_buffer_for_mono_points.has_zero_z() &&
|
||||
m_buffer_for_colored_points.has_zero_z() &&
|
||||
m_buffer_for_mono_segments.has_zero_z() &&
|
||||
m_buffer_for_colored_segments.has_zero_z() &&
|
||||
m_buffer_for_mono_faces.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();
|
||||
return m_buffer_for_points.has_zero_z() &&
|
||||
m_buffer_for_segments.has_zero_z() &&
|
||||
m_buffer_for_faces.has_zero_z() &&
|
||||
m_buffer_for_rays.has_zero_z() &&
|
||||
m_buffer_for_lines.has_zero_z();
|
||||
}
|
||||
|
||||
// Returns true if the data structure lies on a XY or XZ or YZ plane
|
||||
|
|
@ -343,16 +333,11 @@ public:
|
|||
|
||||
void clear()
|
||||
{
|
||||
m_buffer_for_mono_points.clear();
|
||||
m_buffer_for_colored_points.clear();
|
||||
m_buffer_for_mono_segments.clear();
|
||||
m_buffer_for_colored_segments.clear();
|
||||
m_buffer_for_mono_rays.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_buffer_for_points.clear();
|
||||
m_buffer_for_segments.clear();
|
||||
m_buffer_for_rays.clear();
|
||||
m_buffer_for_lines.clear();
|
||||
m_buffer_for_faces.clear();
|
||||
m_texts.clear();
|
||||
m_bounding_box=CGAL::Bbox_3();
|
||||
}
|
||||
|
|
@ -385,16 +370,11 @@ public:
|
|||
// vectors.
|
||||
enum Buffers {
|
||||
BEGIN_POS = 0,
|
||||
POS_MONO_POINTS = BEGIN_POS,
|
||||
POS_COLORED_POINTS,
|
||||
POS_MONO_SEGMENTS,
|
||||
POS_COLORED_SEGMENTS,
|
||||
POS_MONO_RAYS,
|
||||
POS_COLORED_RAYS,
|
||||
POS_MONO_LINES,
|
||||
POS_COLORED_LINES,
|
||||
POS_MONO_FACES,
|
||||
POS_COLORED_FACES,
|
||||
POS_POINTS = BEGIN_POS,
|
||||
POS_SEGMENTS,
|
||||
POS_RAYS,
|
||||
POS_LINES,
|
||||
POS_FACES,
|
||||
END_POS,
|
||||
BEGIN_COLOR = END_POS,
|
||||
COLOR_POINTS = BEGIN_COLOR,
|
||||
|
|
@ -404,25 +384,24 @@ public:
|
|||
COLOR_FACES,
|
||||
END_COLOR,
|
||||
BEGIN_NORMAL = END_COLOR,
|
||||
SMOOTH_NORMAL_MONO_FACES = BEGIN_NORMAL,
|
||||
FLAT_NORMAL_MONO_FACES,
|
||||
SMOOTH_NORMAL_COLORED_FACES,
|
||||
FLAT_NORMAL_COLORED_FACES,
|
||||
SMOOTH_NORMAL_FACES = BEGIN_NORMAL,
|
||||
FLAT_NORMAL_FACES,
|
||||
END_NORMAL,
|
||||
LAST_INDEX = END_NORMAL
|
||||
};
|
||||
|
||||
protected:
|
||||
Buffer_for_vao m_buffer_for_mono_points;
|
||||
Buffer_for_vao m_buffer_for_colored_points;
|
||||
Buffer_for_vao m_buffer_for_mono_segments;
|
||||
Buffer_for_vao m_buffer_for_colored_segments;
|
||||
Buffer_for_vao m_buffer_for_mono_rays;
|
||||
Buffer_for_vao m_buffer_for_colored_rays;
|
||||
Buffer_for_vao m_buffer_for_mono_lines;
|
||||
Buffer_for_vao m_buffer_for_colored_lines;
|
||||
Buffer_for_vao m_buffer_for_mono_faces;
|
||||
Buffer_for_vao m_buffer_for_colored_faces;
|
||||
Buffer_for_vao m_buffer_for_points;
|
||||
Buffer_for_vao m_buffer_for_segments;
|
||||
Buffer_for_vao m_buffer_for_rays;
|
||||
Buffer_for_vao m_buffer_for_lines;
|
||||
Buffer_for_vao m_buffer_for_faces;
|
||||
|
||||
CGAL::IO::Color m_default_color_face;
|
||||
CGAL::IO::Color m_default_color_point;
|
||||
CGAL::IO::Color m_default_color_segment;
|
||||
CGAL::IO::Color m_default_color_ray;
|
||||
CGAL::IO::Color m_default_color_line;
|
||||
|
||||
std::vector<std::tuple<Local_point, std::string>> m_texts;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -116,7 +116,7 @@ In our context, a polygon must uphold the following conditions:
|
|||
<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>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>
|
||||
|
||||
\subsection bso_ssecpolygon_with_holes_validation Conditions for Valid Polygons with Holes
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// \defgroup PkgBooleanSetOperations2Ref 2D Regularized Boolean Set-Operations Reference
|
||||
/// \defgroup PkgBooleanSetOperations2Ref Reference Manual
|
||||
/// \defgroup PkgBooleanSetOperations2Concepts Concepts
|
||||
/// \ingroup PkgBooleanSetOperations2Ref
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public:
|
|||
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
|
||||
half-edges.
|
||||
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ template <class Traits_, class TopTraits_, class ValidationPolicy>
|
|||
}
|
||||
|
||||
//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>
|
||||
void Gps_on_surface_base_2<Traits_, TopTraits_, ValidationPolicy>::
|
||||
_insert(const Polygon_with_holes_2 & pgn, Arrangement_on_surface_2 & arr)
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ is_crossover_outer_boundary(const typename Traits_2::Polygon_with_holes_2& pgn,
|
|||
Vertex_const_handle cver;
|
||||
Point_2 second_point;
|
||||
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
|
||||
second_point = max_functor(*next);
|
||||
obj = pl.locate(second_point);
|
||||
|
|
@ -622,7 +622,7 @@ bool are_holes_and_boundary_pairwise_disjoint
|
|||
Topology_traits;
|
||||
typedef CGAL::Gps_on_surface_base_2<Traits_2, Topology_traits>
|
||||
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_with_holes_2 Polygon_with_holes_2;
|
||||
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
|
||||
Arrangement_2;
|
||||
|
||||
/* Should be perfored more efficeintly than using sweep and than
|
||||
* difference().
|
||||
/* Should be perfored more efficiently than using sweep and then difference().
|
||||
*
|
||||
* 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
|
||||
|
|
@ -677,7 +676,7 @@ bool are_holes_and_boundary_pairwise_disjoint
|
|||
Polygon_set_2 gps(traits);
|
||||
// check for 2D intersections of holes (holes must be disjoint except for
|
||||
// vertices)
|
||||
Size num_of_holes = 0;
|
||||
// Size num_of_holes = 0;
|
||||
// functors for creating a pwh needed for inserting pgns into the arrangement
|
||||
// quickly
|
||||
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);
|
||||
// Polygon_with_holes_2 empty_pwh(hole);
|
||||
gps.insert(empty_pwh);
|
||||
num_of_holes++;
|
||||
// num_of_holes++;
|
||||
}
|
||||
}
|
||||
/* 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 :
|
||||
* 1 - Has empty or closed boundary and all the holes are closed
|
||||
* 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
|
||||
* 4 - All the segments (boundary and holes) do not cross or intersect in their
|
||||
* relative interior
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
#include <CGAL/license/Boolean_set_operations_2.h>
|
||||
|
||||
#include <CGAL/Qt/Basic_viewer.h>
|
||||
#include <CGAL/Graphics_scene.h>
|
||||
#include <CGAL/Graphics_scene_options.h>
|
||||
#include <CGAL/Polygon_set_2.h>
|
||||
#include <CGAL/Basic_viewer.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ void compute_elements(const PWH& pwh,
|
|||
|
||||
} // 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>
|
||||
class Polygon_set_2_basic_viewer_qt : public Basic_viewer
|
||||
|
|
@ -196,6 +196,8 @@ public:
|
|||
CGAL::qglviewer::Vec maxv(bbox.xmax(), bbox.ymax(), 0);
|
||||
auto diameter = (maxv - minv).norm();
|
||||
m_pixel_ratio = diameter / gso.height();
|
||||
|
||||
add_elements();
|
||||
}
|
||||
|
||||
/*! 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);
|
||||
}
|
||||
|
||||
#ifdef CGAL_USE_BASIC_VIEWER
|
||||
|
||||
// Specialization of draw function.
|
||||
template<class T, class C, class D, class GSOptions>
|
||||
void draw(const CGAL_PS2_TYPE& ps, GSOptions& gso,
|
||||
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)
|
||||
bool cgal_test_suite = true;
|
||||
#else
|
||||
|
|
@ -306,6 +311,7 @@ void draw(const CGAL_PS2_TYPE& ps, GSOptions& gso,
|
|||
basic_viewer.show();
|
||||
app.exec();
|
||||
}
|
||||
#endif // CGAL_USE_BASIC_VIEWER
|
||||
}
|
||||
|
||||
template<class T, class C, class D>
|
||||
|
|
@ -319,7 +325,6 @@ void draw(const CGAL_PS2_TYPE& ps,
|
|||
draw(ps, gso, title);
|
||||
}
|
||||
|
||||
#endif // CGAL_USE_BASIC_VIEWER
|
||||
|
||||
#undef CGAL_PS2_TYPE
|
||||
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ int main(int argc, char *argv[])
|
|||
write_complement_to_file(out, p1);
|
||||
write_complement_to_file(out, p2);
|
||||
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;
|
||||
|
||||
return (0);
|
||||
|
|
@ -239,7 +239,7 @@ int main(int argc, char *argv[])
|
|||
write_complement_to_file(out, p1);
|
||||
write_complement_to_file(out, pwh2);
|
||||
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;
|
||||
|
||||
return (0);
|
||||
|
|
@ -251,7 +251,7 @@ int main(int argc, char *argv[])
|
|||
write_complement_to_file(out, pwh1);
|
||||
write_complement_to_file(out, p2);
|
||||
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;
|
||||
|
||||
return (0);
|
||||
|
|
@ -263,7 +263,7 @@ int main(int argc, char *argv[])
|
|||
write_complement_to_file(out, pwh1);
|
||||
write_complement_to_file(out, pwh2);
|
||||
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;
|
||||
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace CGAL {
|
|||
\ingroup PkgBoundingVolumesRef
|
||||
|
||||
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
|
||||
ellipse that contains all points of \f$ P\f$. Note that \f$ me(P)\f$ can be
|
||||
degenerate,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ optimization algorithms using the two-dimensional \cgal kernel.
|
|||
\sa `CGAL::Min_annulus_d<Traits>`
|
||||
\sa `CGAL::Min_sphere_annulus_d_traits_3<K,ET,NT>`
|
||||
\sa `CGAL::Min_sphere_annulus_d_traits_d<K,ET,NT>`
|
||||
\sa `MinSphereAnnulusDTraits`
|
||||
|
||||
*/
|
||||
template< typename K, typename ET, typename NT >
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue