Merge branch 'Periodic_3_Regular_triangulation_3-APelle-old' into Periodic_3_Regular_triangulation_3-APelle

Based on Kernel_Weighted_point_without...
  @ 95c71de2e5
This commit is contained in:
Mael Rouxel-Labbé
2017-05-30 16:13:34 +02:00
112 changed files with 16812 additions and 5370 deletions
@@ -24,7 +24,6 @@
#include <CGAL/Segment_Delaunay_graph_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Regular_triangulation_euclidean_traits_2.h>
#include <CGAL/Regular_triangulation_2.h>
#include <CGAL/Object.h>
#include <CGAL/intersections.h>
+10 -8
View File
@@ -596,18 +596,20 @@ Teillaud"
, author = "Olivier Devillers and Monique Teillaud"
, title = "Perturbations and Vertex Removal in a {3D Delaunay} Triangulation"
, booktitle = "Proc. 14th ACM-SIAM Sympos. Discrete Algorithms (SODA)"
, url = "http://hal.inria.fr/inria-00166710/"
, year = 2003
, pages = "313-319"
}
@TechReport{ cgal:dt-pvrdr-06,
author = {Devillers, Olivier and Teillaud, Monique},
title = {Perturbations and Vertex Removal in {Delaunay} and Regular {3D} Triangulations},
year = {2006},
institution = {INRIA},
number = {5968},
type = {Research Report},
note = {\url{ttp://hal.inria.fr/inria-00090522}}
@article{cgal:dt-pvrdr-06
, author = "Olivier Devillers and Monique Teillaud"
, title = "Perturbations for {Delaunay} and weighted {Delaunay} {3D} Triangulations"
, journal = "Computational Geometry: Theory and Applications"
, volume = 44
, year = 2011
, pages = "160--168"
, url = "http://hal.archives-ouvertes.fr/inria-00560388/"
, doi = "10.1016/j.comgeo.2010.09.010"
}
@article{cgal:dw-tmgob-02,
@@ -238,6 +238,7 @@ ALIASES += "cgalConcept=\details <div id=\"CGALConcept\"></div>\n \brief"
ALIASES += "cgalConceptNamespace=\details <div id=\"CGALConceptNS\"></div>\n \brief"
ALIASES += "cgalRefines=\xrefitem refines \"Refines\" \"Refinement Relationships\""
ALIASES += "cgalRequires=\xrefitem requires \"Requires\" \"Type Requirements\""
ALIASES += "cgalModels=\xrefitem models \"Is Model Of\" \"Is Model Relationships\""
ALIASES += "cgalGeneralizes=\xrefitem generalizes \"Generalizes\" \"Generalization Relationships\""
ALIASES += "cgalHasModel=\xrefitem hasModels \"Has Models\" \"Has Model Relationships\""
+1
View File
@@ -74,6 +74,7 @@ Ralf Osbild
Steve Oudot
Eli Packer
Dmitrii Pasechnik
Aymeric Pellé
Luis Peñaranda
Sylvain Pion
Marc Pouget
+38 -7
View File
@@ -16,7 +16,7 @@
padding-top: 0.2em;
}
code::before, code::after {
content: " ";
content: " ";
letter-spacing: -0.2em;
}
</style>
@@ -214,6 +214,37 @@ and <code>src/</code> directories).
(but still equal to <code>Traits::Point_3</code>).
</li>
</ul>
<li>
Added a new 3D traits class, <code>Robust_weighted_circumcenter_filtered_traits_3</code>
which provides robust versions of the kernel functors <code>Construct_weighted_circumcenter_3</code>,
<code>Compute_squared_radius_3</code>, and <code>Compute_squared_radius_smallest_orthogonal_sphere_3</code>.
This class can be used as traits class in the the <code>Mesh_3</code> package
to efficiently yet robustly generate 3D meshes.
</li>
</ul>
<h3>3D Periodic Triangulations</h3>
<ul>
<li>
Added the class <code>Periodic_3_regular_triangulation_3</code>, which provides functionality
for 3D periodic weighted Delaunay triangulations. The construction is fully
dynamic: it provides both point insertion and vertex removal.
</li>
<li>
Added new locate and geometric access functions for 3D periodic triangulations.
</li>
<li>
The class <code>Periodic_3_Delaunay_triangulation_traits_3</code> now inherits
<code>Periodic_3_triangulation_traits_3</code>.
</li>
<li><b>Breaking change</b>:
Some geometric access functions in <code>Periodic_3_triangulation_3</code> were renamed.
The introduction of <code>Periodic_3_regular_triangulation_3</code> required
to distinguish between functions such as <code>segment()</code> returning
a segment of weightless points, or a segment of weighted points. As a general
rule, previous geometrical access functions will return objects with point
type that of the triangulation (thus, weighted objects when using weighted triangulations)
and functions containing <code>construct</code> in the name will always
return weightless geometrical objects.
</li>
</ul>
<!-- Voronoi Diagrams -->
@@ -1317,15 +1348,15 @@ and <code>src/</code> directories).
longer supported since CGAL-4.5.</li>
</ul>
</li>
<li>Since CGAL version 4.0, Eigen was the recommended third-party
<li>Since CGAL version 4.0, Eigen was the recommended third-party
library to use with <i>Planar Parameterization of Triangulated
Surface Meshes</i>, <i>Surface Reconstruction from Point
Sets</i>, <i>Approximation of Ridges and Umbilics on Triangulated
Surface Meshes</i>, and <i>Estimation of Local Differential
Properties of Point-Sampled Surfaces</i> packages. From CGAL
version 4.5, Taucs, Blas and Lapack are no longer supported.
version 4.5, Taucs, Blas and Lapack are no longer supported.
</li>
<li>CGAL is now compatible with the new CMake version 3.0.</li>
<li>CGAL is now compatible with the new CMake version 3.0.</li>
</ul>
<!-- New packages -->
@@ -1518,7 +1549,7 @@ and <code>src/</code> directories).
<li>Additional supported platforms:
<ul>
<li>The Apple Clang compiler version 5.0 is now supported on
OS X Mavericks.</li>
OS X Mavericks.</li>
<li>The Microsoft Windows Visual C++ compiler 2013 (VC12) is now
supported.</li>
</ul>
@@ -1692,7 +1723,7 @@ and <code>src/</code> directories).
constructor added to <code>CGAL::Object</code>. However, it is
recommended to upgrade your code. The previous behavior can be
restored by defining the
macro <code>CGAL_INTERSECTION_VERSION</code> to 1.
macro <code>CGAL_INTERSECTION_VERSION</code> to 1.
</li>
</ul>
<h4>2D Arrangements</h4>
@@ -2016,7 +2047,7 @@ and <code>src/</code> directories).
<li>Additional supported platforms:
<ul>
<li>The Apple Clang compiler versions 3.1 and 3.2 are now supported on
Mac OS X.</li>
Mac OS X.</li>
</ul>
</li>
<li>Improved configuration for essential and optional external third party software</li>
-1
View File
@@ -224,7 +224,6 @@
//#include <CGAL/Mesh_3/Refine_facets_3.h>
//#include <CGAL/Mesh_3/Refine_tets_visitor.h>
//#include <CGAL/Mesh_3/Robust_intersection_traits_3.h>
//#include <CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h>
//#include <CGAL/Mesh_3/Triangle_accessor_primitive.h>
//#include <CGAL/Mesh_3/utilities.h>
//#include <CGAL/Mesh_cell_base_3.h>
@@ -21,6 +21,16 @@ and defaults to `Mesh_vertex_base_3<Gt, MD>`.
\tparam Cell_base must be a model of `MeshCellBase_3` or `Default`
and defaults to `Compact_mesh_cell_base_3<Gt, MD>`.
\warning To improve the robustness of the meshing process, the input traits `Gt`
is wrapped with the traits class `Robust_weighted_circumcenter_filtered_traits_3`.
The class `Robust_weighted_circumcenter_filtered_traits_3<Gt>` upgrades the functors
models of `Kernel::ConstructWeightedCircumcenter_3`, `Kernel::ComputeSquaredRadius_3`,
and `Kernel::ComputeSquaredRadiusSmallestOrthogonalSphere_3` that are
provided by `Gt` to use exact computations when the geometric configuration
is close to degenerate (e.g. almost coplanar points). <br>
Users should therefore be aware that the traits class of the triangulation
will have type `Robust_weighted_circumcenter_filtered_traits_3<Gt>`.
\sa `make_mesh_3()`
\sa `Mesh_complex_3_in_triangulation_3<Tr,CornerIndex,CurveSegmentIndex>`
@@ -947,7 +947,7 @@ insert_balls(const Vertex_handle& vp,
const FT sp = get_radius(vp);
const FT sq = get_radius(vq);
// Compute geodesic distance
const FT pq_geo_signed = domain_.geodesic_distance(p, q, curve_index);
const CGAL::Sign d_sign = CGAL::sign(pq_geo_signed);
+3 -4
View File
@@ -31,7 +31,7 @@
#include <CGAL/Kernel_traits.h>
#include <CGAL/Regular_triangulation_3.h>
#include <CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h>
#include <CGAL/Robust_weighted_circumcenter_filtered_traits_3.h>
#include <CGAL/Mesh_vertex_base_3.h>
#include <CGAL/Compact_mesh_cell_base_3.h>
@@ -44,9 +44,8 @@ namespace CGAL {
struct Mesh_geom_traits_generator
{
private:
typedef Robust_weighted_circumcenter_filtered_traits_3<K>
Geom_traits;
typedef Robust_weighted_circumcenter_filtered_traits_3<K> Geom_traits;
public:
typedef Geom_traits type;
typedef type Type;
-1
View File
@@ -50,7 +50,6 @@ if ( CGAL_FOUND )
create_single_source_cgal_program( "test_meshing_polyhedron_with_features.cpp" )
create_single_source_cgal_program( "test_meshing_unit_tetrahedron.cpp" )
create_single_source_cgal_program( "test_meshing_with_default_edge_size.cpp" )
create_single_source_cgal_program( "test_robust_weighted_circumcenter.cpp" )
create_single_source_cgal_program( "test_meshing_determinism.cpp" )
create_single_source_cgal_program( "test_c3t3_extract_subdomains_boundaries.cpp" )
create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" )
@@ -102,10 +102,11 @@ public:
const Iso_rectangle_2* _domain;
};
template < typename K, typename Construct_point_3_base>
class Periodic_2_construct_point_2 : public Construct_point_3_base
template < typename K, typename Construct_point_2_base>
class Periodic_2_construct_point_2 : public Construct_point_2_base
{
typedef K Kernel;
typedef Construct_point_2_base Base;
typedef K Kernel;
public:
typedef typename Kernel::Point_2 Point;
@@ -116,7 +117,7 @@ public:
Periodic_2_construct_point_2(const Iso_rectangle_2 & dom) : _dom(dom) { }
using Construct_point_3_base::operator();
using Base::operator();
Point operator() ( const Point& p, const Offset& o ) const
{
@@ -125,7 +126,7 @@ public:
}
private:
Iso_rectangle_2 _dom;
const Iso_rectangle_2& _dom;
};
@@ -1283,7 +1283,7 @@ inline void Scene::primitives_from_geom_it(Segment_set& sset) {
case SEGMENT:
for ( Segment_iterator sit = p3dt.periodic_segments_begin(it_type) ;
sit != p3dt.periodic_segments_end(it_type) ; ++sit ) {
sset.insert(p3dt.segment(*sit));
sset.insert(p3dt.construct_segment(*sit));
}
break;
case TRIANGLE:
@@ -196,7 +196,7 @@ void Viewer::compute_elements()
P3DT3::UNIQUE);
++ptit) {
for (int i=0 ; i<4 ; i++) {
Segment_3 dual = scene->periodic_triangulation.segment(
Segment_3 dual = scene->periodic_triangulation.construct_segment(
scene->periodic_triangulation.dual(*(ptit.get_facet())));
FT sz = dual.source().z();
@@ -4,62 +4,55 @@ namespace CGAL {
/*!
\ingroup PkgPeriodic3Triangulation3MainClasses
The class `Periodic_3_Delaunay_triangulation_3` represents a
Delaunay triangulation in three-dimensional periodic space.
The class `Periodic_3_Delaunay_triangulation_3` represents a
Delaunay triangulation in three-dimensional periodic space.
\cgalHeading{Template Parameters}
\tparam PT must be a model of the concept `Periodic_3DelaunayTriangulationTraits_3`.
The first template argument `PT` must be a model of the
`Periodic_3DelaunayTriangulationTraits_3` concept.
The second template argument `TDS` must be a model of the
`TriangulationDataStructure_3` concept with some additional
functionality in cells and vertices.
Its default value is
`Triangulation_data_structure_3<Triangulation_vertex_base_3<PT,Periodic_3_triangulation_ds_vertex_base_3<>>,Triangulation_cell_base_3<PT,Periodic_3_triangulation_ds_cell_base_3<>>>`.
\tparam TDS must be a model of the concept `TriangulationDataStructure_3`. Its default value
is `Triangulation_data_structure_3<Triangulation_vertex_base_3<PT,Periodic_3_triangulation_ds_vertex_base_3<>>,Triangulation_cell_base_3<PT,Periodic_3_triangulation_ds_cell_base_3<>>>`.
*/
template< typename PT, typename TDS >
class Periodic_3_Delaunay_triangulation_3 :
public Periodic_3_triangulation_3<Periodic_3DelaunayTriangulationTraits_3,
TriangulationDataStructure_3>
{
class Periodic_3_Delaunay_triangulation_3 :
public Periodic_3_triangulation_3<PT, TDS>
{
public:
/// \name Creation
/// \name Creation
/// @{
/*!
Creates an empty periodic Delaunay triangulation `dt`, with
`domain` as original domain and possibly specifying
a traits class `traits`.
\pre `domain` is a cube.
*/
Periodic_3_Delaunay_triangulation_3(
const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1),
const Geom_traits & traits = Geom_traits());
Creates an empty periodic Delaunay triangulation `dt`, with
`domain` as original domain and possibly specifying
a traits class `traits`.
\pre `domain` is a cube.
*/
Periodic_3_Delaunay_triangulation_3(
const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1),
const Geom_traits & traits = Geom_traits());
/*!
Copy constructor.
*/
Periodic_3_Delaunay_triangulation_3 (const
Periodic_3_Delaunay_triangulation_3 & dt1);
Copy constructor.
*/
Periodic_3_Delaunay_triangulation_3 (const
Periodic_3_Delaunay_triangulation_3 & dt1);
/*!
Equivalent to constructing an empty triangulation with the optional
domain and traits class arguments and calling `insert(first,last)`.
\pre The `value_type` of `first` and `last` are `Point`s lying inside `domain` and `domain` is a cube.
*/
template < class InputIterator >
Periodic_3_Delaunay_triangulation_3 (
InputIterator first,
InputIterator last,
const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1),
const Geom_traits & traits = Geom_traits());
Equivalent to constructing an empty triangulation with the optional
domain and traits class arguments and calling `insert(first,last)`.
\pre The `value_type` of `first` and `last` are `Point`s lying inside `domain` and `domain` is a cube.
*/
template < class InputIterator >
Periodic_3_Delaunay_triangulation_3 (
InputIterator first,
InputIterator last,
const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1),
const Geom_traits & traits = Geom_traits());
/// @}
/// @}
/*! \name Insertion
/*! \name Insertion
The following methods insert points in the triangulation ensuring the
empty sphere property of Delaunay triangulations. The inserted points
@@ -78,189 +71,189 @@ and `Cell_handle`s.
/// @{
/*!
Inserts point `p` in the triangulation and returns the corresponding
vertex. The optional argument `start` is used as a starting place
for the point location.
\pre `p` lies in the original domain `domain`.
*/
Vertex_handle insert(const Point & p,
Cell_handle start = Cell_handle() );
Inserts point `p` in the triangulation and returns the corresponding
vertex. The optional argument `start` is used as a starting place
for the point location.
\pre `p` lies in the original domain `domain`.
*/
Vertex_handle insert(const Point & p,
Cell_handle start = Cell_handle() );
/*!
Inserts point `p` in the triangulation and returns the corresponding
vertex. Similar to the above `insert()` function, but takes as additional
parameter the return values of a previous location query. See description of
`Periodic_3_triangulation_3::locate()`.
\pre `p` lies in the original domain `domain`.
*/
Vertex_handle insert(const Point & p, Locate_type lt,
Cell_handle loc, int li, int lj);
Inserts point `p` in the triangulation and returns the corresponding
vertex. Similar to the above `insert()` function, but takes as additional
parameter the return values of a previous location query. See description of
`Periodic_3_triangulation_3::locate()`.
\pre `p` lies in the original domain `domain`.
*/
Vertex_handle insert(const Point & p, Locate_type lt,
Cell_handle loc, int li, int lj);
/// @}
/*! \name
The following method allows one to insert several points. It returns the number of inserted points.
The following method allows the insertion of several points and returns
the number of inserted points.
*/
/// @{
/*!
Inserts the points in the iterator range \f$ \left[\right.\f$`first`,
`last`\f$ \left.\right)\f$. Returns the number of inserted points.
This function uses spatial sorting (cf. chapter \ref secspatial_sorting)
and therefore is not guaranteed to insert the points following the
order of `InputIterator`. If the third argument
`is_large_point_set` is set to `true` a heuristic for
optimizing the insertion of large point sets is applied.
\pre The `value_type` of `first` and `last` are `Point`s lying inside `domain`.
*/
template < class InputIterator >
std::ptrdiff_t
insert(InputIterator first, InputIterator last,
bool is_large_point_set = false);
Inserts the points in the iterator range \f$ \left[\right.\f$`first`,
`last`\f$ \left.\right)\f$. Returns the number of inserted points.
This function uses spatial sorting (cf. chapter \ref secspatial_sorting)
and therefore is not guaranteed to insert the points following the
order of `InputIterator`. If the third argument
`is_large_point_set` is set to `true` a heuristic for
optimizing the insertion of large point sets is applied.
\pre The `value_type` of `first` and `last` are `Point`s lying inside `domain`.
*/
template < class InputIterator >
std::ptrdiff_t
insert(InputIterator first, InputIterator last,
bool is_large_point_set = false);
/// @}
/// @}
/// \name Point moving
/// \name Point moving
/// @{
/*!
Moves the point stored in `v` to `p`, while preserving the Delaunay
property. This performs an action semantically equivalent to `remove(v)`
followed by `insert(p)`, but is supposedly faster when the point has
not moved much. Returns the handle to the new vertex.
\pre `p` lies in the original domain `domain`.
*/
Vertex_handle move_point(Vertex_handle v, const Point & p);
Moves the point stored in `v` to `p`, while preserving the Delaunay
property. This performs an action semantically equivalent to `remove(v)`
followed by `insert(p)`, but is supposedly faster when the point has
not moved much. Returns the handle to the new vertex.
\pre `p` lies in the original domain `domain`.
*/
Vertex_handle move_point(Vertex_handle v, const Point & p);
/// @}
/// @}
/*! \name Removal
/*! \name Removal
The following methods remove points in the triangulation.
When a vertex `v` is removed from a triangulation, all the cells
incident to `v` must be removed, and the polyhedral region consisting
of all the tetrahedra that are incident to `v` must be
re-triangulated. So, the problem reduces to triangulating a polyhedral
re-triangulated. The problem thus reduces to triangulating a polyhedral
region, while preserving its boundary, or to compute a
<I>constrained</I> triangulation. This is known to be sometimes
impossible: the Sch&ouml;nhardt polyhedron cannot be triangulated
\cgalCite{cgal:s-cgehd-98}.
However, when dealing with Delaunay triangulations, the case of such
polyhedra that cannot be re-triangulated cannot happen, so \cgal
proposes a vertex removal.
proposes a vertex removal.
*/
/// @{
/*!
Removes the vertex `v` from the triangulation. When computing in
the 27-sheeted covering space it removes all 27 copies of `v`.
*/
void remove(Vertex_handle v);
Removes the vertex `v` from the triangulation. When computing in
the 27-sheeted covering space it removes all 27 copies of `v`.
*/
void remove(Vertex_handle v);
/*!
Removes the vertices specified by the iterator range (`first, beyond`) of value type `Vertex_handle`.
`remove()` is called for each element of the range.
The number of vertices removed is returned; this number does not
account for periodic copies of removed vertices.
\pre The iterator must not iterate over several periodic copies of the same vertex, use e.g. the `Unique_vertex_iterator`.
Removes the vertices specified by the iterator range (`first, beyond`) of value type `Vertex_handle`.
`remove()` is called for each element of the range.
The number of vertices removed is returned; this number does not
account for periodic copies of removed vertices.
\pre The iterator must not iterate over several periodic copies of the same vertex, use e.g. the `Unique_vertex_iterator`.
*/
template < class InputIterator >
std::ptrdiff_t remove(InputIterator first, InputIterator beyond);
*/
template < class InputIterator >
std::ptrdiff_t remove(InputIterator first, InputIterator beyond);
/// @}
/// @}
/// \name Queries
/// \name Queries
/// @{
/*!
Returns a value indicating on which side of the circumscribed sphere
of `c` the point-offset pair (`p`,`off`) lies. More
precisely, it returns:
Returns a value indicating on which side of the circumscribed sphere
of `c` the point-offset pair (`p`,`off`) lies. More
precisely, it returns:
- `ON_BOUNDED_SIDE` if (`p`,`off`) is inside the sphere.
- `ON_BOUNDED_SIDE` if (`p`,`off`) is inside the sphere.
- `ON_BOUNDARY` if (`p`,`off`) on the boundary of the sphere.
- `ON_BOUNDARY` if (`p`,`off`) on the boundary of the sphere.
- `ON_UNBOUNDED_SIDE` if (`p`,`off`) lies outside the
sphere.
\pre `p` lies in the original domain `domain`.
*/
Bounded_side
side_of_sphere(Cell_handle c, const Point & p,
const Offset & off = Offset(0,0,0)) const;
- `ON_UNBOUNDED_SIDE` if (`p`,`off`) lies outside the
sphere.
\pre `p` lies in the original domain `domain`.
*/
Bounded_side
side_of_sphere(Cell_handle c, const Point & p,
const Offset & off = Offset(0,0,0)) const;
/*!
Returns any nearest vertex to the point `p`, or the default constructed
handle if the triangulation is empty. The optional argument `c` is a hint
specifying where to start the search. It always returns a vertex
corresponding to a point inside `domain` even if computing in a
multiply sheeted covering space.
\pre `c` is a cell of `dt` and `p` lies in the original domain `domain`.
Returns any nearest vertex to the point `p`, or the default constructed
handle if the triangulation is empty. The optional argument `c` is a hint
specifying where to start the search. It always returns a vertex
corresponding to a point inside `domain` even if computing in a
multiply sheeted covering space.
\pre `c` is a cell of `dt` and `p` lies in the original domain `domain`.
*/
Vertex_handle nearest_vertex(Point p,
Cell_handle c = Cell_handle());
*/
Vertex_handle nearest_vertex(Point p,
Cell_handle c = Cell_handle());
/*!
Returns the vertex of the cell `c` that is nearest to the
point-offset pair (`p`,`off`).
\pre `p` lies in the original domain `domain`.
*/
Vertex_handle nearest_vertex_in_cell(Cell_handle c,
Point p, Offset off = Offset(0,0,0)) const;
Returns the vertex of the cell `c` that is nearest to the
point-offset pair (`p`,`off`).
\pre `p` lies in the original domain `domain`.
*/
Vertex_handle nearest_vertex_in_cell(Cell_handle c,
Point p, Offset off = Offset(0,0,0)) const;
/// @}
/*! \name
A point-offset pair (`p`,`off`) is said to be in conflict with a cell `c` iff `dt.side_of_sphere(c, p, off)` returns `ON_BOUNDED_SIDE`. The set of cells that are in conflict with (`p`,`off`) is star-shaped.
A point-offset pair (`p`,`off`) is said to be in conflict with a cell `c` iff `dt.side_of_sphere(c, p, off)` returns `ON_BOUNDED_SIDE`. The set of cells that are in conflict with (`p`,`off`) is star-shaped.
*/
/// @{
/*!
Computes the conflict hole induced by `p`. The starting cell
`c` must be in conflict. Then this function returns
respectively in the output iterators:
Computes the conflict hole induced by `p`. The starting cell
`c` must be in conflict. Then this function returns
respectively in the output iterators:
- `cit`: the cells in conflict.
- `cit`: the cells in conflict.
- `bfit`: the facets on the boundary, that is, the facets
`(t, i)` where the cell `t` is in
conflict, but `t->neighbor(i)` is not.
- `bfit`: the facets on the boundary, that is, the facets
`(t, i)` where the cell `t` is in
conflict, but `t->neighbor(i)` is not.
- `ifit`: the facets inside the hole, that is, delimiting two
cells in conflict.
- `ifit`: the facets inside the hole, that is, delimiting two
cells in conflict.
Returns the pair composed of the resulting output iterators.
\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`.
*/
template <class OutputIteratorBoundaryFacets,
class OutputIteratorCells,
class OutputIteratorInternalFacets>
Triple<OutputIteratorBoundaryFacets,
OutputIteratorCells,
OutputIteratorInternalFacets>
find_conflicts(Point p, Cell_handle c,
OutputIteratorBoundaryFacets bfit,
OutputIteratorCells cit,
OutputIteratorInternalFacets ifit);
Returns the pair composed of the resulting output iterators.
\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`.
*/
template <class OutputIteratorBoundaryFacets,
class OutputIteratorCells,
class OutputIteratorInternalFacets>
Triple<OutputIteratorBoundaryFacets,
OutputIteratorCells,
OutputIteratorInternalFacets>
find_conflicts(Point p, Cell_handle c,
OutputIteratorBoundaryFacets bfit,
OutputIteratorCells cit,
OutputIteratorInternalFacets ifit);
/*!
Similar to `find_conflicts()`, but reports the vertices which are on the
boundary of the conflict hole of `p`, in the output iterator `res`.
Returns the resulting output iterator.
\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`.
*/
template <class OutputIterator>
OutputIterator
vertices_in_conflict(Point p, Cell_handle c,
OutputIterator res);
Similar to `find_conflicts()`, but reports the vertices which are on the
boundary of the conflict hole of `p`, in the output iterator `res`.
Returns the resulting output iterator.
\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`.
*/
template <class OutputIterator>
OutputIterator
vertices_in_conflict(Point p, Cell_handle c,
OutputIterator res);
/// @}
@@ -279,27 +272,27 @@ the Gabriel property of Delaunay faces.
/*!
*/
bool is_Gabriel(Cell_handle c, int i);
*/
bool is_Gabriel(Cell_handle c, int i);
/*!
*/
bool is_Gabriel(Cell_handle c, int i, int j);
*/
bool is_Gabriel(Cell_handle c, int i, int j);
/*!
*/
bool is_Gabriel(const Facet& f);
*/
bool is_Gabriel(const Facet& f);
/*!
*/
bool is_Gabriel(const Edge& e);
*/
bool is_Gabriel(const Edge& e);
/// @}
/// @}
/// \name Voronoi diagram
/// \name Voronoi diagram
/// \cgal offers several functions to display the Voronoi diagram of a
/// set of points in 3D. Note that a traits class providing exact
/// constructions should be used in order to guarantee the computation
@@ -308,94 +301,94 @@ bool is_Gabriel(const Edge& e);
/// @{
/*!
Returns the representative of the circumcenter of the four vertices
of c that lies in the original domain `domain`.
*/
Point dual(Cell_handle c) const;
Returns the representative of the circumcenter of the four vertices
of c that lies in the original domain `domain`.
*/
Point dual(Cell_handle c) const;
/*!
Returns the dual of facet `f`, which is a periodic segment.
*/
Periodic_segment dual(Facet f) const;
Returns the dual of facet `f`, which is a periodic segment.
*/
Periodic_segment dual(Facet f) const;
/*!
same as the previous method for facet `(c,i)`.
\pre \f$ i\in\{0,1,2,3\}\f$
*/
Periodic_segment dual(Cell_handle c, int i) const;
same as the previous method for facet `(c,i)`.
\pre \f$ i\in\{0,1,2,3\}\f$
*/
Periodic_segment dual(Cell_handle c, int i) const;
/*!
Returns in the output iterator the points of the dual polygon of
edge `e` in the same order as the `Facet_circulator` returns
facets incident to the edge `e`. The points form the dual polygon
in \f$ \mathbb R^3\f$, so they do not necessarily all lie inside the
original domain.
*/
template <class OutputIterator>
OutputIterator
dual(Edge e, OutputIterator pts) const;
Returns in the output iterator the points of the dual polygon of
edge `e` in the same order as the `Facet_circulator` returns
facets incident to the edge `e`. The points form the dual polygon
in \f$ \mathbb R^3\f$, so they do not necessarily all lie inside the
original domain.
*/
template <class OutputIterator>
OutputIterator
dual(Edge e, OutputIterator pts) const;
/*!
same as the previous method for edge `(c,i,j)`.
\pre \f$ i,j\in\{0,1,2,3\}, i\neq j\f$
*/
template <class OutputIterator>
OutputIterator
dual(Cell_handle c, int i, int j, OutputIterator pts) const;
same as the previous method for edge `(c,i,j)`.
\pre \f$ i,j\in\{0,1,2,3\}, i\neq j\f$
*/
template <class OutputIterator>
OutputIterator
dual(Cell_handle c, int i, int j, OutputIterator pts) const;
/*!
Returns in the output iterator the points of the dual polyhedron of
vertex `v` in no particular order. The points form the dual
polyhedron in \f$ \mathbb R^3\f$, so they do not necessarily lie all
inside the original domain.
*/
template <class OutputIterator>
OutputIterator
dual(Vertex_handle v, OutputIterator pts) const;
Returns in the output iterator the points of the dual polyhedron of
vertex `v` in no particular order. The points form the dual
polyhedron in \f$ \mathbb R^3\f$, so they do not necessarily lie all
inside the original domain.
*/
template <class OutputIterator>
OutputIterator
dual(Vertex_handle v, OutputIterator pts) const;
/*!
Sends the set of duals to all the facets of `dt` into `os`.
*/
template <class Stream> Stream & draw_dual(Stream & os);
Sends the set of duals to all the facets of `dt` into `os`.
*/
template <class Stream> Stream & draw_dual(Stream & os);
/*!
Returns the volume of the Voronoi cell dual to `v`.
*/
Geom_traits::FT dual_volume(Vertex_handle v) const;
Returns the volume of the Voronoi cell dual to `v`.
*/
Geom_traits::FT dual_volume(Vertex_handle v) const;
/*!
Returns the centroid of the Voronoi cell dual to `v`.
*/
Point dual_centroid(Vertex_handle v) const;
Returns the centroid of the Voronoi cell dual to `v`.
*/
Point dual_centroid(Vertex_handle v) const;
/// @}
/// @}
/// \name Checking
/// \name Checking
/// These methods are mainly a debugging help for the users of advanced features.
/// @{
/*!
Checks the combinatorial validity of the triangulation and the
validity of its geometric embedding (see
Section \ref P3Triangulation3secintro). Also checks that all the
circumscribing spheres of cells are empty.
Checks the combinatorial validity of the triangulation and the
validity of its geometric embedding (see
Section \ref P3Triangulation3secintro). Also checks that all the
circumscribing spheres of cells are empty.
When `verbose` is set to true, messages describing the first
invalidity encountered are printed.
*/
bool
is_valid(bool verbose = false) const;
When `verbose` is set to true, messages describing the first
invalidity encountered are printed.
*/
bool
is_valid(bool verbose = false) const;
/*!
Checks the combinatorial and geometric validity of the cell (see
Section \ref P3Triangulation3secintro). Also checks that the
circumscribing sphere of cells is empty.
Checks the combinatorial and geometric validity of the cell (see
Section \ref P3Triangulation3secintro). Also checks that the
circumscribing sphere of cells is empty.
When `verbose` is set to true, messages are printed to give
a precise indication of the kind of invalidity encountered.
*/
bool
is_valid(Cell_handle c, bool verbose = false) const;
When `verbose` is set to true, messages are printed to give
a precise indication of the kind of invalidity encountered.
*/
bool
is_valid(Cell_handle c, bool verbose = false) const;
/// @}
@@ -8,18 +8,19 @@ The class `Periodic_3_Delaunay_triangulation_traits_3` is designed as a default
class `Periodic_3_Delaunay_triangulation_3<Periodic_3DelaunayTriangulationTraits_3,TriangulationDataStructure_3>`.
\tparam Traits must be a model of the `DelaunayTriangulationTraits_3` concept.
\tparam Periodic_3Offset_3 must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`.
\tparam Offset must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`.
If `Traits` is a `CGAL::Filtered_kernel` (detected when `Traits::Has_filtered_predicates` exists
and is `true`), this class automatically provides filtered predicates. Similarly statically filtered predicates
and is `true`), this class automatically provides filtered predicates. Similarly, statically filtered predicates
will be used if the flag `Traits::Has_static_filters` exists and is `true`.
By default, this holds for `CGAL::Exact_predicates_inexact_constructions_kernel` and
`CGAL::Exact_predicates_exact_constructions_kernel`.
\cgalModels Periodic_3DelaunayTriangulationTraits_3
*/
template< typename Traits, typename Periodic_3Offset_3 >
class Periodic_3_Delaunay_triangulation_traits_3 : public Traits {
template< typename Traits, typename Offset >
class Periodic_3_Delaunay_triangulation_traits_3
: public Periodic_3_triangulation_traits_base_3 < Traits, Offset> {
public:
}; /* end Periodic_3_Delaunay_triangulation_traits_3 */
} /* end namespace CGAL */
@@ -0,0 +1,429 @@
namespace CGAL {
/*!
\ingroup PkgPeriodic3Triangulation3MainClasses
The class `Periodic_3_regular_triangulation_3` represents a
weighted Delaunay triangulation in three-dimensional periodic space.
\tparam PT must be a model of the concept `Periodic_3RegularTriangulationTraits_3`.
\tparam TDS must be a model of the concept `TriangulationDataStructure_3`.
Its default value is
`Triangulation_data_structure_3<Regular_triangulation_vertex_base_3<PT,Periodic_3_triangulation_ds_vertex_base_3<> >,
Regular_triangulation_cell_base_3<PT,Periodic_3_triangulation_ds_cell_base_3<>>>`.
*/
template< typename PT, typename TDS >
class Periodic_3_regular_triangulation_3 :
public Periodic_3_triangulation_3<PT, TDS>
{
public:
/// \name Types
/// @{
/*!
*/
typedef Periodic_3RegularTriangulationTraits_3::Point_3 Bare_point;
/*!
The type for points
`p` of weighted points \f$ {p}^{(w)}=(p,w_p)\f$
*/
typedef Periodic_3RegularTriangulationTraits_3::Weighted_point_3 Weighted_point;
/// @}
/// \name Creation
/// @{
/*!
Creates an empty periodic regular triangulation `rt`, with
`domain` as original domain and possibly specifying
a traits class `traits`.
\pre `domain` is a cube.
*/
Periodic_3_regular_triangulation_3(
const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1),
const Geom_traits & traits = Geom_traits());
/*!
Copy constructor.
*/
Periodic_3_regular_triangulation_3 (const
Periodic_3_regular_triangulation_3 & rt1);
/*!
Equivalent to constructing an empty triangulation with the optional
domain and traits class arguments and calling `insert(first,last)`.
\pre The `value_type` of `first` and `last` are `Weighted_point`s lying inside `domain` and `domain` is a cube.
Their weights are non-negative and smaller than 1/64 times the squared cube edge length.
If the fourth argument
`is_large_point_set` is set to `true` a heuristic for
optimizing the insertion of large point sets is applied.
*/
template < class InputIterator >
Periodic_3_regular_triangulation_3 (
InputIterator first,
InputIterator last,
const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1),
const Geom_traits & traits = Geom_traits(),
bool is_large_point_set = false);
/// @}
/// \name Access Functions
/// @{
/*!
Returns the number of hidden points.
*/
size_type number_of_hidden_points() const;
/// @}
/*! \name Insertion
The following methods insert points in the triangulation ensuring the
property that all power spheres are regular. The inserted weighted points need
to lie in the original domain (see Section \ref
P3Triangulation3secspace of the user manual). Note that insertion of a
new point can cause a switch from computing in the 27-sheeted covering
space to computing in the 1-sheeted covering space, which invalidates
some `Vertex_handle`s and `Cell_handle`s.
*/
/// @{
/*!
Inserts point `p` in the triangulation and returns the corresponding
vertex. The optional argument `start` is used as a starting place
for the point location.
If this insertion creates a vertex, this vertex is returned.
If `p` coincides with an existing vertex and has a greater weight,
then the existing weighted point becomes hidden (see
`Periodic_3RegularTriangulationCellBase_3`) and `p` replaces it as vertex
of the triangulation.
If `p` coincides with an already existing vertex (both point and
weights being equal), then this vertex is returned and the triangulation
remains unchanged.
Otherwise if `p` does not appear as a vertex of the triangulation,
then it is stored as a hidden point and this method returns the default
constructed handle.
\pre `p` lies in the original domain `domain`. Its weight is non-negative and smaller than 1/64 times the squared cube edge length.
*/
Vertex_handle insert(const Weighted_point & p,
Cell_handle start = Cell_handle() );
/*!
Inserts point `p` in the triangulation and returns the corresponding
vertex. Similar to the above `insert()` function, but takes as additional
parameter the return values of a previous location query. See description of
`Periodic_3_triangulation_3::locate()`.
\pre `p` lies in the original domain `domain`. Its weight is non-negative and smaller than 1/64 times the squared cube edge length.
*/
Vertex_handle insert(const Weighted_point & p, Locate_type lt,
Cell_handle loc, int li, int lj);
/// @}
/*! \name
The following method allows one to insert several points.
*/
/// @{
/*!
Inserts the points in the iterator range \f$ \left[\right.\f$`first`,
`last`\f$ \left.\right)\f$. Returns the number of inserted points.
This function uses spatial sorting (cf. chapter \ref secspatial_sorting)
and therefore is not guaranteed to insert the points following the
order of `InputIterator`. If the third argument
`is_large_point_set` is set to `true` a heuristic for
optimizing the insertion of large point sets is applied.
\pre The `value_type` of `first` and `last` are `Weighted_point`s
lying inside `domain`.
Their weights are non-negative and smaller than 1/64 times the
squared cube edge length.
*/
template < class InputIterator >
std::ptrdiff_t
insert(InputIterator first, InputIterator last,
bool is_large_point_set = false);
/// @}
/*! \name Removal
*/
/// @{
/*!
Removes the vertex `v` from the triangulation. When computing in
the 27-sheeted covering space it removes all 27 copies of `v`.
*/
void remove(Vertex_handle v);
/*!
Removes the vertices specified by the iterator range (`first, beyond`) of
value type `Vertex_handle`.
`remove()` is called for each element of the range.
The number of vertices removed is returned; this number does not
account for periodic copies of removed vertices.
\pre The iterator must not iterate over several periodic copies of the
same vertex, use e.g. the `Unique_vertex_iterator`.
*/
template < class InputIterator >
std::ptrdiff_t remove(InputIterator first, InputIterator beyond);
/// @}
/// \name Queries
/// @{
/*!
Returns a value indicating the position of the (weighted point, offset) pair (`p`,`off`)
with respect to the power sphere of `c`. More
precisely, it returns:
- `ON_BOUNDED_SIDE` if the angle between the weighted point (`p`,`off`)
and the power sphere of `c` is larger than \f$ \pi/2\f$ or if the ball of
(`p`,`off`) is included in the power sphere of `c`.
- `ON_BOUNDARY` if the ball (`p`,`off`) is orthogonal to the power sphere of `c`.
- `ON_UNBOUNDED_SIDE` if the angle between the weighted point (`p`,`off`)
and the power sphere of `c` is less than \f$ \pi/2\f$ or if the two balls
do not intersect.
*/
Bounded_side
side_of_power_sphere(Cell_handle c, const Weighted_point & p,
const Offset & off = Offset(0,0,0)) const;
/*!
Returns the vertex of the triangulation which is nearest to \f$ p\f$
with respect to the power distance. This means that the power
of the query point `p` with respect to the weighted point in
the returned vertex is smaller than the power of `p`
with respect to the weighted point
in any other vertex. Ties are broken arbitrarily.
It always returns a vertex
corresponding to a point inside `domain` even if computing in a
multiply sheeted covering space.
The default constructed
handle is returned if the triangulation is empty.
The optional argument `c` is a hint
specifying where to start the search.
\pre `c` is a cell of `rt` and `p` lies in the original domain `domain`.
*/
Vertex_handle nearest_power_vertex(const Bare_point & p,
Cell_handle c = Cell_handle()) const;
/// @}
/*! \name
A point-offset pair (`p`,`off`) is said to be in conflict with a cell `c` iff
`rt.side_of_power_sphere(c, p, off)` returns `ON_BOUNDED_SIDE`.
The set of cells that are in conflict with (`p`,`off`) is star-shaped.
*/
/// @{
/*!
Computes the conflict hole induced by `p`. The starting cell
`c` must be in conflict. Then this function returns
respectively in the output iterators:
- `cit`: the cells in conflict.
- `bfit`: the facets on the boundary, that is, the facets
`(t, i)` where the cell `t` is in
conflict, but `t->neighbor(i)` is not.
- `ifit`: the facets inside the hole, that is, delimiting two
cells in conflict.
Returns the `Triple` composed of the resulting output iterators.
\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`.
Its weight is non-negative and smaller than 1/64 times the squared cube edge length.
*/
template <class OutputIteratorBoundaryFacets,
class OutputIteratorCells,
class OutputIteratorInternalFacets>
Triple<OutputIteratorBoundaryFacets,
OutputIteratorCells,
OutputIteratorInternalFacets>
find_conflicts(const Weighted_point & p, Cell_handle c,
OutputIteratorBoundaryFacets bfit,
OutputIteratorCells cit,
OutputIteratorInternalFacets ifit) const;
/*!
Similar to `find_conflicts()`, but reports the vertices that are on the
boundary of the conflict hole of `p`, in the output iterator `res`.
Returns the resulting output iterator.
\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`.
Its weight is non-negative and smaller than 1/64 times the squared cube edge length.
*/
template <class OutputIterator>
OutputIterator
vertices_in_conflict(const Weighted_point & p, Cell_handle c,
OutputIterator res) const;
/// @}
/* \name
In the weighted setting, a face (cell, facet, edge or vertex) is said to be a
Gabriel face iff the smallest sphere orthogonal to the weighted points
associated to its vertices, has a positive power product with the weighted
point of any other vertex of the triangulation. Any weighted Gabriel
face belongs to the regular triangulation, but the reciprocal is not true.
The following member functions test the Gabriel property of the faces of the regular triangulation.
*/
/// @{
/*
*/
// bool is_Gabriel(Cell_handle c, int i) const;
/*
*/
// bool is_Gabriel(Cell_handle c, int i, int j) const;
/*
*/
// bool is_Gabriel(const Facet& f) const;
/*
*/
// bool is_Gabriel(const Edge& e) const;
/*
*/
// bool is_Gabriel(Vertex_handle v) const;
/// @}
/// \name Power diagram
/// \cgal offers several functions to display the Voronoi diagram of a
/// set of points in 3D. Note that a traits class providing exact
/// constructions should be used in order to guarantee the computation
/// of the Voronoi diagram (as opposed to computing the triangulation
/// only, which requires only exact predicates).
/// @{
/*!
Returns the representative of the weighted circumcenter of the four vertices
of c that lies in the original domain `domain`.
*/
Bare_point dual(Cell_handle c) const;
/*!
Returns the dual of facet `f`, which is a periodic segment.
*/
Periodic_segment_3 dual(Facet f) const;
/*!
same as the previous method for facet `(c,i)`.
\pre \f$ i\in\{0,1,2,3\}\f$
*/
Periodic_segment_3 dual(Cell_handle c, int i) const;
/*!
Returns in the output iterator the points of the dual polygon of
edge `e` in the same order as the `Facet_circulator` returns
facets incident to the edge `e`. The points form the dual polygon
in \f$ \mathbb R^3\f$, so they do not necessarily all lie inside the
original domain.
*/
template <class OutputIterator>
OutputIterator
dual(Edge e, OutputIterator pts) const;
/*!
same as the previous method for edge `(c,i,j)`.
\pre \f$ i,j\in\{0,1,2,3\}, i\neq j\f$
*/
template <class OutputIterator>
OutputIterator
dual(Cell_handle c, int i, int j, OutputIterator pts) const;
/*!
Returns in the output iterator the points of the dual polyhedron of
vertex `v` in no particular order. The points form the dual
polyhedron in \f$ \mathbb R^3\f$, so they do not necessarily lie all
inside the original domain.
*/
template <class OutputIterator>
OutputIterator
dual(Vertex_handle v, OutputIterator pts) const;
/*!
Sends the set of duals to all the facets of `rt` into `os`.
*/
template <class Stream> Stream & draw_dual(Stream & os);
/*!
Returns the volume of the cell of the power diagram dual to `v`.
*/
Geom_traits::FT dual_volume(Vertex_handle v) const;
/*!
Returns the centroid of the cell of the power diagram dual to `v`.
*/
Bare_point dual_centroid(Vertex_handle v) const;
/// @}
/// \name Checking
/// These methods are mainly a debugging help for the users of advanced features.
/// @{
/*!
Checks the combinatorial validity of the triangulation and the
validity of its geometric embedding (see
Section \ref P3Triangulation3secintro). Also checks that the power
spheres of all cells are regular.
When `verbose` is set to true, messages describing the first
invalidity encountered are printed.
*/
bool
is_valid(bool verbose = false) const;
/*!
Checks the combinatorial and geometric validity of the cell (see
Section \ref P3Triangulation3secintro). Also checks that its power
sphere is regular.
When `verbose` is set to true, messages are printed to give
a precise indication of the kind of invalidity encountered.
*/
bool
is_valid(Cell_handle c, bool verbose = false) const;
/// @}
}; /* end Periodic_3_regular_triangulation_3 */
} /* end namespace CGAL */
@@ -0,0 +1,25 @@
namespace CGAL {
/*!
\ingroup PkgPeriodic3Triangulation3TraitsClasses
The class `Periodic_3_regular_triangulation_traits_3` is designed as a default traits class for the
class `Periodic_3_regular_triangulation_3<Periodic_3RegularTriangulationTraits_3,TriangulationDataStructure_3>`.
\tparam Traits must be a model of the `RegularTriangulationTraits_3` concept.
\tparam Offset must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`.
If `Traits` is a `CGAL::Filtered_kernel` (detected when `Traits::Has_filtered_predicates` exists
and is `true`), this class automatically provides filtered predicates.
By default, this holds for `CGAL::Exact_predicates_inexact_constructions_kernel` and
`CGAL::Exact_predicates_exact_constructions_kernel`.
\cgalModels Periodic_3RegularTriangulationTraits_3
*/
template< typename Traits, typename Offset >
class Periodic_3_regular_triangulation_traits_3 :
public Periodic_3_triangulation_traits_base_3< Traits, Offset > {
public:
}; /* end Periodic_3_regular_triangulation_traits_3 */
} /* end namespace CGAL */
@@ -10,9 +10,8 @@ location queries.
\cgalHeading{Template Parameters}
It is templated by a parameter which must be instantiated by one of the \cgal periodic triangulation classes. <I>In the current
implementation, only `Periodic_3_Delaunay_triangulation_3` is
supported for `PTr`.</I>
\tparam PTr must be one of the \cgal periodic triangulation classes. <I>In the current
implementation, only `Periodic_3_Delaunay_triangulation_3` is supported for.</I>
`PTr::Vertex` has to be a model of the concept
`Periodic_3TriangulationHierarchyVertexBase_3`.
@@ -21,14 +20,14 @@ supported for `PTr`.</I>
`Periodic_3DelaunayTriangulationTraits_3`.
`Periodic_3_triangulation_hierarchy_3` offers exactly the same functionalities as `PTr`.
Most of them (point location, insertion, removal \f$ \ldots\f$ ) are overloaded to
improve their efficiency by using the hierarchic structure.
Most of these functionalities (point location, insertion, removal \f$ \ldots\f$ )
are overloaded to improve their efficiency by using the hierarchic structure.
Note that, since the algorithms that are provided are randomized, the
running time of constructing a triangulation with a hierarchy may be
improved when shuffling the data points.
However, the I/O operations are not overloaded. So, writing a
However, the I/O operations are not overloaded. Thus, writing a
hierarchy into a file will lose the hierarchic structure and reading
it from the file will result in an ordinary triangulation whose
efficiency will be the same as `PTr`.
@@ -4,23 +4,21 @@ namespace CGAL {
/*!
\ingroup PkgPeriodic3Triangulation3TraitsClasses
\warning Using this traits class for Periodic_3_Delaunay_triangulation_3 is deprecated. You should use Periodic_3_Delaunay_triangulation_traits_3 instead.
The class `Periodic_3_triangulation_traits_3` is designed as a default traits class for the
class `Periodic_3_triangulation_3<Periodic_3TriangulationTraits_3,TriangulationDataStructure_3>`.
class `Periodic_3_triangulation_3<Periodic_3TriangulationTraits_3,TriangulationDataStructure_3>`.
\tparam Traits must be a model of the `TriangulationTraits_3` concept.
\tparam Periodic_3Offset_3 must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`.
\tparam Offset must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`.
If `Traits` is a `CGAL::Filtered_kernel` (detected when `Traits::Has_filtered_predicates` exists
and is `true`), this class automatically provides filtered predicates. Similarly statically filtered predicates
and is `true`), this class automatically provides filtered predicates. Similarly, statically filtered predicates
will be used if the flag `Traits::Has_static_filters` exists and is `true`.
By default, this holds for `CGAL::Exact_predicates_inexact_constructions_kernel` and
`CGAL::Exact_predicates_exact_constructions_kernel`.
\cgalModels Periodic_3TriangulationTraits_3
*/
template< typename Traits, typename Periodic_3Offset_3 >
template< typename Traits, typename Offset >
class Periodic_3_triangulation_traits_3 : public Traits {
public:
}; /* end Periodic_3_triangulation_traits_3 */
@@ -3,24 +3,24 @@
\ingroup PkgPeriodic3Triangulation3Concepts
\cgalConcept
The concept `Periodic_3DelaunayTriangulationTraits_3` is the first template parameter of the classes
`Periodic_3_Delaunay_triangulation_3`.
It refines the concept
`DelaunayTriangulationTraits_3` from the \cgal 3D Triangulations.
It redefines the geometric objects, predicates and constructions to
work with point-offset pairs. In most cases the offsets will be
(0,0,0) and the predicates from `DelaunayTriangulationTraits_3`
can be used directly. For efficiency reasons we maintain for each
functor the version without offsets.
The concept `Periodic_3DelaunayTriangulationTraits_3` is the first template parameter
of the class `CGAL::Periodic_3_Delaunay_triangulation_3`.
It refines the concept `DelaunayTriangulationTraits_3` from the
\cgal 3D Triangulations.
It redefines the geometric objects, predicates and constructions to
work with point-offset pairs. In most cases the offsets will be
(0,0,0) and the predicates from `DelaunayTriangulationTraits_3`
can be used directly. For efficiency reasons we maintain for each
functor the version without offsets.
\cgalRefines Periodic_3TriangulationTraits_3
\cgalRefines DelaunayTriangulationTraits_3
\cgalHasModel CGAL::Periodic_3_Delaunay_triangulation_traits_3
\cgalHasModel CGAL::Periodic_3_Delaunay_triangulation_traits_3
In addition to the requirements described for the traits class
DelaunayTriangulationTraits_3, the geometric traits class of a
Periodic Delaunay triangulation must fulfill the following
In addition to the requirements described for the traits class
DelaunayTriangulationTraits_3, the geometric traits class of a
Periodic Delaunay triangulation must fulfill the following
requirements.
\note The optional types must be provided in any case, however they
@@ -34,42 +34,42 @@ public:
/// @{
/*!
A predicate object that must provide the function operators
A predicate object that must provide the function operators
`Oriented_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t)`,
`Oriented_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t)`,
which determines on which side of the oriented sphere circumscribing
`p, q, r, s` the point `t` lies and
which determines on which side of the oriented sphere circumscribing
`p, q, r, s` the point `t` lies and
`Oriented_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_t)`,
`Oriented_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_t)`,
which determines on which side of the oriented sphere circumscribing
`(p,o_p), (q,o_q), (r,o_r), (s,o_s)` the point-offset pair
`(t,o_t)` lies.
\pre `p`, `q`, `r`, `s`, `t` lie inside the domain.
*/
typedef unspecified_type Side_of_oriented_sphere_3;
which determines on which side of the oriented sphere circumscribing
`(p,o_p), (q,o_q), (r,o_r), (s,o_s)` the point-offset pair
`(t,o_t)` lies.
\pre `p`, `q`, `r`, `s`, `t` lie inside the domain.
*/
typedef unspecified_type Side_of_oriented_sphere_3;
/*!
A predicate object that must provide the function operators
A predicate object that must provide the function operators
`Comparison_result operator()(Point_3 p, Point_3 q, Point_3 r)`,
`Comparison_result operator()(Point_3 p, Point_3 q, Point_3 r)`,
which compares the distance between `p` and `q` to the distance
between `p` and `r` and
which compares the distance between `p` and `q` to the distance
between `p` and `r` and
`Comparison_result operator()(Point_3 p, Point_3 q, Point_3 r, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`,
`Comparison_result operator()(Point_3 p, Point_3 q, Point_3 r, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`,
which compares the distance between `(p,o_p)` and `(q,o_q)` to
the distance between `(p,o_p)` and `(r,o_r)`.
\pre `p`, `q`, `r` lie inside the domain.
*/
typedef unspecified_type Compare_distance_3;
which compares the distance between `(p,o_p)` and `(q,o_q)` to
the distance between `(p,o_p)` and `(r,o_r)`.
\pre `p`, `q`, `r` lie inside the domain.
*/
typedef unspecified_type Compare_distance_3;
/// @}
/// \name
/// In addition, only when vertex removal is used, the traits class must provide the following predicate objects
/// When vertex removal is used, the traits class must in addition provide the following predicate objects
/// @{
/*!
@@ -110,101 +110,86 @@ typedef unspecified_type Coplanar_side_of_bounded_circle_3;
/// @}
/// \name
/// In addition, only when `is_Gabriel` is used, the traits class must
/// provide the following predicate object:
/// When `is_Gabriel` is used, the traits class must
/// in addition provide the following predicate object:
/// @{
/*!
A predicate object that must provide the function operators
A predicate object that must provide the function operators
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 t)`,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 t)`,
which returns the position of the point `t` relative to the sphere
that has `pq` as its diameter,
which returns the position of the point `t` relative to the sphere
that has `pq` as its diameter,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_t)`,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_t)`,
which returns the position of the point-offset pair `(t,o_t)`
relative to the sphere that has `(p,o_p)(q,o_q)` as its diameter,
which returns the position of the point-offset pair `(t,o_t)`
relative to the sphere that has `(p,o_p)(q,o_q)` as its diameter,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 t)`,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 t)`,
which returns the position of the point `t` relative to the sphere
passing through `p, q`, and `r` and whose center is in the
plane defined by these three points,
which returns the position of the point `t` relative to the sphere
passing through `p, q`, and `r` and whose center is in the
plane defined by these three points,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_q)`,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_q)`,
which returns the position of the point-offset pair `(t,o_t)`
relative to the sphere passing through `(p,o_p), (q,o_q)`, and
`(r,o_r)` and whose center is in the plane defined by these three
point-offset pairs,
which returns the position of the point-offset pair `(t,o_t)`
relative to the sphere passing through `(p,o_p), (q,o_q)`, and
`(r,o_r)` and whose center is in the plane defined by these three
point-offset pairs,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t)`,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t)`,
which returns the relative position of point `t` to the sphere
defined by `p, q, r`, and `s`; the order of the points `p, q, r`, and `s` does not matter, and
which returns the relative position of point `t` to the sphere
defined by `p, q, r`, and `s`; the order of the points `p, q, r`, and `s` does not matter, and
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_q)`,
`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_q)`,
which returns the relative position of the point-offset pair
`(t,o_t)` to the sphere defined by `(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)`; the order of the point-offset pairs
`(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)` does not matter.
\pre `p, q, r`, and `s` are not coplanar, `(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)` are not coplanar, `p`, `q`, `r`, `s`, `t` lie inside the domain.
*/
typedef unspecified_type Side_of_bounded_sphere_3;
which returns the relative position of the point-offset pair
`(t,o_t)` to the sphere defined by `(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)`; the order of the point-offset pairs
`(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)` does not matter.
\pre `p, q, r`, and `s` are not coplanar, `(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)` are not coplanar, `p`, `q`, `r`, `s`, `t` lie inside the domain.
*/
typedef unspecified_type Side_of_bounded_sphere_3;
/// @}
/// \name
/// In addition, only when the dual operations are used, the traits
/// class must provide the following constructor object:
/// When the dual operations are used, the traits
/// class must in addition provide the following constructor object:
/// @{
/*!
A constructor object that must provide the function operators
A constructor object that must provide the function operators
`Point_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`,
`Point_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`,
which constructs the circumcenter of four points and
which constructs the circumcenter of four points and
`Point_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`,
`Point_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`,
which constructs the circumcenter of four point-offset pairs.
\pre `p`, `q`, `r` and `s` as well as `(p,o_p)`, `(q,o_q)`, `(r,o_r)` and `(s,o_s)` must be non coplanar. `p`, `q`, `r`, `s` lie inside the domain.
*/
typedef unspecified_type Construct_circumcenter_3;
which constructs the circumcenter of four point-offset pairs.
\pre `p`, `q`, `r` and `s` as well as `(p,o_p)`, `(q,o_q)`, `(r,o_r)` and `(s,o_s)` must be non coplanar. `p`, `q`, `r`, `s` lie inside the domain.
*/
typedef unspecified_type Construct_circumcenter_3;
/// @}
/// @}
/// \name Creation
/// @{
/*!
Default constructor.
*/
Periodic_3_Delaunay_triangulation_traits_3();
/*!
Copy constructor.
*/
Periodic_3_Delaunay_triangulation_traits_3(const Periodic_triangulation_traits_3 & tr);
/// @}
/// \name Operations
/// \name Operations
/// The following functions give access to the predicate and construction objects:
/// @{
/*!
*/
Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object();
*/
Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object();
/*!
*/
Compare_distance_3 compare_distance_3_object();
*/
Compare_distance_3 compare_distance_3_object();
/// @}
@@ -227,20 +212,20 @@ coplanar_side_of_bounded_circle_3_object();
/// @}
/// \name
/// The following function must be provided only if the `is_Gabriel`
/// The following function must be provided if the `is_Gabriel`
/// methods of `Periodic_3_Delaunay_triangulation_3` are used;
/// otherwise a dummy function can be provided.
/// @{
/*!
*/
Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object();
*/
Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object();
/// @}
/// \name
/// The following function must be provided only if the methods of
/// \name
/// The following function must be provided if the methods of
/// `Periodic_3_Delaunay_triangulation_3` returning elements of the
/// Voronoi diagram are used; otherwise a dummy function can be
/// provided:
@@ -248,8 +233,8 @@ Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object();
/*!
*/
Construct_circumcenter_3 construct_circumcenter_3_object();
*/
Construct_circumcenter_3 construct_circumcenter_3_object();
/// @}
@@ -3,119 +3,120 @@
\ingroup PkgPeriodic3Triangulation3Concepts
\cgalConcept
The concept `Periodic_3Offset_3` describes a three-dimensional integer vector
with some specialized access functions and operations.
The concept `Periodic_3Offset_3` describes a three-dimensional integer vector
with some specialized access functions and operations.
\cgalHasModel CGAL::Periodic_3_offset_3
\sa `Periodic_3DelaunayTriangulationTraits_3`
\cgalHasModel CGAL::Periodic_3_offset_3
\sa `Periodic_3TriangulationTraits_3`
\sa `Periodic_3DelaunayTriangulationTraits_3`
\sa `Periodic_3RegularTriangulationTraits_3`
*/
class Periodic_3Offset_3 {
public:
/// \name Creation
/// \name Creation
/// @{
/*!
Default constructor.
*/
Periodic_3Offset_3();
Default constructor.
*/
Periodic_3Offset_3();
/*!
Constructs the offset (x,y,z).
*/
Periodic_3Offset_3(int x, int y, int z);
Constructs the offset (x,y,z).
*/
Periodic_3Offset_3(int x, int y, int z);
/// @}
/// @}
/// \name Operations
/// \name Operations
/// @{
/*!
Return the vector sum of `o` and `other`.
*/
Periodic_3Offset_3 operator+(const Periodic_3Offset_3 & other)
const;
Return the vector sum of `o` and `other`.
*/
Periodic_3Offset_3 operator+(const Periodic_3Offset_3 & other)
const;
/*!
Return the vector difference of `o` and `other`.
*/
Periodic_3Offset_3 operator-(const Periodic_3Offset_3 & other)
const;
Return the vector difference of `o` and `other`.
*/
Periodic_3Offset_3 operator-(const Periodic_3Offset_3 & other)
const;
/*!
Return the negative vector of `o`.
*/
Periodic_3Offset_3 operator-() const;
Return the negative vector of `o`.
*/
Periodic_3Offset_3 operator-() const;
/*!
Add `other` to `o` using vector addition.
*/
void operator+=(const Periodic_3Offset_3 & other)
const;
Add `other` to `o` using vector addition.
*/
void operator+=(const Periodic_3Offset_3 & other)
const;
/*!
Subtract `other` from `o` using vector subtraction.
*/
void operator-=(const Periodic_3Offset_3 & other)
const;
Subtract `other` from `o` using vector subtraction.
*/
void operator-=(const Periodic_3Offset_3 & other)
const;
/*!
Return `true` if `other` and `o` represent the same vector.
*/
bool operator==(const Periodic_3Offset_3 & other) const;
Return `true` if `other` and `o` represent the same vector.
*/
bool operator==(const Periodic_3Offset_3 & other) const;
/*!
Return `true` if `other` and `o` do not represent the same
vector.
*/
bool operator!=(const Periodic_3Offset_3 & other) const;
Return `true` if `other` and `o` do not represent the same
vector.
*/
bool operator!=(const Periodic_3Offset_3 & other) const;
/*!
Compare `o` and `other` lexicographically.
*/
bool operator<(const Periodic_3Offset_3 & other) const;
Compare `o` and `other` lexicographically.
*/
bool operator<(const Periodic_3Offset_3 & other) const;
/// @}
/// @}
/// \name Access Functions
/// \name Access Functions
/// @{
/*!
Return the \f$ i\f$-th entry of `o`.
*/
int operator[](int i);
Return the \f$ i\f$-th entry of `o`.
*/
int operator[](int i);
/*!
Return the \f$ x\f$-entry of `o`.
*/
int x() const;
Return the \f$ x\f$-entry of `o`.
*/
int x() const;
/*!
Return the \f$ y\f$-entry of `o`.
*/
int y() const;
Return the \f$ y\f$-entry of `o`.
*/
int y() const;
/*!
Return the \f$ z\f$-entry of `o`.
*/
int z();
Return the \f$ z\f$-entry of `o`.
*/
int z();
/*!
Returns `true` if `o` is equal to (0,0,0).
*/
bool is_null() const;
Returns `true` if `o` is equal to (0,0,0).
*/
bool is_null() const;
/*!
Inputs an offset from `is`.
*/
istream& operator>>(istream & is, Periodic_3_offset_3 & off);
Inputs an offset from `is`.
*/
istream& operator>>(istream & is, Periodic_3_offset_3 & off);
/*!
Outputs an offset from `os`.
*/
Outputs an offset from `os`.
*/
ostream& operator<<(ostream & os, Periodic_3_offset_3 & off) const;
/// @}
@@ -0,0 +1,26 @@
/*!
\ingroup PkgPeriodic3Triangulation3Concepts
\cgalConcept
\cgalRefines `RegularTriangulationCellBase_3`
\cgalRefines `Periodic_3TriangulationDSCellBase_3`
\cgalHasModel CGAL::Regular_triangulation_cell_base_3<Periodic_3RegularTriangulationTraits_3,
Periodic_3_triangulation_ds_cell_base_3< > >
\cgalHasModel CGAL::Regular_triangulation_cell_base_with_weighted_circumcenter_3<Periodic_3RegularTriangulationTraits_3,
Periodic_3_triangulation_ds_cell_base_3< > >
The template parameter `Periodic_3RegularTriangulationTraits_3` is expected to be the same as the
traits class used in `CGAL::Periodic_3_regular_triangulation_3`.
\sa `TriangulationDataStructure_3`
\sa `Periodic_3RegularTriangulationDSVertexBase_3`
*/
class Periodic_3RegularTriangulationDSCellBase_3 {
public:
}; /* end Periodic_3RegularTriangulationDSCellBase_3 */
@@ -0,0 +1,24 @@
/*!
\ingroup PkgPeriodic3Triangulation3Concepts
\cgalConcept
\cgalRefines `RegularTriangulationVertexBase_3`
\cgalRefines `Periodic_3TriangulationDSVertexBase_3`
\cgalHasModel CGAL::Regular_triangulation_vertex_base_3<Periodic_3RegularTriangulationTraits_3,
Periodic_3_triangulation_ds_vertex_base_3< > >
The template parameter `Periodic_3RegularTriangulationTraits_3` is expected to be the same as the
traits class used in `CGAL::Periodic_3_regular_triangulation_3`.
\sa `TriangulationDataStructure_3`
\sa `Periodic_3RegularTriangulationDSCellBase_3`
*/
class Periodic_3RegularTriangulationDSVertexBase_3 {
public:
}; /* end Periodic_3RegularTriangulationDSVertexBase_3 */
@@ -0,0 +1,222 @@
/*!
\ingroup PkgPeriodic3Triangulation3Concepts
\cgalConcept
The concept `Periodic_3RegularTriangulationTraits_3` is the first template parameter
of the class `CGAL::Periodic_3_regular_triangulation_3`.
It refines the concept
`RegularTriangulationTraits_3` from the \cgal 3D Triangulations.
It redefines the geometric objects, predicates and constructions to
work with point-offset pairs. In most cases the offsets will be
(0,0,0) and the predicates from `RegularTriangulationTraits_3`
can be used directly. For efficiency reasons we maintain for each
functor the version without offsets.
\cgalRefines Periodic_3TriangulationTraits_3
\cgalRefines RegularTriangulationTraits_3
\cgalHasModel CGAL::Periodic_3_regular_triangulation_traits_3
In addition to the requirements described for the traits class
RegularTriangulationTraits_3, the geometric traits class of a
periodic regular triangulation must fulfill the following
requirements.
\note The optional types must be provided in any case, however they
can be replaced by dummy types if the respective functions are not
used.
*/
class Periodic_3RegularTriangulationTraits_3 {
public:
/// \name
/// @{
/*!
A predicate object that must provide the function operators:
`Oriented_side operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s, Weighted_point_3 t)`,
which determines the position of `t` with respect to the power sphere of `p, q, r, s`.
`Oriented_side operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s, Weighted_point_3 t,
Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_t)`,
which is the same for the point-offset pair `(t,o_t)` with respect to the power sphere of the point-offset pairs
`(p,o_p), (q,o_q), (r,o_r), (s,o_s)`.
\pre `p`, `q`, `r`, `s`, `t` lie inside the domain and `p, q, r, s` are not coplanar.
<HR WIDTH=50%>
When vertex removal is used, the predicate must in addition provide the following function operators:
`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 t)`,
which has a definition similar to the previous method, for coplanar points,
with the power circle of `p,q,r`.
`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 t,
Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_t)`,
which is the same for point-offset pairs.
\pre `p`, `q`, `r`, `t` lie inside the domain, `p, q, r` are not collinear, and `p, q, r, t` are coplanar.
`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 t)`,
which is the same for collinear points, and the power segment of `p` and `q`,
`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 t,
Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_t)`,
which is the same for point-offset pairs.
\pre `p`, `q`, `t` lie inside the domain, `p` and `q` have different Bare_points, and `p, q, t` are collinear.
`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q)`,
which is the same for equal points, that is when `p` and `q`
have equal coordinates, then it returns the comparison of the weights.
`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q,
Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`,
which is the same for point-offset pairs.
\pre `p` and `q` lie inside the domain and have equal Bare_points.
*/
typedef unspecified_type Power_side_of_oriented_power_sphere_3;
/// @}
/// \name
/// @{
/*!
A predicate object that must provide the function operators:
`Orientation operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s, FT w)`,
which compares the weight of the smallest sphere orthogonal to the input weighted
points with the input weight `w` and returns a `SMALLER`, `EQUAL`, or `LARGER`.
\pre `p`, `q`, `r`, and `s` lie inside the domain.
*/
typedef unspecified_type Compare_weighted_squared_radius_3;
/// @}
/// \name
/// @{
/*!
A predicate object, model of `ComparePowerDistance_3`, that must provide
the function operator
`Comparison_result operator()(Point_3 p, Weighted_point_3 q, Weighted_point_3 r)`,
which compares the power distance between `p` and `q` to the power distance
between `p` and `r` and
`Comparison_result operator()(Point_3 p, Weighted_point_3 q, Weighted_point_3 r,
Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`,
which is the same for point-offset pairs.
\note This predicate is required if a call to `nearest_power_vertex()` or
`nearest_power_vertex_in_cell()` is issued.*/
typedef unspecified_type Compare_power_distance_3;
/// @}
/// \name
/// When vertex removal is used, the traits class must in addition provide the following predicate object
/// @{
/*!
A predicate object that must provide the function operators:
`Orientation operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r)`,
which returns `COLLINEAR`, if the points are collinear; otherwise
it must return a consistent orientation for any three points chosen in
a same plane and
`Orientation operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r,
Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`,
which is the same for point-offset pairs.
\pre `p`, `q`, `r` lie inside the domain.
*/
typedef unspecified_type Coplanar_orientation_3;
/// @}
/// \name
/// When the dual operations are used, the traits
/// class must in addition provide the following constructor object:
/// @{
/*!
A constructor object that must provide the function operators:
`Weighted_point_3 operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s)`,
which constructs the weighted circumcenter of four points and
`Weighted_point_3 operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s,
Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`,
which constructs the weighted circumcenter of four point-offset pairs.
\pre `p`, `q`, `r` and `s` as well as `(p,o_p)`, `(q,o_q)`, `(r,o_r)` and `(s,o_s)` must be non coplanar. `p`, `q`, `r`, `s` lie inside the domain.
*/
typedef unspecified_type Construct_weighted_circumcenter_3;
/// @}
/// \name Operations
/// The following functions give access to the predicate and construction objects:
/// @{
/*!
*/
Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere_3_object();
Compare_weighted_squared_radius_3 compare_weighted_squared_radius_3_object();
/// @}
/// \name
/// The following function must be provided if vertex removal is
/// used; otherwise dummy functions can be provided.
/// @{
/*!
*/
Coplanar_orientation_3 coplanar_3_orientation_3_object();
/// @}
/// \name
/// The following function must be provided only if the methods of
/// `Periodic_3_regular_triangulation_3` returning elements of the
/// Voronoi diagram are used; otherwise a dummy function can be
/// provided.
/// @{
/*!
*/
Construct_weighted_circumcenter_3 construct_weighted_circumcenter_3_object();
/// @}
}; /* end Periodic_3RegularTriangulationTraits_3 */
@@ -6,47 +6,47 @@
A refinement of the concept `TriangulationDSCellBase_3`
which adds an API for offsets.
At the base level (see Sections \ref P3Triangulation3secdesign
and \ref TDS3secdesign), a cell stores handles to its four vertices
and to its four neighbor cells. The vertices and neighbors are
indexed 0, 1, 2 and 3. Neighbor `i` lies opposite to vertex `i`.
At the base level (see Sections \ref P3Triangulation3secdesign
and \ref TDS3secdesign), a cell stores handles to its four vertices
and to its four neighbor cells. The vertices and neighbors are
indexed 0, 1, 2 and 3. Neighbor `i` lies opposite to vertex `i`.
For periodic triangulation the cell base class needs to
For periodic triangulations, the cell base class needs to
additionally store an offset for each vertex. Only the last three
bits of each integer are required to be stored. The remaining part
does not contain any information.
\cgalRefines `TriangulationDSCellBase_3`
\cgalRefines `TriangulationDSCellBase_3`
\cgalHasModel CGAL::Periodic_3_triangulation_ds_cell_base_3
\cgalHasModel CGAL::Periodic_3_triangulation_ds_cell_base_3
\sa `TriangulationDataStructure_3`
\sa `TriangulationDSCellBase_3`
\sa `Periodic_3TriangulationDSVertexBase_3`
\sa `TriangulationDataStructure_3`
\sa `TriangulationDSCellBase_3`
\sa `Periodic_3TriangulationDSVertexBase_3`
*/
class Periodic_3TriangulationDSCellBase_3 {
public:
/// \name Access Functions
/// \name Access Functions
/// @{
/*!
Returns the offset of vertex `i`.
\pre \f$ i \in\{0, 1, 2, 3\}\f$.
*/
int offset(int i) const;
Returns the offset of vertex `i`.
\pre \f$ i \in\{0, 1, 2, 3\}\f$.
*/
int offset(int i) const;
/// @}
/// @}
/// \name Setting
/// \name Setting
/// @{
/*!
Sets the vertex offsets according to `off0` to `off3`.
*/
void set_offsets(int off0, int off1, int off2, int off3);
Sets the vertex offsets according to `off0` to `off3`.
*/
void set_offsets(int off0, int off1, int off2, int off3);
/// @}
@@ -3,63 +3,58 @@
\ingroup PkgPeriodic3Triangulation3Concepts
\cgalConcept
A refinement of the concept `TriangulationDSVertexBase_3`
A refinement of the concept `TriangulationDSVertexBase_3`
which adds an API for offset.
At the base level of 3D-triangulations
(see Sections \ref P3Triangulation3secdesign and \ref TDS3secdesign),
a vertex provides access to one of its incident cells through a handle.
At the base level of 3D-triangulations
(see Sections \ref P3Triangulation3secdesign and \ref TDS3secdesign),
a vertex provides access to one of its incident cells through a handle.
\cgalRefines `TriangulationDSVertexBase_3`
\cgalHasModel CGAL::Periodic_3_triangulation_ds_vertex_base_3
\cgalRefines `TriangulationDSVertexBase_3`
\cgalHasModel CGAL::Periodic_3_triangulation_ds_vertex_base_3
\sa `TriangulationDataStructure_3`
\sa `TriangulationDSVertexBase_3`
\sa `Periodic_3TriangulationDSCellBase_3`
\sa `TriangulationDataStructure_3`
\sa `TriangulationDSVertexBase_3`
\sa `Periodic_3TriangulationDSCellBase_3`
*/
class Periodic_3TriangulationDSVertexBase_3 {
public:
/// \name Types
/// \name Types
/// @{
/*!
A model of the concept
`Periodic_3Offset_3`
*/
typedef unspecified_type Periodic_3_offset_3;
A model of the concept `Periodic_3Offset_3`
*/
typedef unspecified_type Periodic_3_offset_3;
/// @}
/// @}
/// \name Access Functions
/// \name Access Functions
/// @{
/*!
Returns the offset stored in the vertex.
*/
Periodic_3_offset_3 offset() const;
Returns the offset stored in the vertex.
*/
Periodic_3_offset_3 offset() const;
/*!
Returns `true` if the offset has been set, `false` otherwise.
*/
bool get_offset_flag() const;
Returns `true` if the offset has been set, `false` otherwise.
*/
bool get_offset_flag() const;
/*!
Sets the offset and sets the offset flag to `true`.
*/
void set_offset(Periodic_3_offset_3 o);
Sets the offset and sets the offset flag to `true`.
*/
void set_offset(Periodic_3_offset_3 o);
/*!
Sets the offset flag to `false` and clears the offset.
*/
void clear_offset();
Sets the offset flag to `false` and clears the offset.
*/
void clear_offset();
/// @}
@@ -4,19 +4,22 @@
\cgalConcept
The concept `Periodic_3TriangulationTraits_3` is the first template parameter of the class
`Periodic_3_triangulation_3`. It refines the concept
`Periodic_3_triangulation_3`. It refines the concept
`TriangulationTraits_3` from the \cgal 3D Triangulations.
It redefines the geometric objects, predicates and constructions to
work with point-offset pairs. In most cases the offsets will be
It redefines the geometric objects, predicates and constructions to
work with point-offset pairs. In most cases the offsets will be
(0,0,0) and the predicates from `TriangulationTraits_3`
can be used directly. For efficiency reasons we maintain for each
functor the version without offsets.
can be used directly. For efficiency reasons we maintain for each
functor the version without offsets.
\cgalRefines TriangulationTraits_3
\cgalHasModel CGAL::Periodic_3_triangulation_traits_3
In addition to the requirements described for the traits class
\sa Periodic_3DelaunayTriangulationTraits_3
\sa Periodic_3RegularTriangulationTraits_3
In addition to the requirements described for the traits class
TriangulationTraits_3, the geometric traits class of a
Periodic triangulation must fulfill the following
requirements.
@@ -24,31 +27,31 @@ requirements.
class Periodic_3TriangulationTraits_3 {
public:
/// \name Types
/// \name Types
/// @{
/*!
The point type. It must be a model of `Kernel::Point_3`.
*/
typedef unspecified_type Point_3;
The point type. It must be a model of `Kernel::Point_3`.
*/
typedef unspecified_type Point_3;
/*!
The vector type. It must be a model of
`Kernel::Vector_3`.
*/
typedef unspecified_type Vector_3;
The vector type. It must be a model of
`Kernel::Vector_3`.
*/
typedef unspecified_type Vector_3;
/*!
The offset type. It must be a
model of the concept `Periodic_3Offset_3`.
*/
typedef unspecified_type Periodic_3_offset_3;
The offset type. It must be a
model of the concept `Periodic_3Offset_3`.
*/
typedef unspecified_type Periodic_3_offset_3;
/*!
A type representing an axis-aligned
cuboid. It must be a model of `Kernel::Iso_cuboid_3`.
*/
typedef unspecified_type Iso_cuboid_3;
A type representing an axis-aligned
cuboid. It must be a model of `Kernel::Iso_cuboid_3`.
*/
typedef unspecified_type Iso_cuboid_3;
/// @}
@@ -60,161 +63,159 @@ typedef unspecified_type Iso_cuboid_3;
/// @{
/*!
A segment type. It must be a model of `Kernel::Segment_3`.
*/
typedef unspecified_type Segment_3;
A segment type. It must be a model of `Kernel::Segment_3`.
*/
typedef unspecified_type Segment_3;
/*!
A triangle type. It must be a model of
`Kernel::Triangle_3`.
*/
typedef unspecified_type Triangle_3;
A triangle type. It must be a model of
`Kernel::Triangle_3`.
*/
typedef unspecified_type Triangle_3;
/*!
A tetrahedron type. It must be a model
of `Kernel::Tetrahedron_3`.
*/
typedef unspecified_type Tetrahedron_3;
A tetrahedron type. It must be a model
of `Kernel::Tetrahedron_3`.
*/
typedef unspecified_type Tetrahedron_3;
/*!
A predicate object that must provide the function operators
A predicate object that must provide the function operators
`Comparison_result operator()(Point_3 p, Point_3 q)`,
`Comparison_result operator()(Point_3 p, Point_3 q)`,
which returns `EQUAL` if the two points are equal and
which returns `EQUAL` if the two points are equal and
`Comparison_result operator()(Point_3 p, Point_3 q, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`,
`Comparison_result operator()(Point_3 p, Point_3 q, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`,
which returns `EQUAL` if the two point-offset pairs are equal.
Otherwise it must return a consistent order for any two points chosen
in a same line.
\pre `p`, `q` lie inside the domain.
*/
typedef unspecified_type Compare_xyz_3;
which returns `EQUAL` if the two point-offset pairs are equal.
Otherwise it must return a consistent order for any two points chosen
in a same line.
\pre `p`, `q` lie inside the domain.
*/
typedef unspecified_type Compare_xyz_3;
/*!
A predicate object that must provide the function operators
A predicate object that must provide the function operators
`Orientation operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`,
`Orientation operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`,
which returns `POSITIVE`, if `s` lies on the positive side of
the oriented plane `h` defined by `p`, `q`, and `r`,
returns `NEGATIVE` if `s` lies on the negative side of
`h`, and returns `COPLANAR` if `s` lies on `h` and
which returns `POSITIVE`, if `s` lies on the positive side of
the oriented plane `h` defined by `p`, `q`, and `r`,
returns `NEGATIVE` if `s` lies on the negative side of
`h`, and returns `COPLANAR` if `s` lies on `h` and
`Orientation operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`,
`Orientation operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`,
which returns `POSITIVE`, if the point-offset pair `(s,o_s)`
lies on the positive side of the oriented plane `h` defined by
`(p,o_p)`, `(q,o_q)`, and `(r,o_r)`,
returns `NEGATIVE` if `(s,o_s)` lies on the negative side of
`h`, and returns `COPLANAR` if `(s,o_s)` lies on `h`.
\pre `p`, `q`, `r`, `s` lie inside the domain.
*/
typedef unspecified_type Orientation_3;
which returns `POSITIVE`, if the point-offset pair `(s,o_s)`
lies on the positive side of the oriented plane `h` defined by
`(p,o_p)`, `(q,o_q)`, and `(r,o_r)`,
returns `NEGATIVE` if `(s,o_s)` lies on the negative side of
`h`, and returns `COPLANAR` if `(s,o_s)` lies on `h`.
\pre `p`, `q`, `r`, `s` lie inside the domain.
*/
typedef unspecified_type Orientation_3;
/// @}
/// \name
/// \name
/// Note that the traits must provide exact constructions in order to
/// guarantee exactness of the following construction functors.
/// @{
/*!
A constructor object that must provide the function operator
A constructor object that must provide the function operator
`Point_3 operator()(Point_3 p, Periodic_3_offset_3 o_p)`,
`Point_3 operator()(Point_3 p, Periodic_3_offset_3 o_p)`,
which constructs a point from a point-offset pair.
\pre `p` lies inside the domain.
*/
typedef unspecified_type Construct_point_3;
which constructs a point from a point-offset pair.
\pre `p` lies inside the domain.
*/
typedef unspecified_type Construct_point_3;
/*!
A constructor object that must provide the function operators
A constructor object that must provide the function operators
`Segment_3 operator()(Point_3 p, Point_3 q)`,
`Segment_3 operator()(Point_3 p, Point_3 q)`,
which constructs a segment from two points and
which constructs a segment from two points and
`Segment_3 operator()(Point_3 p, Point_3 q, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`,
`Segment_3 operator()(Point_3 p, Point_3 q, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`,
which constructs a segment from two point-offset pairs.
\pre `p`, `q` lie inside the domain.
*/
typedef unspecified_type Construct_segment_3;
which constructs a segment from two point-offset pairs.
\pre `p`, `q` lie inside the domain.
*/
typedef unspecified_type Construct_segment_3;
/*!
A constructor object that must provide the function operators
A constructor object that must provide the function operators
`Triangle_3 operator()(Point_3 p, Point_3 q, Point_3 r )`,
`Triangle_3 operator()(Point_3 p, Point_3 q, Point_3 r )`,
which constructs a triangle from three points and
which constructs a triangle from three points and
`Triangle_3 operator()(Point_3 p, Point_3 q, Point_3 r, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`,
`Triangle_3 operator()(Point_3 p, Point_3 q, Point_3 r, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`,
which constructs a triangle from three point-offset pairs.
\pre `p`, `q`, `r` lie inside the domain.
*/
typedef unspecified_type Construct_triangle_3;
which constructs a triangle from three point-offset pairs.
\pre `p`, `q`, `r` lie inside the domain.
*/
typedef unspecified_type Construct_triangle_3;
/*!
A constructor object that must provide the function operators
A constructor object that must provide the function operators
`Tetrahedron_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`,
`Tetrahedron_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`,
which constructs a tetrahedron from four points and
which constructs a tetrahedron from four points and
`Tetrahedron_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`,
`Tetrahedron_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`,
which constructs a tetrahedron from four point-offset pairs.
\pre `p`, `q`, `r`, `s` lie inside the domain.
*/
typedef unspecified_type Construct_tetrahedron_3;
which constructs a tetrahedron from four point-offset pairs.
\pre `p`, `q`, `r`, `s` lie inside the domain.
*/
typedef unspecified_type Construct_tetrahedron_3;
/// @}
/// \name Creation
/// \name Creation
/// @{
/*!
Default constructor.
*/
Default constructor.
*/
Periodic_3_triangulation_traits_3();
/*!
Copy constructor.
*/
Copy constructor.
*/
Periodic_3_triangulation_traits_3(const Periodic_triangulation_traits_3 & tr);
/// @}
/// @}
/// \name Access Functions
/// \name Access Functions
/// @{
/*!
Set the size of the
fundamental domain. This is necessary to evaluate predicates
correctly.
\pre `domain` represents a cube.
*/
void set_domain(Iso_cuboid_3 domain);
Set the fundamental domain. This is necessary to evaluate predicates correctly.
\pre `domain` represents a cube.
*/
void set_domain(const Iso_cuboid_3& domain);
/// @}
/// @}
/// \name Operations
/// \name Operations
/// The following functions give access to the predicate and construction objects:
/// @{
/*!
*/
Compare_xyz_3 compare_xyz_3_object();
*/
Compare_xyz_3 compare_xyz_3_object();
/*!
*/
Orientation_3 orientation_3_object();
*/
Orientation_3 orientation_3_object();
/// @}
@@ -222,18 +223,18 @@ Orientation_3 orientation_3_object();
/*!
*/
Construct_segment_3 construct_segment_3_object();
*/
Construct_segment_3 construct_segment_3_object();
/*!
*/
Construct_triangle_3 construct_triangle_3_object();
*/
Construct_triangle_3 construct_triangle_3_object();
/*!
*/
Construct_tetrahedron_3 construct_tetrahedron_3_object();
*/
Construct_tetrahedron_3 construct_tetrahedron_3_object();
/// @}
@@ -11,12 +11,16 @@
/*!
\addtogroup PkgPeriodic3Triangulation3
\todo check generated documentation
\cgalPkgDescriptionBegin{3D Periodic Triangulations,PkgPeriodic3Triangulation3Summary}
\cgalPkgPicture{p3Delaunay3_small.jpg}
\cgalPkgSummaryBegin
\cgalPkgAuthors{Manuel Caroli and Monique Teillaud}
\cgalPkgDesc{This package allows to build and handle triangulations of point sets in the three dimensional flat torus. Triangulations are built incrementally and can be modified by insertion or removal of vertices. They offer point location facilities. The package provides Delaunay triangulations and offers nearest neighbor queries and primitives to build the dual Voronoi diagrams.}
\cgalPkgAuthors{Manuel Caroli, Aymeric Pellé, Mael Rouxel-Labbé, and Monique Teillaud}
\cgalPkgDesc{This package allows to build and handle triangulations of point sets
in the three dimensional flat torus. Triangulations are built incrementally and
can be modified by insertion or removal of vertices. They offer point location
facilities. The package provides Delaunay and regular triangulations and offers
nearest neighbor queries and primitives to build the dual Voronoi diagrams.}
\cgalPkgManuals{Chapter_3D_Periodic_Triangulations,PkgPeriodic3Triangulation3}
\cgalPkgSummaryEnd
\cgalPkgShortInfoBegin
@@ -29,23 +33,24 @@
\cgalPkgDescriptionEnd
The main classes of the 3D Periodic Triangulation package are
`CGAL::Periodic_3_triangulation_3` and
`CGAL::Periodic_3_Delaunay_triangulation_3`. They contain functionality
`CGAL::Periodic_3_triangulation_3`,
`CGAL::Periodic_3_Delaunay_triangulation_3`,
and `CGAL::Periodic_3_regular_triangulation_3`.
They contain functionality
to access triangulations and to run queries on
them. `CGAL::Periodic_3_Delaunay_triangulation_3` can construct and
modify Delaunay triangulations. It takes the geometric traits as well
modify Delaunay triangulations, while
`CGAL::Periodic_3_regular_triangulation_3` can do it for weighted Delaunay
triangulations. They take the geometric traits as well
as the triangulation data structure as template parameters.
The geometric traits class must be a model of the concept
`Periodic_3DelaunayTriangulationTraits_3` for periodic Delaunay triangulations,
or `Periodic_3TriangulationTraits_3` for periodic triangulations. It must contains all
predicates and constructions that are needed by the functions in the
triangulation classes.
The geometric traits class of each triangulation class must be a model
of its associated concept, i.e., it must contain all
predicates and constructions that are needed by the
triangulation class.
The package uses `CGAL::Triangulation_data_structure_3` to represent the
triangulation. The cells and vertices need to be models of the
concepts `Periodic_3TriangulationDSCellBase_3` and
`Periodic_3TriangulationDSVertexBase_3`, respectively.
triangulation.
A triangulation is stored as a collection of vertices and cells that
are linked together through incidence and adjacency relations. Each
cell gives access to its four incident vertices and to its four
@@ -70,9 +75,16 @@ of the concept `Periodic_3Offset_3`.
- `Periodic_3TriangulationTraits_3`
- `Periodic_3DelaunayTriangulationTraits_3`
- `Periodic_3RegularTriangulationTraits_3`
- `TriangulationDataStructure_3`
- `Periodic_3TriangulationDSCellBase_3`
- `Periodic_3TriangulationDSVertexBase_3`
- `Periodic_3TriangulationDSCellBase_3`
- `Periodic_3RegularTriangulationDSCellBase_3`
- `Periodic_3RegularTriangulationDSVertexBase_3`
- `Periodic_3Offset_3`
## Classes ##
@@ -81,15 +93,19 @@ of the concept `Periodic_3Offset_3`.
- `CGAL::Periodic_3_triangulation_3<PT,TDS>`
- `CGAL::Periodic_3_Delaunay_triangulation_3<PT,TDS>`
- `CGAL::Periodic_3_regular_triangulation_3<PT,TDS>`
- `CGAL::Periodic_3_triangulation_hierarchy_3<PTr>`
- `CGAL::Periodic_3_triangulation_ds_cell_base_3<>`
- `CGAL::Periodic_3_triangulation_ds_vertex_base_3<>`
- `CGAL::Periodic_3_triangulation_ds_cell_base_3<>`
- `CGAL::Periodic_3_offset_3`
### Traits Classes ###
- `CGAL::Periodic_3_triangulation_traits_3<Traits,Periodic_3Offset_3>`
- `CGAL::Periodic_3_Delaunay_triangulation_traits_3<Traits,Periodic_3Offset_3>`
- `CGAL::Periodic_3_regular_triangulation_traits_3<Traits,Periodic_3Offset_3>`
## Enums ##
@@ -1,13 +1,13 @@
namespace CGAL {
/*!
\mainpage User Manual
\mainpage User Manual
\anchor Chapter_3D_Periodic_Triangulations
\anchor chapterP3Triangulation3
\cgalAutoToc
\authors Manuel Caroli and Monique Teillaud
\authors Manuel Caroli, Aymeric Pell&eacute;, Mael Rouxel-Labb&eacute; and Monique Teillaud
\image html p3Delaunay3.jpg
\image latex p3Delaunay3.jpg
@@ -21,7 +21,7 @@ contains all incident \f$ j\f$-simplices (\f$ j<k\f$) of any \f$ k\f$-simplex an
\f$ j<k\f$. The occurring simplices of dimension up to three are called
<I>vertex</I>, <I>edge</I>, <I>facet</I>, and <I>cell</I>, respectively.
\section P3Triangulation3secspace The Flat Torus
\section P3Triangulation3secspace The Flat Torus
The 3D Periodic Triangulation package computes triangulations in the
space \f$ \mathbb T_c^3\f$, which is defined as follows: Let \f$ c\in\mathbb
@@ -32,12 +32,12 @@ R^3/G\f$. The parameter \f$ c\f$ defines the period.
The elements of \f$ \mathbb T_c^3\f$ are the equivalence classes of sets of
points in \f$ \mathbb R^3\f$. We call these points <I>representatives</I>
of an element of \f$ \mathbb
of an element of \f$ \mathbb
T_c^3\f$. The implementation works not directly on elements of \f$ \mathbb
T_c^3\f$ but on some representatives in \f$ \mathbb R^3\f$. So there need to
be distinguished representatives to work on. Given \f$ \alpha\f$, \f$ \beta\f$,
and \f$ \gamma\f$, the cube
\f$ [\alpha,\alpha+c)\times[\beta,\beta+c)\times[\gamma,\gamma+c)\f$
\f$ [\alpha,\alpha+c)\times[\beta,\beta+c)\times[\gamma,\gamma+c)\f$
contains exactly one representative of each element in \f$ \mathbb
T_c^3\f$. We call it <I>original domain</I>. From now on, when we talk
about <I>points</I>, we generally mean representatives of elements
@@ -49,7 +49,7 @@ There are simplices containing points inside the original domain but
also points outside it. The points outside the original domain are
periodic copies of points inside the original domain. So, to
specify a simplex we need points together with some additional
information that determines the respective periodic copy of each point.
information that determines the respective periodic copy of each point.
The set of representatives of an element of \f$ \mathbb T_c^3\f$ is a cubic
point grid. We address each representative by a three-dimensional
integer vector \f$ (o_x,o_y,o_z)\f$, called <I>offset</I>. It
@@ -63,7 +63,7 @@ domain. To specify a \f$ k\f$-simplex we need \f$ k+1\f$ point-offset pairs
Offsets in a cell.
\cgalFigureEnd
\section P3Triangulation3secintro Representation
\section P3Triangulation3secintro Representation
A triangulation is a collection of vertices and cells that are linked
together through incidence and adjacency relations. Each cell gives
@@ -120,7 +120,7 @@ the 27-sheeted covering space to the 1-sheeted covering space, the `Vertex_handl
`Cell_handle`s referencing deleted items become invalid.
In the data structure each vertex stores the input point it
corresponds to. If we are computing in the 27-sheeted covering
corresponds to. If we are computing in the 27-sheeted covering
space, each vertex stores the representative <I>inside</I> the
original domain it corresponds to. So, the 27 vertices corresponding
to the same element of \f$ \mathbb T_c^3\f$ all store the same
@@ -131,7 +131,7 @@ representative in \f$ \mathbb R^3\f$, and not different periodic copies.
A periodic triangulation is said to be `locally valid` iff
<B>(a)-(b)</B> Its underlying combinatorial graph, the triangulation
data structure, is `locally valid`
data structure, is `locally valid`
(see Section \ref TDS3secintro of Chapter \ref chapterTDS3 "3D Triangulation Data Structure")
<B>(c)</B> Any cell has its vertices ordered according to positive
@@ -146,11 +146,28 @@ Delaunay triangulations have the <I>empty sphere property</I>,
that is, the circumscribing sphere of each cell does not contain any
other vertex of the triangulation in its interior. These
triangulations are uniquely defined except in degenerate cases where
five points are co-spherical. Note however that the \cgal implementation computes a unique triangulation even in these cases
five points are co-spherical. Note however that the \cgal
implementation computes a uniquely defined triangulation even in these cases
\cgalCite{cgal:dt-pvr3d-03}.
This implementation is fully dynamic: it supports both insertions of
points and vertex removal.
This implementation is fully dynamic: it supports both point insertion
and vertex removal.
\section Periodic_3_triangulation_3regular Regular Triangulation
The class `Periodic_3_regular_triangulation_3` implements regular
triangulations, also known as weighted Delaunay triangulations, of
point sets in \f$ \mathbb T_c^3\f$.
A regular triangulation is a triangulation in which the power sphere
of each simplex is regular. See Section
\ref Triangulation3secclassRegulartriangulation for a complete
definition.
As for Delaunay triangulations, \cgal computes a uniquely defined
regular triangulation even in degenerate cases \cgalCite{cgal:dt-pvrdr-06}.
The implementation is fully dynamic: it supports both point insertion
and vertex removal.
\section Periodic_3_triangulation_3Triangulation Triangulation Hierarchy
@@ -158,107 +175,121 @@ The class `Periodic_3_triangulation_hierarchy_3` is the adaptation
of the hierarchical structure described in
chapter \ref chapterTriangulation3 "3D Triangulations" to the periodic case.
\section P3Triangulation3secdesign Software Design
\section P3Triangulation3secdesign Software Design
We have chosen the prefix "Periodic_3" to emphasize that the
triangulation is periodic in all three directions of space.
The two main classes `Periodic_3_Delaunay_triangulation_3` and
`Periodic_3_triangulation_3` provide high-level geometric
functionality and are responsible for the geometric validity.
`Periodic_3_Delaunay_triangulation_3` contains all the
functionality that is special to Delaunay triangulations, such as
point insertion and vertex removal, the side-of-sphere test, finding
the conflicting region of a given point, dual functions etc.
`Periodic_3_triangulation_3` contains all the functionality
that is common to triangulations in general, such as location of a
point in the triangulation \cgalCite{cgal:dpt-wt-02}, access functions,
geometric queries like the orientation test etc.
The main classes `Periodic_3_triangulation_3`,
`Periodic_3_Delaunay_triangulation_3`, and `Periodic_3_regular_triangulation_3`
provide high-level geometric functionality and are responsible
for the geometric validity.
They are built as layers on top of a triangulation data structure,
which stores their combinatorial structure. This separation between
the geometry and the combinatorics is reflected in the software design
by the fact that the triangulation classes take two template
parameters:
parameters:
<UL>
<LI> the <B>geometric traits</B> class, which provides the type of points
to use as well as the elementary operations on them (predicates and
constructions). Furthermore it contains the offset type.
The concept for this parameter is described in more
detail in the section \ref P3Triangulation3secTraits
and models of one of the two concepts `Periodic_3DelaunayTriangulationTraits_3`
and `Periodic_3TriangulationTraits_3` can be used for this parameter.
The concept and models for this parameter are described in more
detail in Section \ref P3Triangulation3secTraits.
<LI> the <B>triangulation data structure</B> class, which stores the
combinatorial structure, described in
Section \ref P3Triangulation3sectds and in more detail in
Chapter \ref chapterTDS3 "3D Triangulation Data Structure". The triangulation data structure needs
models of the concepts `Periodic_3TriangulationDSCellBase_3` and
`Periodic_3TriangulationDSVertexBase_3` as template parameters.
Section \ref P3Triangulation3sectds.
</UL>
\subsection P3Triangulation3secTraits The Geometric Traits Parameter
The class `Periodic_3_triangulation_3` contains all the functionality
that is common to triangulations in general, such as location of a
point in the triangulation \cgalCite{cgal:dpt-wt-02}, access functions,
geometric queries like the orientation test etc.
The class `Periodic_3_Delaunay_triangulation_3` contains all the
functionality that is specific to Delaunay triangulations, such as
point insertion and vertex removal, the side-of-sphere test, finding
the conflicting region of a given point, computation of dual functions, etc.
The class `Periodic_3_regular_triangulation_3` does the same for regular
triangulations.
\subsubsection P3Triangulation3secTraitsP3T3 Traits for Periodic Triangulations
\subsection P3Triangulation3secTraits The Geometric Traits Parameter
\subsubsection P3Triangulation3secTraitsP3T3 Traits for Periodic Triangulations
The first template parameter of the triangulation class
`Periodic_3_triangulation_3<Periodic_3TriangulationTraits_3, TriangulationDataStructure_3>`
is the geometric traits class, described by the concept
`Periodic_3TriangulationTraits_3`. It is different to the
TriangulationTraits_3 (see
chapter \ref Triangulation3secTraits "3D Triangulations") in that it
implements all objects, predicates and constructions with
using offsets.
chapter \ref Triangulation3secTraits "3D Triangulations") in that it
implements all objects, predicates and constructions using offsets.
The class `Periodic_3_triangulation_traits_3<TriangulationTraits_3,Periodic_3Offset_3>`
provides the required functionality. It expects two template
parameters: A model of the concept `TriangulationTraits_3`
parameters: a model of the concept `TriangulationTraits_3`
and a model of the concept `Periodic_3Offset_3`.
The second parameter `Periodic_3Offset_3` defaults to
`Periodic_3_offset_3`.
\subsubsection P3Triangulation3secTraitsP3DT3 Traits for Periodic Delaunay Triangulations
\subsubsection P3Triangulation3secTraitsP3DT3 Traits for Periodic Delaunay Triangulations
The first template parameter of the Delaunay triangulation class
`Periodic_3_Delaunay_triangulation_3<Periodic_3DelaunayTriangulationTraits_3, TriangulationDataStructure_3>`
is the geometric traits class, described by the concept
`Periodic_3DelaunayTriangulationTraits_3`. It is different to the
DelaunayTriangulationTraits_3 (see
chapter \ref Triangulation3secTraits "3D Triangulations") in that it
implements all objects, predicates and constructions with
using offsets.
chapter \ref Triangulation3secTraits "3D Triangulations") in that it
implements all objects, predicates and constructions using offsets.
The class `Periodic_3_Delaunay_triangulation_traits_3<DelaunayTriangulationTraits_3,Periodic_3Offset_3>`
provides the required functionality. It expects two template
parameters: A model of the concept `DelaunayTriangulationTraits_3`
parameters: a model of the concept `DelaunayTriangulationTraits_3`
and a model of the concept `Periodic_3Offset_3`.
The second parameter `Periodic_3Offset_3` defaults to
`Periodic_3_offset_3`.
\subsubsection P3Triangulation3secTraitsP3regularT3 Traits for Periodic Regular Triangulations
The first template parameter of the regular triangulation class
`Periodic_3_regular_triangulation_3<Periodic_3RegularTriangulationTraits_3, TriangulationDataStructure_3>`
is the geometric traits class, described by the concept
`Periodic_3RegularTriangulationTraits_3`. It is different to the
RegularTriangulationTraits_3 (see
chapter \ref Triangulation3secTraits "3D Triangulations") in that it
implements all objects, predicates and constructions using offsets.
The class `Periodic_3_regular_triangulation_traits_3<RegularTriangulationTraits_3,Periodic_3Offset_3>`
provides the required functionality. It expects two template
parameters: a model of the concept `RegularTriangulationTraits_3`
and a model of the concept `Periodic_3Offset_3`.
The second parameter `Periodic_3Offset_3` defaults to
`Periodic_3_offset_3`.
\subsubsection P3Triangulation3secTraitsK Compatible Kernels
The kernels `Cartesian`, `Homogeneous`,
`Simple_cartesian`, `Simple_homogeneous` and
`Filtered_kernel` can all be used as models for
`TriangulationTraits_3` and `DelaunayTriangulationTraits_3`.
`Periodic_3_triangulation_traits_3` and `Periodic_3_Delaunay_triangulation_traits_3` provide exact
predicates and exact constructions if `TriangulationTraits_3` and `DelaunayTriangulationTraits_3` do. They provide
exact predicates but not exact constructions if
`Filtered_kernel` can all be used as models of the concepts
`TriangulationTraits_3`, `DelaunayTriangulationTraits_3`, and
`RegularTriangulationTraits_3`.
The periodic triangulation classes provide exact
predicates and exact constructions if these respective template parameters
do. They provide exact predicates but not exact constructions if
`Filtered_kernel<CK>` with `CK` an inexact kernel is used as
their first template parameter. Using
`Exact_predicates_inexact_constructions_kernel` as
`Traits` provides fast and exact predicates and not exact constructions,
template parameter. Using `Exact_predicates_inexact_constructions_kernel`
provides fast and exact predicates and not exact constructions,
using `Exact_predicates_exact_constructions_kernel` provides
fast and exact predicates and exact constructions. The latter is recommended if
the dual constructions and constructions of points, segments,
triangles, and tetrahedra are used.
\subsection P3Triangulation3sectds The Triangulation Data Structure Parameter
\subsection P3Triangulation3sectds The Triangulation Data Structure Parameter
The second template parameter of the main classes
`Periodic_3_triangulation_3` and
`Periodic_3_Delaunay_triangulation_3` is a
The second template parameter of the periodic triangulation classes is a
triangulation data structure class. This class can be seen as a container for
the cells and vertices maintaining incidence and adjacency relations (see
Chapter \ref chapterTDS3 "3D Triangulation Data Structure"). A model of this triangulation data structure is
@@ -279,22 +310,22 @@ structure or a different vertex or cell base class.
\subsection Periodic_3_triangulation_3Flexibilityofthe Flexibility of the Design
`Periodic_3_triangulation_3` uses the
`TriangulationDataStructure_3` in essentially the same way as
`Triangulation_3`. That is why the flexibility described in
\ref Triangulation3secdesign is applicable in exactly the same
way. Also the classes `Triangulation_vertex_base_with_info_3` and
The class `Periodic_3_triangulation_3` uses the
`TriangulationDataStructure_3` in essentially the same way as the class
`Triangulation_3` and the flexibility described in
\ref Triangulation3secdesign is therefore applicable in exactly the same
way. Furthermore, the classes `Triangulation_vertex_base_with_info_3` and
`Triangulation_cell_base_with_info_3` can be reused directly, see
also Example \ref P3Triangulation3secexamplescolor.
Example \ref P3Triangulation3secexamplescolor.
\section P3Triangulation3secexamples Examples
\section P3Triangulation3secexamples Examples
\subsection Periodic_3_triangulation_3BasicExample Basic Example
This example shows the incremental construction of a 3D Delaunay
triangulation, the location of a point and how to perform elementary
operations on indices in a cell. It uses the default parameter of the
`Periodic_3_Delaunay_triangulation_3` class for the triangulation
class `Periodic_3_Delaunay_triangulation_3` for the triangulation
data structure.
\cgalExample{Periodic_3_triangulation_3/simple_example.cpp}
@@ -304,7 +335,7 @@ data structure.
The following two examples show how the user can plug his own vertex base in a
triangulation. Changing the cell base is similar.
\subsection P3Triangulation3secexamplescolor Adding a Color
\subsubsection P3Triangulation3secexamplescolor Adding a Color
If the user does not need to add a type in a vertex that depends on the
`TriangulationDataStructure_3` (e.g. a `Vertex_handle` or
@@ -315,7 +346,7 @@ this way.
\cgalExample{Periodic_3_triangulation_3/colored_vertices.cpp}
\subsection Periodic_3_triangulation_3AddingHandles Adding Handles
\subsubsection Periodic_3_triangulation_3AddingHandles Adding Handles
If the user needs to add a type in a vertex that depends on the
`TriangulationDataStructure_3` (e.g. a `Vertex_handle` or
@@ -328,48 +359,46 @@ as the following example shows.
The user can check at any time whether a triangulation would be a
simplicial complex in \f$ \mathbb T_c^3\f$ and force a conversion if
so. However this should be done very carefully in order to be sure
so. However, this should be done very carefully in order to ensure
that the internal structure always remains a simplicial complex and
thus a triangulation.
In this example we construct a triangulation that can be converted to
In this example, we construct a triangulation that can be converted to
the 1-sheeted covering space. However, we can insert new points such that the
point set does not have a Delaunay triangulation in the 1-sheeted
covering space anymore, so the triangulation is not <I>extensible</I>.
covering space anymore, rendering the triangulation not <I>extensible</I>.
\cgalExample{Periodic_3_triangulation_3/covering.cpp}
\subsection Periodic_3_triangulation_3LargePointSet Large Point Set
For large point sets there are two optimizations available. Firstly,
there is spatial sorting that sorts the input points according to a
Two optimizations are available for large point sets. Firstly,
spatial sorting can be used to sort the input points according to a
Hilbert curve, see chapter \ref secspatial_sorting "Spatial Sorting".
The second one inserts 36 appropriately chosen dummy points to avoid
the use of a 27-sheeted covering space in the beginning. The 36 dummy
Secondly, 36 appropriately chosen dummy points can be inserted to avoid
the use of a 27-sheeted covering space in the beginning. These 36 dummy
points are deleted in the end. If the point set turns out to not have
a Delaunay triangulation in the 1-sheeted covering space, the triangulation is
converted to the 27-sheeted covering space during the removal of the 36 dummy
points. This might take even longer than computing the triangulation
points. Note that this might take even longer than computing the triangulation
without using this optimization. In general, uniformly distributed
random point sets of more than 1000 points have a Delaunay
triangulation in the 1-sheeted covering space.
It is recommended to run this example only when compiled in release
mode because of the relatively large number of points.
The following example illustrates the use of these optimization techniques.
\cgalExample{Periodic_3_triangulation_3/large_point_set.cpp}
\subsection Periodic_3_triangulation_3GeometricAccess Geometric Access
There might be applications that need the geometric primitives of a
triangulation as an input but do not require a simplicial complex. For
these cases we provide the geometric iterators that return only the
Some application might use the geometric primitives of a
triangulation as an input but not require a simplicial complex. We provide
for these cases the geometric iterators that return only the
geometric primitives fulfilling some properties. In the following
example we use the `Periodic_3_triangulation_3::Periodic_triangle_iterator` with the option
`UNIQUE_COVER_DOMAIN`. This means that only those triangles are
returned that have a non-empty intersection with the original domain
of the 1-sheeted covering space, see
Figure \ref P3Triangulation3figgeom_iterators.
example, we use the `Periodic_3_triangulation_3::Periodic_triangle_iterator`
with the option `UNIQUE_COVER_DOMAIN`. This means that only the triangles that
have a non-empty intersection with the original domain of the 1-sheeted covering
space are returned, see Figure \ref P3Triangulation3figgeom_iterators.
The `Periodic_3_triangulation_3::Periodic_triangle` is actually a three-dimensional array of
point-offset pairs. We check for all three entries of the periodic
triangle whether the offset is (0,0,0) using the
@@ -379,6 +408,51 @@ exact.
\cgalExample{Periodic_3_triangulation_3/geometric_access.cpp}
\subsection Periodic_3_triangulation_3PeriodicRegularTriangulations Periodic Regular Triangulations
The following five examples illustrate various features of 3D periodic
regular triangulations.
\subsubsection Periodic_3_triangulation_3P3TR3FirstExample Basic example
This example shows the incremental construction of a 3D Delaunay
triangulation, the location of a point and how to perform elementary
operations on indices in a cell. It uses the default parameter of the
class `Periodic_3_regular_triangulation_3` for the triangulation
data structure.
\cgalExample{Periodic_3_triangulation_3/simple_regular_example.cpp}
\subsubsection Periodic_3_triangulation_3P3TR3PointInsertionAndVertexRemoval Point Insertion and Vertex Removal
This example shows the incremental construction of a 3D regular triangulation,
and the removal of a vertex. It uses the default parameter of the
`Periodic_3_regular_triangulation_3` class for the triangulation data structure.
\cgalExample{Periodic_3_triangulation_3/p3rt3_insert_remove.cpp}
\subsubsection Periodic_3_triangulation_3P3TR3SecondExample Data Structure
This example shows the incremental construction of a 3D regular triangulation.
It uses a more appropriate triangulation data structure, which saves some memory resources.
\cgalExample{Periodic_3_triangulation_3/p3rt3_insert_only.cpp}
\subsubsection Periodic_3_triangulation_3P3TR3ThirdExample Hidden Points
This example shows that points can be hidden during the incremental construction
of a 3D regular triangulation.
\cgalExample{Periodic_3_triangulation_3/p3rt3_hidden_points.cpp}
\subsubsection Periodic_3_triangulation_3P3TR3FourthExample Bad Weights
Finally, this example shows how points whose weight does not
satisfy the precondition are handled during the incremental construction
of a 3D regular triangulation.
\cgalExample{Periodic_3_triangulation_3/p3rt3_insert_point_with_bad_weight.cpp}
\subsection Periodic_3_triangulation_3PeriodicAlphaShapes Periodic Alpha Shapes
It is possible to use the class `Periodic_3_Delaunay_triangulation_3`
@@ -395,9 +469,12 @@ In 2007, Manuel Caroli continued work on the
algorithms \cgalCite{cgal:ct-c3pt-09} and on the package with Monique
Teillaud.
In 2015, Aymeric Pell&eacute; contributed to adding regular triangulations in
the package.
The package follows the design of the 3D Triangulations package
(see Chapter \ref Chapter_3D_Triangulations "3D Triangulations").
*/
*/
} /* namespace CGAL */
@@ -1,8 +1,13 @@
/*!
\example Periodic_3_triangulation_3/simple_example.cpp
\example Periodic_3_triangulation_3/simple_regular_example.cpp
\example Periodic_3_triangulation_3/colored_vertices.cpp
\example Periodic_3_triangulation_3/periodic_adding_handles.cpp
\example Periodic_3_triangulation_3/covering.cpp
\example Periodic_3_triangulation_3/large_point_set.cpp
\example Periodic_3_triangulation_3/geometric_access.cpp
\example Periodic_3_triangulation_3/p3rt3_insert_remove.cpp
\example Periodic_3_triangulation_3/p3rt3_insert_only.cpp
\example Periodic_3_triangulation_3/p3rt3_hidden_points.cpp
\example Periodic_3_triangulation_3/p3rt3_insert_point_with_bad_weight.cpp
/h*/
@@ -51,3 +51,32 @@ example demonstrates how to use the geometric access functions.
-------------------------------------------------------------------------------
------- p3rt3_insert_remove ------------------------------------------------------
This example shows the incremental construction of a 3D regular triangulation,
and the removal of a vextex. It uses the default parameter of the Periodic_3_regular_triangulation_3
class for the triangulation data structure.
-------------------------------------------------------------------------------
------- p3rt3_insert_only ------------------------------------------------------
This example shows the incremental construction of a 3D regular triangulation.
It uses a more appropriate triangulation data structure, which saves some memory resources.
-------------------------------------------------------------------------------
------- p3rt3_hidden_points ------------------------------------------------------
This example shows that points can be hidden during the incremental construction
of a 3D regular triangulation.
-------------------------------------------------------------------------------
------- p3rt3_insert_point_with_bad_weight ------------------------------------------------------
This example shows how points whose weight does not
satisfy the precondition are handled during the incremental construction
of a 3D regular triangulation.
-------------------------------------------------------------------------------
@@ -1,27 +1,29 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <CGAL/IO/Color.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS;
typedef CGAL::Triangulation_vertex_base_3<GT,VbDS> Vb;
typedef CGAL::Triangulation_vertex_base_3<Gt, VbDS> Vb;
typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS;
typedef CGAL::Triangulation_cell_base_3<GT,CbDS> Cb;
typedef CGAL::Triangulation_cell_base_3<Gt, CbDS> Cb;
typedef CGAL::Triangulation_vertex_base_with_info_3<CGAL::Color, GT, Vb> VbInfo;
typedef CGAL::Triangulation_data_structure_3<VbInfo, Cb> TDS;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT, TDS> PDT;
typedef CGAL::Triangulation_vertex_base_with_info_3<CGAL::Color, Gt, Vb> VbInfo;
typedef CGAL::Triangulation_data_structure_3<VbInfo, Cb> TDS;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<Gt, TDS> P3DT3;
typedef PDT::Point Point;
typedef P3DT3::Point Point;
int main()
int main(int, char**)
{
PDT T;
P3DT3 T;
T.insert(Point(0,0,0));
T.insert(Point(.1,0,0));
@@ -31,10 +33,12 @@ int main()
T.insert(Point(.9,0,.1));
// Set the color of finite vertices of degree 6 to red.
PDT::Vertex_iterator vit;
for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit)
if (T.degree(vit) == 6)
P3DT3::Vertex_iterator vit;
for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit) {
if (T.degree(vit) == 16) {
vit->info() = CGAL::RED;
}
}
return 0;
}
@@ -1,38 +1,40 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
#include <iostream>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<Gt> P3DT3;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT> PDT;
typedef P3DT3::Point Point;
typedef P3DT3::Covering_sheets Covering_sheets;
typedef PDT::Point Point;
typedef PDT::Covering_sheets Covering_sheets;
int main()
int main(int, char**)
{
PDT T;
P3DT3 T;
// Input point grid (27 points)
for (double x=0. ; x < .9 ; x += 0.33) {
for (double y=0. ; y < .9 ; y += 0.33) {
for (double z=0. ; z < .9 ; z += 0.33) {
T.insert(Point(x,y,z));
} } }
T.insert(Point(x,y,z));
}
}
}
Covering_sheets cs = T.number_of_sheets();
std::cout<<"Current covering: "<<cs[0]<<' '<<cs[1]<<' '<<cs[2]<<std::endl;
if ( T.is_triangulation_in_1_sheet() ) { // = true
if ( T.is_triangulation_in_1_sheet() ) { // = true
bool is_extensible = T.is_extensible_triangulation_in_1_sheet_h1()
|| T.is_extensible_triangulation_in_1_sheet_h2(); // = false
|| T.is_extensible_triangulation_in_1_sheet_h2(); // = false
T.convert_to_1_sheeted_covering();
cs = T.number_of_sheets();
std::cout<<"Current covering: "<<cs[0]<<' '<<cs[1]<<' '<<cs[2]<<std::endl;
if ( is_extensible ) // = false
if ( is_extensible ) // = false
std::cout<<"It is safe to change the triangulation here."<<std::endl;
else
std::cout<<"It is NOT safe to change the triangulation here!"<<std::endl;
@@ -1,24 +1,26 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
#include <CGAL/point_generators_3.h>
#include <vector>
#include <cassert>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<Gt> P3DT3;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT> Delaunay;
typedef Delaunay::Point Point;
typedef Delaunay::Cell_handle Cell_handle;
typedef Delaunay::Facet Facet;
typedef P3DT3::Point Point;
typedef P3DT3::Cell_handle Cell_handle;
typedef P3DT3::Facet Facet;
int main()
{
Delaunay T;
P3DT3 T;
CGAL::Random_points_in_cube_3<Point> rnd(0.5);
GT::Vector_3 v(0.5,0.5,0.5);
Gt::Vector_3 v(0.5,0.5,0.5);
// First, make sure the triangulation is 3D.
T.insert(Point(0,0,0));
@@ -32,10 +34,10 @@ int main()
Point p = (*rnd++)+v;
// Locate the point
Delaunay::Locate_type lt;
P3DT3::Locate_type lt;
int li, lj;
Cell_handle c = T.locate(p, lt, li, lj);
if (lt == Delaunay::VERTEX)
if (lt == P3DT3::VERTEX)
continue; // Point already exists
// Get the cells that conflict with p in a vector V,
@@ -44,8 +46,8 @@ int main()
Facet f;
T.find_conflicts(p, c,
CGAL::Oneset_iterator<Facet>(f), // Get one boundary facet
std::back_inserter(V)); // Conflict cells in V
CGAL::Oneset_iterator<Facet>(f), // Get one boundary facet
std::back_inserter(V)); // Conflict cells in V
}
std::cout << "Final triangulation has " << T.number_of_vertices()
@@ -1,19 +1,20 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> PK;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<PK> P3DT3;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<Gt> P3DT3;
typedef PK::Point_3 Point;
typedef PK::Triangle_3 Triangle;
typedef Gt::Point_3 Point;
typedef Gt::Triangle_3 Triangle;
typedef P3DT3::Periodic_triangle Periodic_triangle;
typedef P3DT3::Periodic_triangle_iterator Periodic_triangle_iterator;
typedef P3DT3::Iterator_type Iterator_type;
int main() {
int main(int, char**) {
P3DT3 T;
T.insert(Point(0,0,0));
@@ -1,4 +1,5 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
@@ -9,14 +10,13 @@
#include <iostream>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<Gt> P3DT3;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT> PDT;
typedef P3DT3::Point Point;
typedef PDT::Point Point;
int main()
int main(int, char**)
{
CGAL::Timer t;
typedef CGAL::Creator_uniform_3<double, Point> Creator;
@@ -26,7 +26,7 @@ int main()
int n = 10000;
std::vector<Point> pts;
PDT PT1, PT2, PT3;
P3DT3 PT1, PT2, PT3;
// Generating n random points
for (int i=0 ; i < n ; i++) {
@@ -0,0 +1,41 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <iostream>
typedef CGAL::Epick K;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_regular_triangulation_3<Gt> P3RT3;
typedef Gt::Iso_cuboid_3 Iso_cuboid;
typedef Gt::Point_3 Point_3;
typedef Gt::Weighted_point_3 Weighted_point_3;
typedef P3RT3::Vertex_handle Vertex_handle;
int main ()
{
P3RT3 p3rt3(P3RT3::Iso_cuboid(0,0,0, 1,1,1));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.91,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.89), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.101,0.101,0.101), 0.001));
assert(p3rt3.is_valid());
std::cout << "Number of vertices : " << p3rt3.number_of_vertices() << std::endl;
std::cout << "Number of hidden points : " << p3rt3.number_of_hidden_points() << std::endl;
std::cout << "Removing the first point..." << std::endl;
p3rt3.remove(p3rt3.vertices_begin());
// The first point is removed and the hidden point is revealed.
std::cout << "Number of vertices : " << p3rt3.number_of_vertices() << std::endl;
std::cout << "Number of hidden points : " << p3rt3.number_of_hidden_points() << std::endl;
std::cout << "EXIT SUCCESS" << std::endl;
return 0;
}
@@ -0,0 +1,43 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <CGAL/periodic_3_triangulation_3_io.h>
#include <CGAL/Regular_triangulation_vertex_base_3.h>
#include <CGAL/Regular_triangulation_cell_base_3.h>
#include <iostream>
typedef CGAL::Epick K;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Gt;
/* If remove() isn't called in our program, we can use a triangulation data structure
* more appropriate, which saves some memory resources.
*/
typedef CGAL::Regular_triangulation_vertex_base_3<Gt,
CGAL::Periodic_3_triangulation_ds_vertex_base_3<> > Vb;
typedef CGAL::Regular_triangulation_cell_base_3<Gt,
CGAL::Periodic_3_triangulation_ds_cell_base_3<> > Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
typedef CGAL::Periodic_3_regular_triangulation_3<Gt, Tds> P3RT3;
typedef Gt::Iso_cuboid_3 Iso_cuboid;
typedef Gt::Weighted_point_3 Weighted_point_3;
typedef Gt::Point_3 Point_3;
typedef P3RT3::Vertex_handle Vertex_handle;
int main(int, char**)
{
P3RT3 p3rt3(P3RT3::Iso_cuboid(0,0,0, 1,1,1));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.4,0.4,0.4), 0.001));
std::cout << "EXIT SUCCESS" << std::endl;
return 0;
}
@@ -0,0 +1,44 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Regular_triangulation_vertex_base_3.h>
#include <CGAL/Regular_triangulation_cell_base_3.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <iostream>
typedef CGAL::Epick K;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Gt;
/* If remove() isn't called in our program, we can use a triangulation data structure more appropriate
* which saves some memory resources.
*/
typedef CGAL::Regular_triangulation_vertex_base_3<Gt,
CGAL::Periodic_3_triangulation_ds_vertex_base_3<> > Vb;
typedef CGAL::Regular_triangulation_cell_base_3<Gt,
CGAL::Periodic_3_triangulation_ds_cell_base_3<> > Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
typedef CGAL::Periodic_3_regular_triangulation_3<Gt, Tds> P3RT3;
typedef Gt::Iso_cuboid_3 Iso_cuboid;
typedef Gt::Weighted_point_3 Weighted_point_3;
typedef Gt::Point_3 Point_3;
int main ()
{
P3RT3 p3rt3(P3RT3::Iso_cuboid(0,0,0, 1,1,1));
// Here, we insert a point with a bad weight.
// p3rt3.insert(Weighted_point_3(Point_3(0.5,0.5,0.5), 1.));
// In debug mode, if we uncomment the previous instruction, the program displays the following error message :
// terminate called after throwing an instance of 'CGAL::Precondition_exception'
// what(): CGAL ERROR: precondition violation!
// Expr: point.weight() < ( FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax()-domain().xmin()) )
// [...]
// Explanation: point.weight() < 1/64 * domain_size * domain_size
std::cout << "EXIT SUCCESS" << std::endl;
return 0;
}
@@ -0,0 +1,34 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <iostream>
typedef CGAL::Epick K;
typedef K::FT FT;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_regular_triangulation_3<Gt> P3RT3;
typedef Gt::Weighted_point_3 Weighted_point_3;
typedef Gt::Point_3 Point_3;
typedef P3RT3::Vertex_handle Vertex_handle;
int main (int, char**)
{
P3RT3 p3rt3(P3RT3::Iso_cuboid(0,0,0, 1,1,1));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9), 0.01));
p3rt3.insert(Weighted_point_3(Point_3(0.4,0.4,0.4), 0.001));
while (p3rt3.number_of_vertices())
p3rt3.remove(p3rt3.vertices_begin());
std::cout << "EXIT SUCCESS" << std::endl;
return 0;
}
@@ -1,11 +1,12 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
#include <CGAL/Periodic_3_triangulation_ds_vertex_base_3.h>
#include <CGAL/Triangulation_vertex_base_3.h>
template < class GT, class VbDS,
class Vb = CGAL::Triangulation_vertex_base_3<GT,VbDS> >
template < class Gt, class VbDS,
class Vb = CGAL::Triangulation_vertex_base_3<Gt,VbDS> >
class My_vertex_base
: public Vb
{
@@ -17,7 +18,7 @@ public:
template < class TDS2 >
struct Rebind_TDS {
typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
typedef My_vertex_base<GT, Vb2> Other;
typedef My_vertex_base<Gt, Vb2> Other;
};
My_vertex_base() {}
@@ -32,23 +33,22 @@ public:
Cell_handle ch;
};
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS;
typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS;
typedef CGAL::Triangulation_cell_base_3<GT,CbDS> Cb;
typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS;
typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS;
typedef CGAL::Triangulation_cell_base_3<Gt,CbDS> Cb;
typedef CGAL::Triangulation_data_structure_3<My_vertex_base<GT,VbDS>, Cb> TDS;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT,TDS> PDT;
typedef CGAL::Triangulation_data_structure_3<My_vertex_base<Gt, VbDS>, Cb> TDS;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<Gt, TDS> P3DT3;
typedef PDT::Vertex_handle Vertex_handle;
typedef PDT::Point Point;
typedef P3DT3::Vertex_handle Vertex_handle;
typedef P3DT3::Point Point;
int main()
int main(int, char**)
{
PDT T;
P3DT3 T;
Vertex_handle v0 = T.insert(Point(0,0,0));
Vertex_handle v1 = T.insert(Point(.1,0,0));
@@ -1,6 +1,7 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
#include <CGAL/periodic_3_triangulation_3_io.h>
#include <iostream>
#include <fstream>
@@ -8,20 +9,19 @@
#include <list>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> GT;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<Gt> P3DT3;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<GT> PDT;
typedef P3DT3::Point Point;
typedef P3DT3::Iso_cuboid Iso_cuboid;
typedef P3DT3::Vertex_handle Vertex_handle;
typedef P3DT3::Cell_handle Cell_handle;
typedef P3DT3::Locate_type Locate_type;
typedef PDT::Cell_handle Cell_handle;
typedef PDT::Vertex_handle Vertex_handle;
typedef PDT::Locate_type Locate_type;
typedef PDT::Point Point;
typedef PDT::Iso_cuboid Iso_cuboid;
int main()
int main(int, char**)
{
Iso_cuboid domain(-1,-1,-1,2,2,2); // The cube for the periodic domain
Iso_cuboid domain(-1,-1,-1,2,2,2); // the cube for the periodic domain
// construction from a list of points :
std::list<Point> L;
@@ -29,9 +29,9 @@ int main()
L.push_front(Point(1,0,0));
L.push_front(Point(0,1,0));
PDT T(L.begin(), L.end(), domain); // Put the domain with the constructor
P3DT3 T(L.begin(), L.end(), domain); // put the domain with the constructor
PDT::size_type n = T.number_of_vertices();
P3DT3::size_type n = T.number_of_vertices();
// insertion from a vector :
std::vector<Point> V(3);
@@ -49,7 +49,7 @@ int main()
Point p(0,0,0);
Cell_handle c = T.locate(p, lt, li, lj);
// p is the vertex of c of index li :
assert( lt == PDT::VERTEX );
assert( lt == P3DT3::VERTEX );
assert( c->vertex(li)->point() == p );
Vertex_handle v = c->vertex( (li+1)&3 );
@@ -61,14 +61,20 @@ int main()
assert( nc->has_vertex( v, nli ) );
// nli is the index of v in nc
std::ofstream oFileT("output.tri",std::ios::out);
// writing file output;
oFileT << T;
// writing file output
std::ofstream oFileT("output.tri", std::ios::out); // as a .tri file
oFileT << T;
PDT T1;
std::ofstream to_off("output_regular.off"); // as a .off file
write_triangulation_to_off(to_off, T);
std::ofstream d_to_off("output_dual.off");
draw_dual_to_off(d_to_off, T);
// reading file output
P3DT3 T1;
std::ifstream iFileT("output.tri",std::ios::in);
// reading file output;
iFileT >> T1;
iFileT >> T1;
assert( T1.is_valid() );
assert( T1.number_of_vertices() == T.number_of_vertices() );
assert( T1.number_of_cells() == T.number_of_cells() );
@@ -0,0 +1,84 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <CGAL/periodic_3_triangulation_3_io.h>
#include <iostream>
#include <fstream>
#include <cassert>
#include <list>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Gt;
typedef CGAL::Periodic_3_regular_triangulation_3<Gt> P3RT3;
typedef P3RT3::Bare_point Point;
typedef P3RT3::Weighted_point Weighted_point;
typedef P3RT3::Iso_cuboid Iso_cuboid;
typedef P3RT3::Vertex_handle Vertex_handle;
typedef P3RT3::Cell_handle Cell_handle;
typedef P3RT3::Locate_type Locate_type;
int main(int, char**)
{
Iso_cuboid domain(-1,-1,-1, 2,2,2); // the cube for the periodic domain
// construction from a list of weighted points :
std::list<Weighted_point> L;
L.push_front(Weighted_point(Point(0,0,0), 0.01));
L.push_front(Weighted_point(Point(1,0,0), 0.02));
L.push_front(Weighted_point(Point(0,1,0), 0.03));
P3RT3 T(L.begin(), L.end(), domain); // put the domain with the constructor
P3RT3::size_type n = T.number_of_vertices();
// insertion from a vector :
std::vector<Weighted_point> V(3);
V[0] = Weighted_point(Point(0,0,1), 0.04);
V[1] = Weighted_point(Point(1,1,1), 0.05);
V[2] = Weighted_point(Point(-1,-1,-1), 0.06);
n = n + T.insert(V.begin(), V.end());
assert( n == 6 ); // 6 points have been inserted
assert( T.is_valid() ); // checking validity of T
Locate_type lt;
int li, lj;
Weighted_point p(Point(0,0,0), 1.);
Cell_handle c = T.locate(p, lt, li, lj);
// p is the vertex of c of index li :
assert( lt == P3RT3::VERTEX );
assert( c->vertex(li)->point() == p );
Vertex_handle v = c->vertex( (li+1)&3 );
// v is another vertex of c
Cell_handle nc = c->neighbor(li);
// nc = neighbor of c opposite to the vertex associated with p
// nc must have vertex v :
int nli;
assert( nc->has_vertex( v, nli ) );
// nli is the index of v in nc
// writing file output
std::ofstream oFileT("output_regular.tri", std::ios::out); // as a .tri file
oFileT << T;
std::ofstream to_off("output_regular.off");
write_triangulation_to_off(to_off, T);
std::ofstream d_to_off("output_regular_dual.off"); // as a .off file
draw_dual_to_off(d_to_off, T);
// reading file output
P3RT3 T1;
std::ifstream iFileT("output_regular.tri",std::ios::in);
iFileT >> T1;
assert( T1.is_valid() );
assert( T1.number_of_vertices() == T.number_of_vertices() );
assert( T1.number_of_cells() == T.number_of_cells() );
return 0;
}
File diff suppressed because it is too large Load Diff
@@ -1,36 +0,0 @@
// Copyright (c) 2004,2006-2009 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#ifndef CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
#define CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#define CGAL_DEPRECATED_HEADER "<CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>"
#include <CGAL/internal/deprecation_warning.h>
#include <CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>
#endif // CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H
@@ -1,4 +1,4 @@
// Copyright (c) 2006-2009 INRIA Sophia-Antipolis (France).
// Copyright (c) 2006-2009, 2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -14,100 +14,105 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
// Mael Rouxel-Labbé
#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H
#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/basic.h>
#include <CGAL/internal/Periodic_3_construct_point_3.h>
#include <CGAL/internal/Functor_with_offset_points_adaptor.h>
#include <CGAL/Periodic_3_offset_3.h>
#include <CGAL/Traits_with_offsets_adaptor.h>
#include <CGAL/Periodic_3_construct_point_3.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/internal/Has_boolean_tags.h>
#include <CGAL/Periodic_3_triangulation_traits_3.h>
#include <CGAL/basic.h>
#include <CGAL/internal/Has_boolean_tags.h>
namespace CGAL {
namespace CGAL {
template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 >
template < class K, class Off = typename CGAL::Periodic_3_offset_3 >
class Periodic_3_Delaunay_triangulation_traits_base_3
: public Periodic_3_triangulation_traits_base_3<Kernel, Off>
: public Periodic_3_triangulation_traits_3<K, Off>
{
typedef Periodic_3_Delaunay_triangulation_traits_base_3<K, Off> Self;
typedef Periodic_3_triangulation_traits_3<K, Off> Base;
public:
typedef Kernel K;
typedef Off Offset;
typedef Periodic_3_triangulation_traits_base_3<K, Offset> Base;
typedef Periodic_3_Delaunay_triangulation_traits_base_3< K, Offset > Self;
typedef K Kernel;
typedef Off Offset;
typedef typename Base::RT RT;
typedef typename Base::FT FT;
typedef typename Base::Point_3 Point_3;
typedef typename Base::Vector_3 Vector_3;
typedef typename Base::Periodic_3_offset_3 Periodic_3_offset_3;
typedef typename Base::Iso_cuboid_3 Iso_cuboid_3;
// The next typedef is there for backward compatibility
// Some users take their point type from the traits class.
// Before this type was Point
typedef Point_3 Point;
typedef Point_3 Point;
typedef typename Base::Segment_3 Segment_3;
typedef typename Base::Triangle_3 Triangle_3;
typedef typename Base::Tetrahedron_3 Tetrahedron_3;
typedef typename Base::Segment_3 Segment_3;
typedef typename Base::Triangle_3 Triangle_3;
typedef typename Base::Tetrahedron_3 Tetrahedron_3;
public:
Periodic_3_Delaunay_triangulation_traits_base_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
// Delaunay specific predicates
typedef Traits_with_offsets_adaptor<Self,
typename K::Side_of_oriented_sphere_3>
typedef Functor_with_offset_points_adaptor<Self, typename K::Side_of_oriented_sphere_3>
Side_of_oriented_sphere_3;
typedef Traits_with_offsets_adaptor<Self, typename K::Compare_distance_3>
typedef Functor_with_offset_points_adaptor<Self, typename K::Compare_distance_3>
Compare_distance_3;
typedef Traits_with_offsets_adaptor<Self,
typename K::Side_of_bounded_sphere_3>
Side_of_bounded_sphere_3;
// Degenerate dimension predicates
typedef Traits_with_offsets_adaptor<Self, typename K::Coplanar_orientation_3>
// Required for Periodic_3_Delaunay_triangulation_remove_traits
typedef Functor_with_offset_points_adaptor<Self, typename K::Coplanar_orientation_3>
Coplanar_orientation_3;
typedef Traits_with_offsets_adaptor<Self,
typename K::Coplanar_side_of_bounded_circle_3>
typedef Functor_with_offset_points_adaptor<Self, typename K::Coplanar_side_of_bounded_circle_3>
Coplanar_side_of_bounded_circle_3;
// When is_Gabriel is used
typedef Functor_with_offset_points_adaptor<Self, typename K::Side_of_bounded_sphere_3>
Side_of_bounded_sphere_3;
// Delaunay specific constructions
typedef Traits_with_offsets_adaptor<Self,
typename K::Construct_circumcenter_3>
typedef Functor_with_offset_points_adaptor<Self, typename K::Construct_circumcenter_3>
Construct_circumcenter_3;
using Base::construct_point_3_object;
// Operations
Side_of_oriented_sphere_3
side_of_oriented_sphere_3_object() const {
return Side_of_oriented_sphere_3(&this->_domain);
Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const {
return Side_of_oriented_sphere_3(this->Base::side_of_oriented_sphere_3_object(),
construct_point_3_object());
}
Compare_distance_3
compare_distance_3_object() const {
return Compare_distance_3(&this->_domain);
Compare_distance_3 compare_distance_3_object() const {
return Compare_distance_3(this->Base::compare_distance_3_object(),
construct_point_3_object());
}
Side_of_bounded_sphere_3
side_of_bounded_sphere_3_object() const {
return Side_of_bounded_sphere_3(&this->_domain);
Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object() const {
return Side_of_bounded_sphere_3(this->Base::side_of_bounded_sphere_3_object(),
construct_point_3_object());
}
Coplanar_orientation_3
coplanar_orientation_3_object() const {
return Coplanar_orientation_3(&this->_domain);
Coplanar_orientation_3 coplanar_orientation_3_object() const {
return Coplanar_orientation_3(this->Base::coplanar_orientation_3_object(),
construct_point_3_object());
}
Coplanar_side_of_bounded_circle_3
coplanar_side_of_bounded_circle_3_object() const {
return Coplanar_side_of_bounded_circle_3(&this->_domain);
Coplanar_side_of_bounded_circle_3 coplanar_side_of_bounded_circle_3_object() const {
return Coplanar_side_of_bounded_circle_3(this->Base::coplanar_side_of_bounded_circle_3_object(),
construct_point_3_object());
}
Construct_circumcenter_3
construct_circumcenter_3_object() const {
return Construct_circumcenter_3(&this->_domain);
Construct_circumcenter_3 construct_circumcenter_3_object() const {
return Construct_circumcenter_3(this->Base::construct_circumcenter_3_object(),
construct_point_3_object());
}
};
@@ -123,24 +128,36 @@ class Periodic_3_Delaunay_triangulation_traits_3;
namespace CGAL {
// This declaration is needed to break the cyclic dependency.
template < typename K, typename Off, bool Has_static_filters >
class Periodic_3_Delaunay_triangulation_filtered_traits_3;
template < class K, class Off>
class Periodic_3_Delaunay_triangulation_traits_3<K, Off, false>
: public Periodic_3_Delaunay_triangulation_traits_base_3<K, Off>
{
typedef Periodic_3_Delaunay_triangulation_traits_base_3<K, Off> Base;
public:
typedef K Kernel;
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_Delaunay_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1),
const K& k = K())
: Base(domain, k)
{ }
};
template < typename K, typename Off >
class Periodic_3_Delaunay_triangulation_traits_3 <K, Off, true>
: public Periodic_3_Delaunay_triangulation_filtered_traits_3 < K, Off, internal::Has_static_filters<K>::value >
class Periodic_3_Delaunay_triangulation_traits_3<K, Off, true>
: public Periodic_3_Delaunay_triangulation_filtered_traits_3<
K, Off, internal::Has_static_filters<K>::value>
{
typedef Periodic_3_Delaunay_triangulation_filtered_traits_3<
K, Off, internal::Has_static_filters<K>::value> Base;
public:
typedef K Kernel;
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_Delaunay_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1),
const K& k = K())
: Base(domain, k)
{ }
};
} //namespace CGAL
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -24,18 +24,18 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/basic.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Cartesian.h>
namespace CGAL {
namespace CGAL {
class Periodic_3_offset_3 {
class Periodic_3_offset_3
{
template <class K2>
friend std::ostream & operator<<(std::ostream &os,
const Periodic_3_offset_3 &off);
friend std::ostream & operator<<(std::ostream &os,
const Periodic_3_offset_3 &off);
public:
Periodic_3_offset_3() : _offx(0), _offy(0), _offz(0) {}
Periodic_3_offset_3(int x, int y, int z) : _offx(x), _offy(y), _offz(z) {}
@@ -78,13 +78,13 @@ public:
}
bool operator==(const Periodic_3_offset_3 &other) const {
return ((_offx == other._offx) &&
(_offy == other._offy) &&
(_offz == other._offz));
(_offy == other._offy) &&
(_offz == other._offz));
}
bool operator!=(const Periodic_3_offset_3 &other) const {
return ((_offx != other._offx) ||
(_offy != other._offy) ||
(_offz != other._offz));
(_offy != other._offy) ||
(_offz != other._offz));
}
bool operator<(const Periodic_3_offset_3 &other) const {
if (_offx != other._offx)
@@ -104,8 +104,8 @@ public:
Periodic_3_offset_3 operator-(const Periodic_3_offset_3 &off2) const {
return Periodic_3_offset_3(_offx-off2.x(), _offy-off2.y(), _offz-off2.z());
}
private:
private:
int _offx, _offy, _offz;
};
@@ -114,7 +114,7 @@ inline Point_3<K> operator+(const Point_3<K> &p, const Periodic_3_offset_3 &off)
return (off.is_null() ? p : Point_3<K>(p.x()+off.x(), p.y()+off.y(), p.z()+off.z()));
}
inline std::ostream
inline std::ostream
&operator<<(std::ostream &os, const Periodic_3_offset_3 &off) {
if (is_ascii(os))
os << off.x() << " " << off.y() << " " << off.z();
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,167 @@
// Copyright (c) 1999-2004,2006-2009,2013-2015,2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@inria.fr>
// Aymeric Pelle <Aymeric.Pelle@sophia.inria.fr>
// Mael Rouxel-Labbé
#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_TRAITS_3_H
#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/internal/Functor_with_offset_weighted_points_adaptor.h>
#include <CGAL/internal/Periodic_3_construct_weighted_point_3.h>
#include <CGAL/Periodic_3_offset_3.h>
#include <CGAL/Periodic_3_triangulation_traits_3.h>
#include <CGAL/basic.h>
#include <CGAL/internal/Has_boolean_tags.h>
namespace CGAL {
template <class K, class Off = typename CGAL::Periodic_3_offset_3>
class Periodic_3_regular_triangulation_traits_base_3
: public Periodic_3_triangulation_traits_3<K, Off>
{
typedef Periodic_3_regular_triangulation_traits_base_3<K, Off> Self;
typedef Periodic_3_triangulation_traits_3<K, Off> Base;
public:
typedef K Kernel;
typedef Off Offset;
typedef typename Base::RT RT;
typedef typename Base::FT FT;
typedef typename Base::Point_3 Point_3;
typedef typename Base::Weighted_point_3 Weighted_point_3;
typedef typename Base::Periodic_3_offset_3 Periodic_3_offset_3;
typedef typename Base::Iso_cuboid_3 Iso_cuboid_3;
typedef typename Base::Segment_3 Segment_3;
typedef typename Base::Triangle_3 Triangle_3;
typedef typename Base::Tetrahedron_3 Tetrahedron_3;
public:
Periodic_3_regular_triangulation_traits_base_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
// Construct_weighted_point_3 with offset
typedef Periodic_3_construct_weighted_point_3<Self, typename K::Construct_weighted_point_3>
Construct_weighted_point_3;
typedef Functor_with_offset_weighted_points_adaptor<Self, typename K::Power_side_of_oriented_power_sphere_3>
Power_side_of_oriented_power_sphere_3;
typedef Functor_with_offset_weighted_points_adaptor<Self, typename K::Compare_weighted_squared_radius_3>
Compare_weighted_squared_radius_3;
typedef Functor_with_offset_weighted_points_adaptor<Self, typename K::Compare_power_distance_3>
Compare_power_distance_3;
// Required for Periodic_3_regular_remove_traits
typedef Functor_with_offset_weighted_points_adaptor<Self, typename K::Coplanar_orientation_3>
Coplanar_orientation_3;
// When dual operations are used
typedef Functor_with_offset_weighted_points_adaptor<Self, typename K::Construct_weighted_circumcenter_3>
Construct_weighted_circumcenter_3;
// Operations
using Base::construct_point_3_object;
Construct_weighted_point_3 construct_weighted_point_3_object() const {
return Construct_weighted_point_3(&this->_domain,
this->Base::construct_weighted_point_3_object());
}
// construction
Construct_weighted_circumcenter_3 construct_weighted_circumcenter_3_object() const {
return Construct_weighted_circumcenter_3(
this->Base::construct_weighted_circumcenter_3_object(),
construct_point_3_object(), construct_weighted_point_3_object());
}
// predicates
Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere_3_object() const {
return Power_side_of_oriented_power_sphere_3(
this->Base::power_side_of_oriented_power_sphere_3_object(),
construct_point_3_object(), construct_weighted_point_3_object());
}
Compare_power_distance_3 compare_power_distance_3_object() const {
return Compare_power_distance_3(
this->Base::compare_power_distance_3_object(),
construct_point_3_object(), construct_weighted_point_3_object());
}
Compare_weighted_squared_radius_3 compare_weighted_squared_radius_3_object() const {
return Compare_weighted_squared_radius_3(
this->Base::compare_weighted_squared_radius_3_object(),
construct_point_3_object(), construct_weighted_point_3_object());
}
Coplanar_orientation_3 coplanar_orientation_3_object() const {
return Coplanar_orientation_3(
this->Base::coplanar_orientation_3_object(),
construct_point_3_object(), construct_weighted_point_3_object());
}
};
template<typename K,
typename Off = CGAL::Periodic_3_offset_3,
bool Has_filtered_predicates = K::Has_filtered_predicates>
class Periodic_3_regular_triangulation_traits_3;
} // namespace CGAL
#include <CGAL/internal/Periodic_3_regular_triangulation_filtered_traits_3.h>
namespace CGAL
{
template<class K, class Off>
class Periodic_3_regular_triangulation_traits_3<K, Off, false /* Has_filtered_predicates */>
: public Periodic_3_regular_triangulation_traits_base_3<K, Off>
{
typedef Periodic_3_regular_triangulation_traits_base_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_regular_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1),
const K& k = K())
: Base(domain, k)
{ }
};
template <typename K, typename Off>
class Periodic_3_regular_triangulation_traits_3<K, Off, true /* Has_filtered_predicates */ >
: public Periodic_3_regular_triangulation_filtered_traits_3<K, Off>
{
typedef Periodic_3_regular_triangulation_filtered_traits_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_regular_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1),
const K& k = K())
: Base(domain, k)
{ }
};
} //namespace CGAL
#endif
File diff suppressed because it is too large Load Diff
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
@@ -28,7 +28,6 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/basic.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/internal/Dummy_tds_3.h>
@@ -70,7 +69,7 @@ public:
const Vertex_handle& v0, const Vertex_handle& v1,
const Vertex_handle& v2, const Vertex_handle& v3,
const Cell_handle& n0, const Cell_handle& n1,
const Cell_handle& n2, const Cell_handle& n3)
const Cell_handle& n2, const Cell_handle& n3)
#ifndef CGAL_CFG_NO_CPP0X_UNIFIED_INITIALIZATION_SYNTAX
: N{n0, n1, n2, n3},
V{v0, v1, v2, v3},
@@ -87,6 +86,7 @@ public:
const Vertex_handle& vertex(int i) const
{
CGAL_triangulation_precondition( i >= 0 && i <= 3 );
CGAL_assume( i >= 0 && i <= 3 );
return V[i];
}
@@ -223,7 +223,7 @@ public:
off = ((off&511 ) | ((_off3)<<9));
}
}
// CHECKING
// the following trivial is_valid allows
@@ -241,7 +241,7 @@ public:
TDS_data& tds_data() { return _tds_data; }
const TDS_data& tds_data() const { return _tds_data; }
// TODO: Get rid of this flag! Used in convert_to_1_cover.
// TODO: Get rid of this flag! Used in convert_to_1_sheeted_covering.
// Either use the conflict flag or a std::map.
void set_additional_flag(unsigned char f) {
CGAL_triangulation_assertion(f < 4);
@@ -250,7 +250,7 @@ public:
unsigned char get_additional_flag() const {
return _additional_flag;
}
private:
Cell_handle N[4];
Vertex_handle V[4];
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -24,7 +24,6 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/basic.h>
#include <CGAL/internal/Dummy_tds_3.h>
#include <CGAL/Periodic_3_offset_3.h>
@@ -47,7 +46,7 @@ public:
Periodic_3_triangulation_ds_vertex_base_3()
: _c(), _off(), offset_flag(false) {}
Periodic_3_triangulation_ds_vertex_base_3(const Cell_handle& c)
: _c(c), _off(), offset_flag(false) {}
@@ -59,7 +58,7 @@ public:
const Offset& offset() const
{ return _off; }
void set_offset(const Offset& off)
{ _off = off; offset_flag=true; }
@@ -71,10 +70,10 @@ public:
bool get_offset_flag() const { return offset_flag; }
// the following trivial is_valid allows
// the user of derived cell base classes
// the user of derived cell base classes
// to add their own purpose checking
bool is_valid(bool = false, int = 0) const
{
{
return cell() != Cell_handle();
}
@@ -87,8 +86,14 @@ public:
private:
Cell_handle _c;
Offset _off;
int _index;
bool offset_flag;
// The typedef and the bool are used by Triangulation_data_structure::Vertex_extractor
// The names are choosen complicated so that we do not have to document them
// (privacy by obfuscation)
public:
typedef bool Has_visited_for_vertex_extractor;
bool visited_for_vertex_extractor;
};
template < class TDS >
@@ -24,7 +24,6 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/basic.h>
#include <CGAL/array.h>
#include <CGAL/Triangulation_hierarchy_vertex_base_3.h>
@@ -33,6 +32,11 @@
#include <boost/random/geometric_distribution.hpp>
#include <boost/random/variate_generator.hpp>
#include <algorithm>
#include <cstddef>
#include <map>
#include <vector>
namespace CGAL {
template < class PTr >
@@ -82,16 +86,16 @@ public:
template < typename InputIterator >
Periodic_3_triangulation_hierarchy_3(InputIterator first, InputIterator last,
const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1),
const Geom_traits& traits = Geom_traits())
const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1),
const Geom_traits& traits = Geom_traits())
: PTr_Base(domain,traits), level_mult_cover(0)
{
hierarchy[0] = this;
for(int i=1; i<maxlevel; ++i)
hierarchy[i] = new PTr_Base(domain,traits);
insert(first, last);
hierarchy[0] = this;
for(int i=1; i<maxlevel; ++i)
hierarchy[i] = new PTr_Base(domain,traits);
insert(first, last);
}
Periodic_3_triangulation_hierarchy_3 & operator=(
const Periodic_3_triangulation_hierarchy_3& tr)
{
@@ -111,7 +115,7 @@ public:
// INSERT REMOVE
Vertex_handle insert(const Point &p, Cell_handle start = Cell_handle ());
Vertex_handle insert(const Point &p, Locate_type lt, Cell_handle loc,
int li, int lj);
int li, int lj);
template < class InputIterator >
std::ptrdiff_t insert(InputIterator first, InputIterator last, bool = false)
@@ -127,27 +131,26 @@ public:
// would give us.
Cell_handle hints[maxlevel];
for (typename std::vector<Point>::const_iterator p = points.begin(),
end = points.end(); p != end; ++p) {
end = points.end(); p != end; ++p) {
int vertex_level = random_level();
Vertex_handle v = hierarchy[0]->insert (*p, hints[0]);
hints[0] = v->cell();
Vertex_handle prev = v;
for (int level = 1; level <= vertex_level; ++level) {
v = hierarchy[level]->insert (*p, hints[level]);
hints[level] = v->cell();
v->set_down (prev);
if (hierarchy[level]->number_of_sheets()[0] != 1) {
std::vector<Vertex_handle> vtc
= hierarchy[level]->periodic_copies(v);
for (unsigned int i=0 ; i<vtc.size() ; i++) vtc[i]->set_down(prev);
}
prev->set_up (v);
prev = v;
Vertex_handle prev = v;
for (int level = 1; level <= vertex_level; ++level) {
v = hierarchy[level]->insert (*p, hints[level]);
hints[level] = v->cell();
v->set_down (prev);
if (hierarchy[level]->number_of_sheets()[0] != 1) {
std::vector<Vertex_handle> vtc = hierarchy[level]->periodic_copies(v);
for (unsigned int i=0 ; i<vtc.size() ; i++) vtc[i]->set_down(prev);
}
prev->set_up (v);
prev = v;
}
}
return number_of_vertices() - n;
@@ -165,11 +168,13 @@ public:
return n-number_of_vertices();
}
// @todo should be deprecated and a function move() should be introduced
// see what is done in /Triangulation_3
Vertex_handle move_point(Vertex_handle v, const Point & p);
//LOCATE
Cell_handle locate(const Point& p, Locate_type& lt, int& li, int& lj,
Cell_handle start = Cell_handle ()) const;
Cell_handle start = Cell_handle ()) const;
Cell_handle locate(const Point& p, Cell_handle start = Cell_handle ()) const;
Vertex_handle
@@ -178,13 +183,13 @@ public:
private:
struct locs {
Cell_handle pos;
int li, lj;
Locate_type lt;
Cell_handle pos;
int li, lj;
Locate_type lt;
};
void locate(const Point& p, Locate_type& lt, int& li, int& lj,
locs pos[maxlevel], Cell_handle start = Cell_handle ()) const;
locs pos[maxlevel], Cell_handle start = Cell_handle ()) const;
int random_level();
// added to make the test program of usual triangulations work
@@ -199,8 +204,8 @@ Periodic_3_triangulation_hierarchy_3<PTr>::
Periodic_3_triangulation_hierarchy_3(
const Iso_cuboid& domain, const Geom_traits& traits)
: PTr_Base(domain, traits), level_mult_cover(0)
{
hierarchy[0] = this;
{
hierarchy[0] = this;
for(int i=1;i<maxlevel;++i)
hierarchy[i] = new PTr_Base(domain,traits);
}
@@ -211,7 +216,7 @@ Periodic_3_triangulation_hierarchy_3<PTr>::
Periodic_3_triangulation_hierarchy_3(
const Periodic_3_triangulation_hierarchy_3<PTr> &tr)
: PTr_Base(tr), level_mult_cover(tr.level_mult_cover)
{
{
hierarchy[0] = this;
for(int i=1; i<maxlevel; ++i)
hierarchy[i] = new PTr_Base(*tr.hierarchy[i]);
@@ -221,7 +226,7 @@ Periodic_3_triangulation_hierarchy_3(
std::map< Vertex_handle, Vertex_handle > V;
for( Vertex_iterator it=hierarchy[0]->vertices_begin();
for( Vertex_iterator it=hierarchy[0]->vertices_begin();
it != hierarchy[0]->vertices_end(); ++it) {
if (hierarchy[0]->is_virtual(it)) continue;
if (it->up() != Vertex_handle())
@@ -230,15 +235,15 @@ Periodic_3_triangulation_hierarchy_3(
for(int j=1; j<maxlevel; ++j) {
for( Vertex_iterator it=hierarchy[j]->vertices_begin();
it != hierarchy[j]->vertices_end(); ++it) {
it != hierarchy[j]->vertices_end(); ++it) {
if (hierarchy[j]->is_virtual(it)) {
// down pointer goes in original instead in copied triangulation
it->set_down(V[it->down()]);
// make reverse link
it->down()->set_up( it );
// make map for next level
if (it->up() != Vertex_handle())
V[ it->up()->down() ] = it;
// down pointer goes in original instead in copied triangulation
it->set_down(V[it->down()]);
// make reverse link
it->down()->set_up( it );
// make map for next level
if (it->up() != Vertex_handle())
V[ it->up()->down() ] = it;
}
}
}
@@ -246,16 +251,16 @@ Periodic_3_triangulation_hierarchy_3(
template <class PTr>
void
Periodic_3_triangulation_hierarchy_3<PTr>::
Periodic_3_triangulation_hierarchy_3<PTr>::
swap(Periodic_3_triangulation_hierarchy_3<PTr> &tr)
{
PTr_Base::swap(tr);
for(int i=1; i<maxlevel; ++i)
std::swap(hierarchy[i], tr.hierarchy[i]);
std::swap(hierarchy[i], tr.hierarchy[i]);
}
template <class PTr>
Periodic_3_triangulation_hierarchy_3<PTr>::
Periodic_3_triangulation_hierarchy_3<PTr>::
~Periodic_3_triangulation_hierarchy_3()
{
clear();
@@ -265,48 +270,48 @@ Periodic_3_triangulation_hierarchy_3<PTr>::
template <class PTr>
void
Periodic_3_triangulation_hierarchy_3<PTr>::
Periodic_3_triangulation_hierarchy_3<PTr>::
clear()
{
for(int i=0;i<maxlevel;++i)
hierarchy[i]->clear();
for(int i=0;i<maxlevel;++i)
hierarchy[i]->clear();
}
template <class PTr>
bool
Periodic_3_triangulation_hierarchy_3<PTr>::
Periodic_3_triangulation_hierarchy_3<PTr>::
is_valid(bool verbose, int level) const
{
bool result = true;
// verify correctness of triangulation at all levels
for(int i=0; i<maxlevel; ++i)
result = result && hierarchy[i]->is_valid(verbose, level);
result = result && hierarchy[i]->is_valid(verbose, level);
// verify that lower level has no down pointers
for( Vertex_iterator it = hierarchy[0]->vertices_begin();
it != hierarchy[0]->vertices_end(); ++it)
for( Vertex_iterator it = hierarchy[0]->vertices_begin();
it != hierarchy[0]->vertices_end(); ++it)
if (!hierarchy[0]->is_virtual(it))
result = result && (it->down() == Vertex_handle());
// verify that other levels has down pointer and reciprocal link is fine
for(int j=1; j<maxlevel; ++j)
for( Vertex_iterator it = hierarchy[j]->vertices_begin();
it != hierarchy[j]->vertices_end(); ++it)
for( Vertex_iterator it = hierarchy[j]->vertices_begin();
it != hierarchy[j]->vertices_end(); ++it)
if (!hierarchy[j]->is_virtual(it))
result = result && &*(it) == &*(it->down()->up());
result = result && &*(it) == &*(it->down()->up());
// verify that other levels has down pointer and reciprocal link is fine
for(int k=0; k<maxlevel-1; ++k)
for( Vertex_iterator it = hierarchy[k]->vertices_begin();
it != hierarchy[k]->vertices_end(); ++it)
for( Vertex_iterator it = hierarchy[k]->vertices_begin();
it != hierarchy[k]->vertices_end(); ++it)
if (!hierarchy[k]->is_virtual(it))
result = result && ( it->up() == Vertex_handle() ||
&*it == &*(it->up())->down() );
result = result && ( it->up() == Vertex_handle() ||
&*it == &*(it->up())->down() );
return result;
}
template <class PTr>
typename Periodic_3_triangulation_hierarchy_3<PTr>::Vertex_handle
Periodic_3_triangulation_hierarchy_3<PTr>::
@@ -320,27 +325,26 @@ insert(const Point &p, Cell_handle start)
locate(p, lt, i, j, positions, start);
// insert at level 0
Vertex_handle vertex = hierarchy[0]->insert(p,
positions[0].lt,
positions[0].pos,
positions[0].li,
positions[0].lj);
positions[0].lt,
positions[0].pos,
positions[0].li,
positions[0].lj);
Vertex_handle previous = vertex;
Vertex_handle first = vertex;
int level = 1;
while (level <= vertex_level ){
if (positions[level].pos == Cell_handle())
vertex = hierarchy[level]->insert(p);
else
vertex = hierarchy[level]->insert(p,
positions[level].lt,
positions[level].pos,
positions[level].li,
positions[level].lj);
if (positions[level].pos == Cell_handle())
vertex = hierarchy[level]->insert(p);
else
vertex = hierarchy[level]->insert(p,
positions[level].lt,
positions[level].pos,
positions[level].li,
positions[level].lj);
vertex->set_down(previous);// link with level above
if (hierarchy[level]->number_of_sheets()[0] != 1) {
std::vector<Vertex_handle> vtc
= hierarchy[level]->periodic_copies(vertex);
std::vector<Vertex_handle> vtc = hierarchy[level]->periodic_copies(vertex);
for (unsigned int i=0 ; i<vtc.size() ; i++) vtc[i]->set_down(previous);
}
previous->set_up(vertex);
@@ -367,22 +371,22 @@ insert(const Point &p, Locate_type lt, Cell_handle loc, int li, int lj)
// locate using hierarchy
locs positions[maxlevel];
locate(p, lt, i, j, positions, loc);
int level = 1;
while (level <= vertex_level ){
if (positions[level].pos == Cell_handle())
vertex = hierarchy[level]->insert(p);
vertex = hierarchy[level]->insert(p);
else
vertex = hierarchy[level]->insert(p,
positions[level].lt,
positions[level].pos,
positions[level].li,
positions[level].lj);
vertex = hierarchy[level]->insert(p,
positions[level].lt,
positions[level].pos,
positions[level].li,
positions[level].lj);
vertex->set_down(previous);// link with level above
if (hierarchy[level]->number_of_sheets()[0] != 1) {
std::vector<Vertex_handle> vtc
= hierarchy[level]->periodic_copies(vertex);
for (unsigned int i=0 ; i<vtc.size() ; i++) vtc[i]->set_down(previous);
std::vector<Vertex_handle> vtc
= hierarchy[level]->periodic_copies(vertex);
for (unsigned int i=0 ; i<vtc.size() ; i++) vtc[i]->set_down(previous);
}
previous->set_up(vertex);
previous=vertex;
@@ -403,7 +407,7 @@ remove(Vertex_handle v)
Vertex_handle u = v->up();
hierarchy[l]->remove(v);
if (u == Vertex_handle())
break;
break;
v = u;
}
}
@@ -421,25 +425,25 @@ move_point(Vertex_handle v, const Point & p)
CGAL_triangulation_assertion(hierarchy[l]->is_valid());
Vertex_handle w = hierarchy[l]->move_point(v, p);
if (l == 0) {
ret = w;
ret = w;
}
else {
old->set_up(w);
w->set_down(old);
if (hierarchy[l]->number_of_sheets()[0] != 1) {
std::vector<Vertex_handle> vtc = hierarchy[l]->periodic_copies(w);
for (unsigned int i=0 ; i<vtc.size() ; i++) vtc[i]->set_down(old);
}
old->set_up(w);
w->set_down(old);
if (hierarchy[l]->number_of_sheets()[0] != 1) {
std::vector<Vertex_handle> vtc = hierarchy[l]->periodic_copies(w);
for (unsigned int i=0 ; i<vtc.size() ; i++) vtc[i]->set_down(old);
}
}
if (u == Vertex_handle())
break;
break;
old = w;
v = u;
}
return ret;
}
template <class PTr>
inline
typename Periodic_3_triangulation_hierarchy_3<PTr>::Cell_handle
@@ -454,7 +458,7 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj, Cell_handle start) con
template <class PTr>
inline
typename Periodic_3_triangulation_hierarchy_3<PTr>::Cell_handle
typename Periodic_3_triangulation_hierarchy_3<PTr>::Cell_handle
Periodic_3_triangulation_hierarchy_3<PTr>::
locate(const Point& p, Cell_handle start) const
{
@@ -475,24 +479,24 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj,
// find the highest level with enough vertices
while (hierarchy[--level]->number_of_vertices() < (size_type) minsize) {
if ( ! level)
break; // do not go below 0
break; // do not go below 0
}
for (int i=level+1; i<maxlevel; ++i)
pos[i].pos = Cell_handle();
pos[i].pos = Cell_handle();
Cell_handle position = Cell_handle();
while(level > 0) {
// locate at that level from "position"
// result is stored in "position" for the next level
pos[level].pos = position = hierarchy[level]->locate(p,
pos[level].lt,
pos[level].li,
pos[level].lj,
position);
pos[level].lt,
pos[level].li,
pos[level].lj,
position);
// find the nearest vertex.
Vertex_handle nearest =
hierarchy[level]->nearest_vertex_in_cell(position,p);
hierarchy[level]->nearest_vertex_in_cell(position,p);
// go at the same vertex on level below
nearest = nearest->down();
@@ -507,12 +511,12 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj,
}
template <class PTr>
typename Periodic_3_triangulation_hierarchy_3<PTr>::Vertex_handle
typename Periodic_3_triangulation_hierarchy_3<PTr>::Vertex_handle
Periodic_3_triangulation_hierarchy_3<PTr>::
nearest_vertex(const Point& p, Cell_handle start) const
{
return PTr_Base::nearest_vertex(p, start != Cell_handle() ? start
: locate(p));
return PTr_Base::nearest_vertex(p, start != Cell_handle() ? start
: locate(p));
}
template <class PTr>
@@ -521,13 +525,13 @@ Periodic_3_triangulation_hierarchy_3<PTr>::
random_level()
{
if ( level_mult_cover < maxlevel
&& hierarchy[level_mult_cover]->number_of_sheets() == make_array(1,1,1) )
&& hierarchy[level_mult_cover]->number_of_sheets() == make_array(1,1,1) )
++level_mult_cover;
boost::geometric_distribution<> proba(1.0/ratio);
boost::variate_generator<boost::rand48&, boost::geometric_distribution<> >
die(random, proba);
return (std::min)(die()-1, level_mult_cover);
boost::geometric_distribution<> proba(1.0/ratio);
boost::variate_generator<boost::rand48&, boost::geometric_distribution<> >
die(random, proba);
return (std::min)(die()-1, level_mult_cover);
}
} //namespace CGAL
@@ -1,4 +1,4 @@
// Copyright (c) 2006-2009 INRIA Sophia-Antipolis (France).
// Copyright (c) 2006-2009,2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -12,10 +12,6 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -24,24 +20,26 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/internal/Periodic_3_construct_point_3.h>
#include <CGAL/internal/Functor_with_offset_points_adaptor.h>
#include <CGAL/Periodic_3_offset_3.h>
#include <CGAL/basic.h>
#include <CGAL/Periodic_3_offset_3.h>
#include <CGAL/Periodic_3_construct_point_3.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Traits_with_offsets_adaptor.h>
#include <CGAL/internal/Has_boolean_tags.h>
#include <CGAL/triangulation_assertions.h>
namespace CGAL {
namespace CGAL {
template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 >
template < class K, class Off = typename CGAL::Periodic_3_offset_3 >
class Periodic_3_triangulation_traits_base_3
: public Kernel
: public K
{
typedef Periodic_3_triangulation_traits_base_3<K, Off> Self;
typedef K Base;
public:
typedef Kernel K;
typedef Off Offset;
typedef Periodic_3_triangulation_traits_base_3< K, Offset > Self;
typedef K Kernel;
typedef Off Offset;
typedef typename K::RT RT;
typedef typename K::FT FT;
@@ -53,69 +51,77 @@ public:
// The next typedef is there for backward compatibility
// Some users take their point type from the traits class.
// Before this type was Point
typedef Point_3 Point;
typedef Point_3 Point;
typedef typename K::Segment_3 Segment_3;
typedef typename K::Triangle_3 Triangle_3;
typedef typename K::Tetrahedron_3 Tetrahedron_3;
// Triangulation predicates
typedef Traits_with_offsets_adaptor<Self, typename K::Compare_xyz_3>
Compare_xyz_3;
typedef Traits_with_offsets_adaptor<Self, typename K::Orientation_3>
Orientation_3;
// Triangulation constructions
typedef Periodic_3_construct_point_3<Self, typename K::Construct_point_3>
Construct_point_3;
typedef Traits_with_offsets_adaptor<Self, typename K::Construct_segment_3>
Construct_segment_3;
typedef Traits_with_offsets_adaptor<Self, typename K::Construct_triangle_3>
Construct_triangle_3;
typedef Traits_with_offsets_adaptor<Self, typename K::Construct_tetrahedron_3>
Construct_tetrahedron_3;
public:
Periodic_3_triangulation_traits_base_3(const Iso_cuboid_3& domain,
const K& k)
: Base(k)
{
set_domain(domain);
}
// Access
void set_domain(const Iso_cuboid_3& domain) {
// will be overwritten by filtered classes to create exact and approximate
// versions of the domain
virtual void set_domain(const Iso_cuboid_3& domain) {
_domain = domain;
}
Iso_cuboid_3 get_domain() const {
// Access
const Iso_cuboid_3& get_domain() const {
return _domain;
}
// Construct_point_3 with offset
typedef Periodic_3_construct_point_3<Self, typename K::Construct_point_3>
Construct_point_3;
// Triangulation predicates
typedef Functor_with_offset_points_adaptor<Self, typename K::Compare_xyz_3>
Compare_xyz_3;
typedef Functor_with_offset_points_adaptor<Self, typename K::Orientation_3>
Orientation_3;
// Triangulation constructions
typedef Functor_with_offset_points_adaptor<Self, typename K::Construct_segment_3>
Construct_segment_3;
typedef Functor_with_offset_points_adaptor<Self, typename K::Construct_triangle_3>
Construct_triangle_3;
typedef Functor_with_offset_points_adaptor<Self, typename K::Construct_tetrahedron_3>
Construct_tetrahedron_3;
// Operations
Compare_xyz_3
compare_xyz_3_object() const {
return Compare_xyz_3(&_domain);
Construct_point_3 construct_point_3_object() const {
return Construct_point_3(&_domain, this->K::construct_point_3_object());
}
Orientation_3
orientation_3_object() const {
return Orientation_3(&_domain);
Compare_xyz_3 compare_xyz_3_object() const {
return Compare_xyz_3(this->K::compare_xyz_3_object(), construct_point_3_object());
}
Construct_point_3
construct_point_3_object() const {
return Construct_point_3(_domain);
Orientation_3 orientation_3_object() const {
return Orientation_3(this->K::orientation_3_object(), construct_point_3_object());
}
Construct_segment_3
construct_segment_3_object() const {
return Construct_segment_3(&_domain);
Construct_segment_3 construct_segment_3_object() const {
return Construct_segment_3(this->K::construct_segment_3_object(), construct_point_3_object());
}
Construct_triangle_3
construct_triangle_3_object() const {
return Construct_triangle_3(&_domain);
Construct_triangle_3 construct_triangle_3_object() const {
return Construct_triangle_3(this->K::construct_triangle_3_object(), construct_point_3_object());
}
Construct_tetrahedron_3
construct_tetrahedron_3_object() const {
return Construct_tetrahedron_3(&_domain);
Construct_tetrahedron_3 construct_tetrahedron_3_object() const {
return Construct_tetrahedron_3(this->K::construct_tetrahedron_3_object(), construct_point_3_object());
}
protected:
Iso_cuboid_3 _domain;
};
template < typename K, typename Off = CGAL::Periodic_3_offset_3, bool Has_filtered_predicates = internal::Has_filtered_predicates<K>::value >
template < typename K,
typename Off = CGAL::Periodic_3_offset_3,
bool Has_filtered_predicates = internal::Has_filtered_predicates<K>::value >
class Periodic_3_triangulation_traits_3;
} //namespace CGAL
@@ -123,33 +129,39 @@ class Periodic_3_triangulation_traits_3;
#include <CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h>
namespace CGAL {
// This declaration is needed to break the cyclic dependency.
template < typename K, typename Off, bool Has_static_filters >
class Periodic_3_triangulation_filtered_traits_3;
template < class K, class Off, bool Has_filtered_predicates >
class Periodic_3_triangulation_traits_3
template < class K, class Off >
class Periodic_3_triangulation_traits_3<K, Off, false>
: public Periodic_3_triangulation_traits_base_3<K, Off>
{
typedef Periodic_3_triangulation_traits_base_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1),
const K& k = K())
: Base(domain, k)
{ }
};
template < typename K, typename Off >
class Periodic_3_triangulation_traits_3 < K, Off, true>
: public Periodic_3_triangulation_filtered_traits_3 < K, Off, internal::Has_static_filters<K>::value >
template < class K, class Off >
class Periodic_3_triangulation_traits_3<K, Off, true>
: public Periodic_3_triangulation_filtered_traits_3<
K, Off, internal::Has_static_filters<K>::value>
{
typedef Periodic_3_triangulation_filtered_traits_3<
K, Off, internal::Has_static_filters<K>::value> Base;
public:
typedef K Kernel;
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1),
const K& k = K())
: Base(domain, k)
{ }
};
} //namespace CGAL
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
namespace CGAL
{
template < typename K, typename Off, bool Has_filtered_predicates >
class Periodic_3_Delaunay_triangulation_traits_3;
}
#endif // CGAL_PERIODIC_3_TRIANGULATION_TRAITS_3_H
@@ -1,95 +0,0 @@
// Copyright (c) 1999-2004,2006-2009,2014-2015 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Andreas Fabri <Andreas.Fabri@sophia.inria.fr>
// Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
// Aymeric Pellé <Aymeric.Pelle@sophia.inria.fr>
#ifndef CGAL_TRAITS_WITH_OFFSETS_ADAPTOR_H
#define CGAL_TRAITS_WITH_OFFSETS_ADAPTOR_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
namespace CGAL {
template < class K, class Functor_ >
class Traits_with_offsets_adaptor {
typedef K Kernel;
typedef Functor_ Functor;
typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Offset Offset;
public:
typedef typename Kernel::Iso_cuboid_3 Iso_cuboid_3;
typedef typename Kernel::Construct_point_3 Construct_point_3;
typedef typename Functor::result_type result_type;
Traits_with_offsets_adaptor(const Iso_cuboid_3 * dom) : _domain(dom) { }
result_type operator()(const Point& p0, const Point& p1,
const Offset& o0, const Offset& o1) const {
return Functor()(pp(p0,o0),pp(p1,o1));
}
result_type operator()(const Point& p0, const Point& p1, const Point& p2,
const Offset& o0, const Offset& o1, const Offset& o2) const {
return Functor()(pp(p0,o0),pp(p1,o1),pp(p2,o2));
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2, const Point& p3,
const Offset& o0, const Offset& o1,
const Offset& o2, const Offset& o3) const {
return Functor()(pp(p0,o0),pp(p1,o1),pp(p2,o2),pp(p3,o3));
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2, const Point& p3, const Point& p4,
const Offset& o0, const Offset& o1, const Offset& o2,
const Offset& o3, const Offset& o4) const {
return Functor()(pp(p0,o0),pp(p1,o1),pp(p2,o2),
pp(p3,o3),pp(p4,o4));
}
result_type operator()(const Point& p0, const Point& p1) const {
return Functor()(p0, p1);
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2) const {
return Functor()(p0, p1, p2);
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2, const Point& p3) const {
return Functor()(p0, p1, p2, p3);
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2, const Point& p3, const Point& p4) const {
return Functor()(p0, p1, p2, p3, p4);
}
protected:
Point pp(const Point &p, const Offset &o) const {
return Construct_point_3(*_domain)(p,o);
}
public:
const Iso_cuboid_3* _domain;
};
} // namespace CGAL
#endif /* CGAL_TRAITS_WITH_OFFSETS_ADAPTOR_H */
@@ -0,0 +1,78 @@
// Copyright (c) 1999-2004,2006-2009,2014-2015 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Andreas Fabri <Andreas.Fabri@sophia.inria.fr>
// Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
// Aymeric Pellé <Aymeric.Pelle@sophia.inria.fr>
// Mael Rouxel-Labbé
#ifndef CGAL_FUNCTOR_WITH_OFFSET_POINTS_ADAPTOR_H
#define CGAL_FUNCTOR_WITH_OFFSET_POINTS_ADAPTOR_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
namespace CGAL {
template < class K_, class Functor_ >
class Functor_with_offset_points_adaptor
: public Functor_
{
typedef K_ Kernel;
typedef Functor_ Functor;
typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Offset Offset;
typedef typename Kernel::Construct_point_3 Construct_point_3;
public:
typedef typename Functor::result_type result_type;
Functor_with_offset_points_adaptor(const Functor& functor,
const Construct_point_3& cp)
: Functor_(functor), cp(cp)
{ }
// gives access to function calls without offset
using Functor::operator();
result_type operator()(const Point& p0, const Point& p1,
const Offset& o0, const Offset& o1) const {
return operator()(cp(p0,o0), cp(p1,o1));
}
result_type operator()(const Point& p0, const Point& p1, const Point& p2,
const Offset& o0, const Offset& o1, const Offset& o2) const {
return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2));
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2, const Point& p3,
const Offset& o0, const Offset& o1,
const Offset& o2, const Offset& o3) const {
return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2), cp(p3,o3));
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2, const Point& p3, const Point& p4,
const Offset& o0, const Offset& o1, const Offset& o2,
const Offset& o3, const Offset& o4) const {
return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2), cp(p3,o3), cp(p4,o4));
}
const Construct_point_3 cp;
};
} // namespace CGAL
#endif /* CGAL_FUNCTOR_WITH_OFFSET_POINTS_ADAPTOR_H */
@@ -0,0 +1,142 @@
// Copyright (c) 1999-2004,2006-2009,2014-2015,2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Andreas Fabri <Andreas.Fabri@sophia.inria.fr>
// Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
// Aymeric Pellé <Aymeric.Pelle@sophia.inria.fr>
// Mael Rouxel-Labbé
#ifndef CGAL_FUNCTOR_WITH_OFFSET_WEIGHTED_POINTS_ADAPTOR_H
#define CGAL_FUNCTOR_WITH_OFFSET_WEIGHTED_POINTS_ADAPTOR_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/internal/Functor_with_offset_points_adaptor.h>
namespace CGAL {
template < class K_, class Functor_ >
class Functor_with_offset_weighted_points_adaptor
: public Functor_with_offset_points_adaptor<K_, Functor_>
{
typedef Functor_with_offset_points_adaptor<K_, Functor_> Base;
typedef K_ Kernel;
typedef Functor_ Functor;
typedef typename Kernel::FT FT;
typedef typename Kernel::Point_3 Point_3;
typedef typename Kernel::Weighted_point_3 Weighted_point_3;
typedef typename Kernel::Offset Offset;
typedef typename Kernel::Construct_point_3 Construct_point_3;
typedef typename Kernel::Construct_weighted_point_3 Construct_weighted_point_3;
public:
typedef typename Functor::result_type result_type;
Functor_with_offset_weighted_points_adaptor(const Functor_& functor,
const Construct_point_3& cp,
const Construct_weighted_point_3& wp)
: Base(functor, cp), wp(wp)
{ }
// gives access to calls with Point_3 arguments and without offset
using Base::operator();
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Offset& o0, const Offset& o1) const {
return operator()(wp(p0, o0), wp(p1, o1));
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2,
const Offset& o0, const Offset& o1,
const Offset& o2) const {
return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2));
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Weighted_point_3& p3,
const Offset& o0, const Offset& o1,
const Offset& o2, const Offset& o3) const {
return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3));
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Weighted_point_3& p3,
const Weighted_point_3& p4,
const Offset& o0, const Offset& o1,
const Offset& o2, const Offset& o3,
const Offset& o4) const {
return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), wp(p4, o4));
}
// for `Compare_power_distance_3`
result_type operator() (const Point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2,
const Offset& o0, const Offset& o1,
const Offset& o2) const {
return operator()(this->cp(p0, o0), wp(p1, o1), wp(p2, o2));
}
// for `Compare_weighted_squared_radius_3`
result_type operator() (const Weighted_point_3& p0, const Offset& o0,
const FT w) const {
return operator()(wp(p0, o0), w);
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Offset& o0, const Offset& o1,
const FT w) const {
return operator()(wp(p0, o0), wp(p1, o1), w);
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2,
const Offset& o0, const Offset& o1,
const Offset& o2,
const FT w) const {
return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), w);
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Weighted_point_3& p3,
const Offset& o0, const Offset& o1,
const Offset& o2, const Offset& o3,
const FT w) const {
return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), w);
}
// for robust circumcenter_3
result_type operator()(const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Weighted_point_3& p3,
const Offset& o0, const Offset& o1,
const Offset& o2, const Offset& o3,
bool b) const {
return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), b);
}
const Construct_weighted_point_3 wp;
};
} // namespace CGAL
#endif /* CGAL_FUNCTOR_WITH_OFFSET_WEIGHTED_POINTS_ADAPTOR_H */
@@ -1,4 +1,4 @@
// Copyright (c) 2004,2006-2009 INRIA Sophia-Antipolis (France).
// Copyright (c) 2004,2006-2009, 2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -14,31 +14,30 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H
#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <string>
#include <CGAL/basic.h>
#include <CGAL/config.h>
#include <CGAL/Interval_nt.h>
#include <CGAL/Uncertain.h>
#include <CGAL/Profile_counter.h>
#include <CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/basic.h>
#include <CGAL/config.h>
#include <CGAL/internal/Has_boolean_tags.h>
#include <CGAL/Interval_nt.h>
#include <CGAL/Uncertain.h>
#include <CGAL/Profile_counter.h>
namespace CGAL {
// The argument is supposed to be a Filtered_kernel like kernel.
// The first template item is supposed to be a Filtered_kernel-like kernel.
template < typename K, typename Off >
class Periodic_3_Delaunay_triangulation_filtered_traits_base_3
: public Periodic_3_Delaunay_triangulation_traits_base_3<K, Off>
@@ -47,122 +46,160 @@ class Periodic_3_Delaunay_triangulation_filtered_traits_base_3
// Exact traits is based on the exact kernel.
typedef Periodic_3_Delaunay_triangulation_traits_3<typename K::Exact_kernel,
Off>
Exact_traits;
Off> Exact_traits;
// Filtering traits is based on the filtering kernel.
typedef Periodic_3_Delaunay_triangulation_traits_3<typename K::Approximate_kernel,
Off>
Filtering_traits;
Off> Filtering_traits;
private:
typedef typename K::C2E C2E;
typedef typename K::C2F C2F;
typedef typename C2E::Target_kernel::Iso_cuboid_3 Exact_iso_cuboid_3;
typedef typename C2F::Target_kernel::Iso_cuboid_3 Approximate_iso_cuboid_3;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
void set_domain(const Iso_cuboid_3& domain) {
C2E c2e;
C2F c2f;
this->_domain = domain;
this->_domain_e = c2e(this->_domain);
this->_domain_f = c2f(this->_domain);
public:
Periodic_3_Delaunay_triangulation_filtered_traits_base_3(const Iso_cuboid_3& domain,
const K& k)
:
Base(domain, k),
Delaunay_traits_e(C2E()(domain)),
Delaunay_traits_f(C2F()(domain))
{
// Problem 1: above is a default initialization of the kernel in the traits.
// Hence, if the kernel has members and we use filtered traits, then
// the members will be default constructed here...
// Problem 2: we have built filtered traits in P3Tfiltered_traits_3 and now
// we also need those two...
}
typedef Filtered_periodic_predicate<
typename Exact_traits::Compare_xyz_3,
typename Filtering_traits::Compare_xyz_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Compare_xyz_3;
virtual void set_domain(const Iso_cuboid_3& domain)
{
this->_domain = domain;
this->set_filtrating_traits(domain);
set_filtrating_Delaunay_traits(domain);
}
typedef Filtered_periodic_predicate<
typename Exact_traits::Coplanar_orientation_3,
typename Filtering_traits::Coplanar_orientation_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Coplanar_orientation_3;
void set_filtrating_Delaunay_traits(const Iso_cuboid_3& domain)
{
Delaunay_traits_e.set_domain(C2E()(domain));
Delaunay_traits_f.set_domain(C2F()(domain));
}
typedef Filtered_periodic_predicate<
typename Exact_traits::Orientation_3,
typename Filtering_traits::Orientation_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Orientation_3;
typedef Filtered_periodic_predicate<
typename Exact_traits::Coplanar_side_of_bounded_circle_3,
typename Filtering_traits::Coplanar_side_of_bounded_circle_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Coplanar_side_of_bounded_circle_3;
typedef Filtered_periodic_predicate<
public:
typedef Filtered_predicate<
typename Exact_traits::Side_of_oriented_sphere_3,
typename Filtering_traits::Side_of_oriented_sphere_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Side_of_oriented_sphere_3;
typedef Filtered_periodic_predicate<
typedef Filtered_predicate<
typename Exact_traits::Compare_distance_3,
typename Filtering_traits::Compare_distance_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Compare_distance_3;
typedef Filtered_periodic_predicate<
typedef Filtered_predicate<
typename Exact_traits::Coplanar_orientation_3,
typename Filtering_traits::Coplanar_orientation_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Coplanar_orientation_3;
typedef Filtered_predicate<
typename Exact_traits::Coplanar_side_of_bounded_circle_3,
typename Filtering_traits::Coplanar_side_of_bounded_circle_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Coplanar_side_of_bounded_circle_3;
typedef Filtered_predicate<
typename Exact_traits::Side_of_bounded_sphere_3,
typename Filtering_traits::Side_of_bounded_sphere_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Side_of_bounded_sphere_3;
Compare_xyz_3 compare_xyz_3_object() const
{ return Compare_xyz_3(&_domain_e,&_domain_f);}
Coplanar_orientation_3 coplanar_orientation_3_object() const
{ return Coplanar_orientation_3(&_domain_e,&_domain_f); }
Orientation_3 orientation_3_object() const
{ return Orientation_3(&_domain_e,&_domain_f);}
Coplanar_side_of_bounded_circle_3
coplanar_side_of_bounded_circle_3_object() const
{ return Coplanar_side_of_bounded_circle_3(&_domain_e,&_domain_f); }
Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const
{ return Side_of_oriented_sphere_3(&_domain_e,&_domain_f);}
{
typename Exact_traits::Side_of_oriented_sphere_3 pe = Delaunay_traits_e.side_of_oriented_sphere_3_object();
typename Filtering_traits::Side_of_oriented_sphere_3 pf = Delaunay_traits_f.side_of_oriented_sphere_3_object();
return Side_of_oriented_sphere_3(pe, pf);
}
Compare_distance_3 compare_distance_3_object() const
{ return Compare_distance_3(&_domain_e,&_domain_f);}
{
typename Exact_traits::Compare_distance_3 pe = Delaunay_traits_e.compare_distance_3_object();
typename Filtering_traits::Compare_distance_3 pf = Delaunay_traits_f.compare_distance_3_object();
return Compare_distance_3(pe, pf);
}
Coplanar_orientation_3 coplanar_orientation_3_object() const
{
typename Exact_traits::Coplanar_orientation_3 pe = Delaunay_traits_e.coplanar_orientation_3_object();
typename Filtering_traits::Coplanar_orientation_3 pf = Delaunay_traits_f.coplanar_orientation_3_object();
return Coplanar_orientation_3(pe, pf);
}
Coplanar_side_of_bounded_circle_3 coplanar_side_of_bounded_circle_3_object() const
{
typename Exact_traits::Coplanar_side_of_bounded_circle_3 pe = Delaunay_traits_e.coplanar_side_of_bounded_circle_3_object();
typename Filtering_traits::Coplanar_side_of_bounded_circle_3 pf = Delaunay_traits_f.coplanar_side_of_bounded_circle_3_object();
return Coplanar_side_of_bounded_circle_3(pe, pf);
}
Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object() const
{ return Side_of_bounded_sphere_3(&_domain_e,&_domain_f);}
{
typename Exact_traits::Side_of_bounded_sphere_3 pe = Delaunay_traits_e.side_of_bounded_sphere_3_object();
typename Filtering_traits::Side_of_bounded_sphere_3 pf = Delaunay_traits_f.side_of_bounded_sphere_3_object();
// The following are inherited since they are constructions :
// Construct_segment_3
// Construct_triangle_3
// Construct_tetrahedron_3
// Construct_circumcenter_3
return Side_of_bounded_sphere_3(pe, pf);
}
protected:
Exact_iso_cuboid_3 _domain_e;
Approximate_iso_cuboid_3 _domain_f;
protected:
Exact_traits Delaunay_traits_e;
Filtering_traits Delaunay_traits_f;
};
template < typename K,
typename Off = CGAL::Periodic_3_offset_3,
bool Has_static_filters = internal::Has_static_filters<K>::value >
class Periodic_3_Delaunay_triangulation_filtered_traits_3;
} //namespace CGAL
#include <CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h>
namespace CGAL {
template < typename K, typename Off = typename CGAL::Periodic_3_offset_3, bool Has_static_filters = internal::Has_static_filters<K>::value >
class Periodic_3_Delaunay_triangulation_filtered_traits_3
: public Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<
Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K, Off> > {
template<class K, class Off>
class Periodic_3_Delaunay_triangulation_filtered_traits_3<K, Off, false>
: public Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K, Off>
{
typedef Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_Delaunay_triangulation_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
};
template < typename K_, typename Off>
class Periodic_3_Delaunay_triangulation_filtered_traits_3<K_, Off, false>
: public Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K_, Off>
template<class K, class Off>
class Periodic_3_Delaunay_triangulation_filtered_traits_3<K, Off, true>
: public Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<K, Off>
{
typedef Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<K, Off > Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_Delaunay_triangulation_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
};
} //namespace CGAL
@@ -0,0 +1,166 @@
// Copyright (c) 2009 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_REMOVE_TRAITS_3_H
#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_REMOVE_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/basic.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Periodic_3_offset_3.h>
namespace CGAL {
// Triangulation_3 uses Construct_point_3 to handle weighted and bare points.
// The default Construct_point_3 inherited by Periodic_3_triangulation_remove_traits_3
// must be overwritten by a custom Construct_point_3 that offers:
// - pair<K::Point_3, offset> --> pair<K::Point_3, offset> (identity)
template<class Gt, typename Construct_point_3_base>
class Construct_point_from_pair_3
: public Construct_point_3_base
{
typedef Construct_point_3_base Base;
// Gt::Point_3 is actually a pair <K::Point_3, offset>
typedef typename Gt::Point_3 Point_3;
public:
Construct_point_from_pair_3(const Construct_point_3_base& cp) : Base(cp) { }
using Base::operator();
const Point_3& operator()(const Point_3& p) { return p; }
};
template < class Traits_, class Functor_ >
class Functor_with_point_offset_pair_adaptor
: public Functor_
{
typedef Traits_ Traits;
typedef Functor_ Functor;
// `Traits::Point_3` is actually a `std::pair<Point_3, Offset>`
typedef typename Traits::Point_3 Point;
public:
typedef typename Functor::result_type result_type;
Functor_with_point_offset_pair_adaptor(const Functor & functor) : Functor_(functor) { }
public:
using Functor::operator();
result_type operator()(const Point& p0, const Point& p1) const {
return operator()(p0.first, p1.first,
p0.second, p1.second);
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2) const {
return operator()(p0.first, p1.first, p2.first,
p0.second, p1.second, p2.second);
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2, const Point& p3) const {
return operator()(p0.first, p1.first, p2.first, p3.first,
p0.second, p1.second, p2.second, p3.second);
}
result_type operator()(const Point& p0, const Point& p1,
const Point& p2, const Point& p3, const Point& p4) const {
return operator()(p0.first, p1.first, p2.first, p3.first, p4.first,
p0.second, p1.second, p2.second, p3.second, p4.second);
}
};
template < class Gt, class Off = typename CGAL::Periodic_3_offset_3 >
class Periodic_3_Delaunay_triangulation_remove_traits_3
: public Gt
{
typedef Periodic_3_Delaunay_triangulation_remove_traits_3<Gt, Off> Self;
typedef Gt Base;
public:
typedef Gt Geom_traits;
typedef Off Offset;
typedef typename Gt::RT RT;
typedef typename Gt::FT FT;
typedef std::pair<typename Gt::Point_3, Offset> Point_3;
// not allowing a default value for `gt` because we need to have
// an initialized domain in `gt`
Periodic_3_Delaunay_triangulation_remove_traits_3(const Gt& gt) : Base(gt) { }
// Construct point
typedef Construct_point_from_pair_3<Self, typename Gt::Construct_point_3> Construct_point_3;
// Triangulation predicates
typedef Functor_with_point_offset_pair_adaptor<Self, typename Gt::Compare_xyz_3>
Compare_xyz_3;
typedef Functor_with_point_offset_pair_adaptor<Self, typename Gt::Orientation_3>
Orientation_3;
// Delaunay Triangulation predicates
typedef Functor_with_point_offset_pair_adaptor<Self, typename Gt::Compare_distance_3>
Compare_distance_3;
typedef Functor_with_point_offset_pair_adaptor<Self, typename Gt::Side_of_oriented_sphere_3>
Side_of_oriented_sphere_3;
// Degenerate dimension predicates
typedef Functor_with_point_offset_pair_adaptor<Self, typename Gt::Coplanar_orientation_3>
Coplanar_orientation_3;
typedef Functor_with_point_offset_pair_adaptor<Self, typename Gt::Coplanar_side_of_bounded_circle_3>
Coplanar_side_of_bounded_circle_3;
// Operations
Construct_point_3
construct_point_3_object() const {
return Construct_point_3(this->Base::construct_point_3_object());
}
Compare_xyz_3
compare_xyz_3_object() const {
return Compare_xyz_3(this->Base::compare_xyz_3_object());
}
Coplanar_orientation_3
coplanar_orientation_3_object() const {
return Coplanar_orientation_3(this->Base::coplanar_orientation_3_object());
}
Orientation_3
orientation_3_object() const {
return Orientation_3(this->Base::orientation_3_object());
}
Coplanar_side_of_bounded_circle_3
coplanar_side_of_bounded_circle_3_object() const {
return Coplanar_side_of_bounded_circle_3(this->Base::coplanar_side_of_bounded_circle_3_object());
}
Side_of_oriented_sphere_3
side_of_oriented_sphere_3_object() const {
return Side_of_oriented_sphere_3(this->Base::side_of_oriented_sphere_3_object());
}
Compare_distance_3
compare_distance_3_object() const {
return Compare_distance_3(this->Base::compare_distance_3_object());
}
};
} //namespace CGAL
#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_REMOVE_TRAITS_3_H
@@ -1,4 +1,4 @@
// Copyright (c) 2001,2004,2008-2009 INRIA Sophia-Antipolis (France).
// Copyright (c) 2001,2004,2008-2009, 2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -14,49 +14,43 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
// This class gathers optimized predicates written by hand, using
// a few steps of filtering. It should work if the initial traits has
// cartesian coordinates which fit exactly in doubles.
//
// Purely static filters code has been removed, since it requires additional
// logic and is not plug'n play (requires users providing bounds).
// If it should be provided again, it should probably be separate.
#include <CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h>
#include <CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h>
// TODO :
// - add more predicates :
#include <CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h>
namespace CGAL {
// The K_base argument is supposed to provide exact primitives.
template < typename Traits >
class Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 : public Periodic_3_triangulation_statically_filtered_traits_3<Traits>
template< typename K,
typename Off = typename CGAL::Periodic_3_offset_3>
class Periodic_3_Delaunay_triangulation_statically_filtered_traits_3
: public Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K, Off>
{
typedef Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<Traits> Self;
typedef Periodic_3_Delaunay_triangulation_statically_filtered_traits_3<K, Off> Self;
typedef Periodic_3_Delaunay_triangulation_filtered_traits_base_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
typedef internal::Static_filters_predicates::Periodic_3_side_of_oriented_sphere_3<Traits>
Side_of_oriented_sphere_3;
Periodic_3_Delaunay_triangulation_statically_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
typedef internal::Static_filters_predicates::Periodic_3_side_of_oriented_sphere_3<
Self, typename Base::Side_of_oriented_sphere_3> Side_of_oriented_sphere_3;
Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const {
return Side_of_oriented_sphere_3(&this->_domain,
&this->_domain_e,
&this->_domain_f);
this->Base::side_of_oriented_sphere_3_object());
}
};
@@ -12,10 +12,6 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Andreas Fabri <Andreas.Fabri@sophia.inria.fr>
@@ -27,38 +23,45 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
namespace CGAL {
namespace CGAL
{
template < typename K, typename Construct_point_3_base>
class Periodic_3_construct_point_3 : public Construct_point_3_base
class Periodic_3_construct_point_3
: public Construct_point_3_base
{
typedef K Kernel;
typedef Construct_point_3_base Base;
typedef K Kernel;
typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Weighted_point_3 Weighted_point;
typedef typename Kernel::Offset Offset;
typedef typename Kernel::Iso_cuboid_3 Iso_cuboid_3;
public:
typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Offset Offset;
typedef typename Kernel::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_construct_point_3(const Iso_cuboid_3* dom,
const Construct_point_3_base& cp)
: Base(cp), _dom(dom)
{ }
typedef Point result_type;
Periodic_3_construct_point_3(const Iso_cuboid_3 & dom) : _dom(dom) { }
using Construct_point_3_base::operator();
using Base::operator();
Point operator() ( const Point& p, const Offset& o ) const {
return Point(p.x()+(_dom.xmax()-_dom.xmin())*o.x(),
p.y()+(_dom.ymax()-_dom.ymin())*o.y(),
p.z()+(_dom.zmax()-_dom.zmin())*o.z());
return Point(p.x() + (_dom->xmax() - _dom->xmin()) * o.x(),
p.y() + (_dom->ymax() - _dom->ymin()) * o.y(),
p.z() + (_dom->zmax() - _dom->zmin()) * o.z());
}
const typename K::Point_3&
operator()(const typename K::Weighted_point_3 & p) const
{ return p.rep().point(); }
Point operator() ( const Weighted_point& p, const Offset& o ) const {
return Point(p.x() + (_dom->xmax() - _dom->xmin()) * o.x(),
p.y() + (_dom->ymax() - _dom->ymin()) * o.y(),
p.z() + (_dom->zmax() - _dom->zmin()) * o.z());
}
private:
Iso_cuboid_3 _dom;
const Iso_cuboid_3* _dom;
};
}
#endif
} // namespace CGAL
#endif // CGAL_PERIODIC_3_CONSTRUCT_POINT_3_H
@@ -0,0 +1,58 @@
// Copyright (c) 2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Author(s) : Mael Rouxel-Labbé
#ifndef CGAL_PERIODIC_3_CONSTRUCT_WEIGHTED_POINT_3_H
#define CGAL_PERIODIC_3_CONSTRUCT_WEIGHTED_POINT_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
namespace CGAL {
template < typename K, typename Construct_weighted_point_3_base>
class Periodic_3_construct_weighted_point_3
: public Construct_weighted_point_3_base
{
typedef Construct_weighted_point_3_base Base;
typedef K Kernel;
typedef typename Kernel::Point_3 Point_3;
typedef typename Kernel::Weighted_point_3 Weighted_point_3;
typedef typename Kernel::Offset Offset;
typedef typename Kernel::Iso_cuboid_3 Iso_cuboid_3;
public:
Periodic_3_construct_weighted_point_3(const Iso_cuboid_3* dom,
const Construct_weighted_point_3_base& wp)
: Base(wp), _dom(dom)
{ }
using Base::operator();
Weighted_point_3 operator() (const Weighted_point_3& p, const Offset& o) const
{
return Weighted_point_3(Point_3(p.x() + (_dom->xmax() - _dom->xmin()) * o.x(),
p.y() + (_dom->ymax() - _dom->ymin()) * o.y(),
p.z() + (_dom->zmax() - _dom->zmin()) * o.z()),
p.weight());
}
private:
const Iso_cuboid_3* _dom;
};
} // namespace CGAL
#endif // CGAL_PERIODIC_3_CONSTRUCT_WEIGHTED_POINT_3_H
@@ -0,0 +1,190 @@
// Copyright (c) 1999-2004,2006-2009,2013-2015, 2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@inria.fr>
// Aymeric Pelle <Aymeric.Pelle@sophia.inria.fr>
// Mael Rouxel-Labbé
#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_FILTERED_TRAITS_3_H
#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_FILTERED_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/basic.h>
#include <CGAL/config.h>
#include <CGAL/internal/Has_boolean_tags.h>
#include <CGAL/Interval_nt.h>
#include <CGAL/Uncertain.h>
#include <CGAL/Profile_counter.h>
namespace CGAL {
// The first template item is supposed to be a Filtered_kernel-like kernel.
template < typename K, typename Off >
class Periodic_3_regular_triangulation_filtered_traits_base_3
: public Periodic_3_regular_triangulation_traits_base_3<K, Off>
{
typedef Periodic_3_regular_triangulation_traits_base_3<K, Off> Base;
typedef typename K::Exact_kernel EKernel;
typedef typename K::Approximate_kernel AKernel;
typedef typename K::C2E C2E;
typedef typename K::C2F C2F;
// Exact traits is based on the exact kernel.
typedef Periodic_3_regular_triangulation_traits_3<EKernel, Off> Exact_traits;
// Filtering traits is based on the filtering kernel.
typedef Periodic_3_regular_triangulation_traits_3<AKernel, Off> Filtering_traits;
private:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
public:
Periodic_3_regular_triangulation_filtered_traits_base_3(const Iso_cuboid_3& domain,
const K& k)
:
Base(domain, k),
regular_traits_e(C2E()(domain)),
regular_traits_f(C2F()(domain))
{
// Problem 1: above is a default initialization of the kernel in the traits.
// Hence, if the kernel has members and we use filtered traits, then
// the members will be default constructed here...
// Problem 2: we have built filtered traits in P3Tfiltered_traits_3 and now
// we also need those two...
}
virtual void set_domain(const Iso_cuboid_3& domain)
{
this->_domain = domain;
this->set_filtrating_traits(domain);
set_filtrating_regular_traits(domain);
}
void set_filtrating_regular_traits(const Iso_cuboid_3& domain)
{
regular_traits_e.set_domain(C2E()(domain));
regular_traits_f.set_domain(C2F()(domain));
}
public:
typedef Filtered_predicate<
typename Exact_traits::Coplanar_orientation_3,
typename Filtering_traits::Coplanar_orientation_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Coplanar_orientation_3;
typedef Filtered_predicate<
typename Exact_traits::Power_side_of_oriented_power_sphere_3,
typename Filtering_traits::Power_side_of_oriented_power_sphere_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Power_side_of_oriented_power_sphere_3;
typedef Filtered_predicate<
typename Exact_traits::Compare_power_distance_3,
typename Filtering_traits::Compare_power_distance_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Compare_power_distance_3;
typedef Filtered_predicate<
typename Exact_traits::Compare_weighted_squared_radius_3,
typename Filtering_traits::Compare_weighted_squared_radius_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Compare_weighted_squared_radius_3;
Coplanar_orientation_3 coplanar_orientation_3_object() const
{
typename Exact_traits::Coplanar_orientation_3 pe = regular_traits_e.coplanar_orientation_3_object();
typename Filtering_traits::Coplanar_orientation_3 pf = regular_traits_f.coplanar_orientation_3_object();
return Coplanar_orientation_3(pe, pf);
}
Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere_3_object() const
{
typename Exact_traits::Power_side_of_oriented_power_sphere_3 pe = regular_traits_e.power_side_of_oriented_power_sphere_3_object();
typename Filtering_traits::Power_side_of_oriented_power_sphere_3 pf = regular_traits_f.power_side_of_oriented_power_sphere_3_object();
return Power_side_of_oriented_power_sphere_3(pe, pf);
}
Compare_power_distance_3 compare_power_distance_3_object() const
{
typename Exact_traits::Compare_power_distance_3 pe = regular_traits_e.compare_power_distance_3_object();
typename Filtering_traits::Compare_power_distance_3 pf = regular_traits_f.compare_power_distance_3_object();
return Compare_power_distance_3(pe, pf);
}
Compare_weighted_squared_radius_3 compare_weighted_squared_radius_3_object() const
{
typename Exact_traits::Compare_weighted_squared_radius_3 pe = regular_traits_e.compare_weighted_squared_radius_3_object();
typename Filtering_traits::Compare_weighted_squared_radius_3 pf = regular_traits_f.compare_weighted_squared_radius_3_object();
return Compare_weighted_squared_radius_3(pe, pf);
}
protected:
Exact_traits regular_traits_e;
Filtering_traits regular_traits_f;
};
} // namespace CGAL
#include <CGAL/internal/Periodic_3_regular_triangulation_statically_filtered_traits_3.h>
namespace CGAL {
template < typename K,
typename Off = typename CGAL::Periodic_3_offset_3,
bool Has_static_filters = internal::Has_static_filters<K>::value >
class Periodic_3_regular_triangulation_filtered_traits_3
: public Periodic_3_regular_triangulation_statically_filtered_traits_3<K, Off>
{
typedef Periodic_3_regular_triangulation_statically_filtered_traits_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_regular_triangulation_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
};
template < typename K, typename Off>
class Periodic_3_regular_triangulation_filtered_traits_3<K, Off, false>
: public Periodic_3_regular_triangulation_filtered_traits_base_3<K, Off>
{
typedef Periodic_3_regular_triangulation_filtered_traits_base_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_regular_triangulation_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
};
} //namespace CGAL
#endif // CGAL_PERIODIC_3_REGULAR_TRIANGULATION_FILTERED_TRAITS_3_H
@@ -0,0 +1,250 @@
// Copyright (c) 1999-2004,2006-2009,2013-2015,2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@inria.fr>
// Aymeric Pelle <Aymeric.Pelle@sophia.inria.fr>
#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_REMOVE_TRAITS_3_H
#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_REMOVE_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/basic.h>
#include <CGAL/Periodic_3_offset_3.h>
#include <CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h>
#include <utility>
namespace CGAL
{
// Triangulation_3 has calls to Construct_point_3 to handle weighted and bare points.
// The default inherited Construct_point_3 inherited by Periodic_3_triangulation_remove_traits_3
// must be overwritten by a construction Construct_point_3 that offers:
// - pair<K::Point_3, offset> --> pair<K::Point_3, offset> (identity)
// - pair<K::Weighted_point_3, offset> --> pair<K::Point_3, offset>
template<class Gt,
typename Construct_point_3_base>
class Construct_point_from_weighted_pair_3
: public Construct_point_from_pair_3<Gt, Construct_point_3_base>
{
typedef Construct_point_from_pair_3<Gt, Construct_point_3_base> Base;
// `Traits::Point_3` is actually a `std::pair<Point_3, Offset>`
// `Traits::Weighted_point_3` is actually a `std::pair<Weighted_point_3, Offset>`
typedef typename Gt::Point_3 Point_3;
typedef typename Gt::Weighted_point_3 Weighted_point_3;
public:
Construct_point_from_weighted_pair_3(const Construct_point_3_base& cp) : Base(cp) { }
using Base::operator(); // for K::Weighted_point_3 to Point_3
Point_3 operator()(const Weighted_point_3& wp) {
return std::make_pair(operator()(wp.first), wp.second /* offset */);
}
};
template<class Traits_, class Functor_>
class Functor_with_weighted_point_offset_pair_adaptor
: public Functor_
{
typedef Traits_ Traits;
typedef Functor_ Functor;
// `Traits::Point_3` is actually a `std::pair<Point_3, Offset>`
// `Traits::Weighted_point_3` is actually a `std::pair<Weighted_point_3, Offset>`
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Weighted_point_3 Weighted_point_3;
public:
typedef typename Functor::result_type result_type;
Functor_with_weighted_point_offset_pair_adaptor (const Functor & functor)
: Functor_(functor)
{ }
public:
using Functor::operator();
result_type operator() (const Point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2) const
{
return operator()(p0.first, p1.first, p2.first,
p0.second, p1.second, p2.second);
}
// bare points
result_type operator()(const Point_3& p0, const Point_3& p1) const {
return operator()(p0.first, p1.first,
p0.second, p1.second);
}
result_type operator()(const Point_3& p0, const Point_3& p1,
const Point_3& p2) const {
return operator()(p0.first, p1.first, p2.first,
p0.second, p1.second, p2.second);
}
result_type operator()(const Point_3& p0, const Point_3& p1,
const Point_3& p2, const Point_3& p3) const {
return operator()(p0.first, p1.first, p2.first, p3.first,
p0.second, p1.second, p2.second, p3.second);
}
result_type operator()(const Point_3& p0, const Point_3& p1,
const Point_3& p2, const Point_3& p3, const Point_3& p4) const {
return operator()(p0.first, p1.first, p2.first, p3.first, p4.first,
p0.second, p1.second, p2.second, p3.second, p4.second);
}
// weighted points
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1) const
{
return operator()(p0.first, p1.first, p0.second, p1.second);
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2) const
{
return operator()(p0.first, p1.first, p2.first,
p0.second, p1.second, p2.second);
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Weighted_point_3& p3) const
{
return operator()(p0.first, p1.first, p2.first, p3.first,
p0.second, p1.second, p2.second, p3.second);
}
result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1,
const Weighted_point_3& p2, const Weighted_point_3& p3,
const Weighted_point_3& p4) const
{
return operator()(p0.first, p1.first, p2.first, p3.first, p4.first,
p0.second, p1.second, p2.second, p3.second, p4.second);
}
};
template<class Gt, class Off = typename CGAL::Periodic_3_offset_3>
class Periodic_3_regular_triangulation_remove_traits_3
: public Gt
{
typedef Periodic_3_regular_triangulation_remove_traits_3<Gt, Off> Self;
typedef Gt Base;
public:
typedef Gt Geom_traits;
typedef Off Offset;
typedef typename Gt::RT RT;
typedef typename Gt::FT FT;
typedef std::pair<typename Gt::Point_3, Offset> Point_3;
typedef std::pair<typename Gt::Weighted_point_3, Offset> Weighted_point_3;
// not allowing a default value for `gt` because we need to have
// an initialized domain in `gt`
Periodic_3_regular_triangulation_remove_traits_3(const Gt& gt) : Base(gt) { }
// Construct point
typedef Construct_point_from_weighted_pair_3<Self, typename Gt::Construct_point_3>
Construct_point_3;
// Triangulation traits
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Compare_xyz_3>
Compare_xyz_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Coplanar_orientation_3>
Coplanar_orientation_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Orientation_3>
Orientation_3;
// Regular Triangulation traits
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Power_side_of_oriented_power_sphere_3>
Power_side_of_oriented_power_sphere_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Compare_power_distance_3>
Compare_power_distance_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Power_side_of_bounded_power_sphere_3>
Power_side_of_bounded_power_sphere_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Construct_weighted_circumcenter_3>
Construct_weighted_circumcenter_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Construct_circumcenter_3>
Construct_circumcenter_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3>
Compute_squared_radius_smallest_orthogonal_sphere_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Compute_power_product_3>
Compute_power_product_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Compute_power_distance_to_power_sphere_3>
Compute_power_distance_to_power_sphere_3;
typedef Functor_with_weighted_point_offset_pair_adaptor<Self, typename Gt::Compare_weighted_squared_radius_3>
Compare_weighted_squared_radius_3;
// Operations
Construct_point_3
construct_point_3_object() const {
return Construct_point_3(this->Base::construct_point_3_object());
}
Compare_xyz_3
compare_xyz_3_object() const {
return Compare_xyz_3(this->Base::compare_xyz_3_object());
}
Coplanar_orientation_3
coplanar_orientation_3_object() const {
return Coplanar_orientation_3(this->Base::coplanar_orientation_3_object());
}
Orientation_3
orientation_3_object() const {
return Orientation_3(this->Base::orientation_3_object());
}
Power_side_of_oriented_power_sphere_3
power_side_of_oriented_power_sphere_3_object() const {
return Power_side_of_oriented_power_sphere_3(this->Base::power_side_of_oriented_power_sphere_3_object());
}
Compare_power_distance_3
compare_power_distance_3_object() const {
return Compare_power_distance_3(this->Base::compare_power_distance_3_object());
}
Power_side_of_bounded_power_sphere_3
power_side_of_bounded_power_sphere_3_object() const {
return Power_side_of_bounded_power_sphere_3(this->Base::power_side_of_bounded_power_sphere_3_object());
}
Construct_weighted_circumcenter_3
construct_weighted_circumcenter_3_object() const {
return Construct_weighted_circumcenter_3(this->Base::construct_weighted_circumcenter_3_object());
}
Construct_circumcenter_3
construct_circumcenter_3_object() const {
return Construct_circumcenter_3(this->Base::construct_circumcenter_3_object());
}
Compute_squared_radius_smallest_orthogonal_sphere_3
compute_squared_radius_smallest_orthogonal_sphere_3_object() const {
return Compute_squared_radius_smallest_orthogonal_sphere_3(this->Base::compute_squared_radius_smallest_orthogonal_sphere_3_object());
}
Compute_power_product_3
compute_power_product_3_object() const {
return Compute_power_product_3(this->Base::compute_power_product_3_object());
}
Compute_power_distance_to_power_sphere_3
compute_power_distance_to_power_sphere_3_object() const {
return Compute_power_distance_to_power_sphere_3(this->Base::compute_power_distance_to_power_sphere_3_object());
}
Compare_weighted_squared_radius_3
compare_weighted_squared_radius_3_object() const {
return Compare_weighted_squared_radius_3(this->Base::compare_weighted_squared_radius_3_object());
}
};
} //namespace CGAL
#endif // CGAL_PERIODIC_3_REGULAR_TRIANGULATION_REMOVE_TRAITS_3_H
@@ -0,0 +1,65 @@
// Copyright (c) 2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Mael Rouxel-Labbé
#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/internal/Static_filters/Periodic_3_power_side_of_oriented_power_sphere_3.h>
#include <CGAL/internal/Periodic_3_regular_triangulation_filtered_traits_3.h>
namespace CGAL {
template< typename K,
typename Off = typename CGAL::Periodic_3_offset_3>
class Periodic_3_regular_triangulation_statically_filtered_traits_3
: public Periodic_3_regular_triangulation_filtered_traits_base_3<K, Off>
{
typedef Periodic_3_regular_triangulation_statically_filtered_traits_3<K, Off> Self;
typedef Periodic_3_regular_triangulation_filtered_traits_base_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_regular_triangulation_statically_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
#if 0 // todo
typedef internal::Static_filters_predicates::
Periodic_3_power_side_of_oriented_power_sphere_3<
Self, typename Base::Periodic_3_power_side_of_oriented_power_sphere_3>
Power_side_of_oriented_power_sphere_3;
Power_side_of_oriented_power_sphere_3
power_side_of_oriented_power_sphere_3_object() const
{
return Power_side_of_oriented_power_sphere_3(&this->_domain,
&this->_domain_e,
&this->_domain_f);
}
#endif
};
} //namespace CGAL
#endif // CGAL_PERIODIC_3_REGULAR_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
@@ -14,12 +14,11 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#ifdef CGAL_INCLUDE_FROM_PERIODIC_3_TRIANGULATION_3_H
#ifdef CGAL_INCLUDE_FROM_PERIODIC_3_TRIANGULATION_3_H
template < class GT, class TDS >
inline std::vector<typename Periodic_3_triangulation_3<GT,TDS>::Vertex_handle >
@@ -28,24 +27,24 @@ Periodic_3_triangulation_3<GT,TDS>::insert_dummy_points() {
Vertex_handle vertices[36];
Cell_handle cells[216];
// Initialise vertices:
for (int i=0; i<4; i++) {
for (int j=0; j<3; j++) {
for (int k=0; k<3; k++) {
// Initialise virtual vertices out of the domain for debugging
vertices[9*i+3*j+k] = _tds.create_vertex();
Point p(k*(1.0/3.0) + i*(1.0/6.0),
j*(1.0/3.0) + i*(1.0/6.0), i*(1.0/4.0) );
p = Point((p.x() > FT(0.9375) ? (std::max)( p.x()-1, FT(0) ) : p.x()),
(p.y() > FT(0.9375) ? (std::max)( p.y()-1, FT(0) ) : p.y()), p.z());
p = Point((_domain.xmax()-_domain.xmin())*p.x(),
(_domain.xmax()-_domain.xmin())*p.y(),
(_domain.xmax()-_domain.xmin())*p.z());
p = Point(p.x() + _domain.xmin(),
p.y() + _domain.ymin(),
p.z() + _domain.zmin());
vertices[9*i+3*j+k]->set_point(p);
// Initialise virtual vertices out of the domain for debugging
vertices[9*i+3*j+k] = _tds.create_vertex();
Point p(k*(1.0/3.0) + i*(1.0/6.0),
j*(1.0/3.0) + i*(1.0/6.0), i*(1.0/4.0) );
p = Point((p.x() > FT(0.9375) ? (std::max)( p.x()-1, FT(0) ) : p.x()),
(p.y() > FT(0.9375) ? (std::max)( p.y()-1, FT(0) ) : p.y()), p.z());
p = Point((domain().xmax()-domain().xmin())*p.x(),
(domain().xmax()-domain().xmin())*p.y(),
(domain().xmax()-domain().xmin())*p.z());
p = Point(p.x() + domain().xmin(),
p.y() + domain().ymin(),
p.z() + domain().zmin());
vertices[9*i+3*j+k]->set_point(p);
}
}
}
@@ -54,7 +53,7 @@ Periodic_3_triangulation_3<GT,TDS>::insert_dummy_points() {
for (int i=0; i<216; i++) {
cells[i] = _tds.create_cell();
}
cells[0]->set_vertices(vertices[3],vertices[9],vertices[4],vertices[12]);
cells[1]->set_vertices(vertices[28],vertices[8],vertices[3],vertices[6]);
cells[2]->set_vertices(vertices[0],vertices[11],vertices[9],vertices[3]);
@@ -1,4 +1,4 @@
// Copyright (c) 2004,2006-2009 INRIA Sophia-Antipolis (France).
// Copyright (c) 2004,2006-2009,2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -12,10 +12,6 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Nico Kruithof <Nico.Kruithof@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -26,8 +22,6 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <string>
#include <CGAL/basic.h>
#include <CGAL/config.h>
#include <CGAL/Interval_nt.h>
@@ -36,42 +30,6 @@
#include <CGAL/Filtered_predicate.h>
#include <CGAL/internal/Has_boolean_tags.h>
namespace CGAL {
// This template class is a wrapper that implements the filtering for any
// predicate (dynamic filters with IA).
// TODO :
// - each predicate in the default kernel should define a tag that says if it
// wants to be filtered or not (=> all homogeneous predicate define this
// tag). We could even test-suite that automatically. It makes a strong
// new requirement on the kernel though...
// Could be done with a traits mechanism ?
// A default template could use the current IA, but other tags or whatever
// could specify no filtering at all, or static filtering...
// - same thing for constructions => virtual operator() ?
// - similarly, constructions should have a tag saying if they can throw or
// not, or we let all this up to the compiler optimizer to figure out ?
// - Some caching could be done at the Point_2 level.
template <class EP, class AP, class C2E, class C2A, bool Protection = true>
class Filtered_periodic_predicate
: public Filtered_predicate<EP, AP, C2E, C2A, Protection>
{
typedef Filtered_predicate<EP, AP, C2E, C2A, Protection> Base;
public:
Filtered_periodic_predicate() : Base() {}
// These constructors are used for constructive predicates.
// You should try to avoid constructive predicates, as they will construct
// the exact values systematically (in the ctor), rather than lazily.
template <class OE, class OA>
Filtered_periodic_predicate(const OE * oe, const OA * oa)
: Base( EP(oe), AP(oa) )
{}
};
}
#include <CGAL/Periodic_3_triangulation_traits_3.h>
namespace CGAL
@@ -95,7 +53,6 @@ struct Offset_converter_3
typedef typename Periodic_3_triangulation_traits_base_3<Target_kernel>
::Point_3 Target_pt;
using Converter::operator();
Target_off
@@ -105,108 +62,128 @@ struct Offset_converter_3
}
};
// The argument is supposed to be a Filtered_kernel like kernel.
// The first template item is supposed to be a Filtered_kernel-like kernel.
template < typename K, typename Off >
class Periodic_3_triangulation_filtered_traits_base_3
: public Periodic_3_triangulation_traits_base_3<K, Off>
{
typedef Periodic_3_triangulation_traits_base_3<K, Off> Base;
typedef Periodic_3_triangulation_traits_base_3<K, Off> Base;
typedef typename K::Exact_kernel EKernel;
typedef typename K::Approximate_kernel AKernel;
typedef typename K::C2E C2E;
typedef typename K::C2F C2F;
// Exact traits is based on the exact kernel.
typedef Periodic_3_triangulation_traits_3<typename K::Exact_kernel,
Off>
Exact_traits;
typedef Periodic_3_triangulation_traits_3<EKernel, Off> Exact_traits;
// Filtering traits is based on the filtering kernel.
typedef Periodic_3_triangulation_traits_3<typename K::Approximate_kernel,
Off>
Filtering_traits;
private:
typedef typename K::C2E C2E;
typedef typename K::C2F C2F;
typedef Periodic_3_triangulation_traits_3<AKernel, Off> Filtering_traits;
typedef typename C2E::Target_kernel::Iso_cuboid_3 Exact_iso_cuboid_3;
typedef typename C2F::Target_kernel::Iso_cuboid_3 Approximate_iso_cuboid_3;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
void set_domain(const Iso_cuboid_3& domain) {
C2E c2e;
C2F c2f;
this->_domain = domain;
this->_domain_e = c2e(this->_domain);
this->_domain_f = c2f(this->_domain);
Periodic_3_triangulation_filtered_traits_base_3(const Iso_cuboid_3& domain,
const K& k)
:
Base(domain, k),
traits_e(C2E()(domain)),
traits_f(C2F()(domain))
{
// Problem: below is a default initialization of the kernel in the traits.
// Hence, if the kernel has members and we use filtered traits, then
// the members will be default constructed here...
}
typedef Filtered_periodic_predicate<
virtual void set_domain(const Iso_cuboid_3& domain)
{
this->_domain = domain;
set_filtrating_traits(domain);
}
void set_filtrating_traits(const Iso_cuboid_3& domain)
{
traits_e.set_domain(C2E()(domain));
traits_f.set_domain(C2F()(domain));
}
typedef Filtered_predicate<
typename Exact_traits::Compare_xyz_3,
typename Filtering_traits::Compare_xyz_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Compare_xyz_3;
typedef Filtered_periodic_predicate<
typename Exact_traits::Coplanar_orientation_3,
typename Filtering_traits::Coplanar_orientation_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Coplanar_orientation_3;
typedef Filtered_periodic_predicate<
typedef Filtered_predicate<
typename Exact_traits::Orientation_3,
typename Filtering_traits::Orientation_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Orientation_3;
typedef Filtered_periodic_predicate<
typename Exact_traits::Coplanar_side_of_bounded_circle_3,
typename Filtering_traits::Coplanar_side_of_bounded_circle_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Coplanar_side_of_bounded_circle_3;
typedef Filtered_periodic_predicate<
typename Exact_traits::Compare_distance_3,
typename Filtering_traits::Compare_distance_3,
Offset_converter_3<C2E>,
Offset_converter_3<C2F> > Compare_distance_3;
Compare_xyz_3 compare_xyz_3_object() const
{ return Compare_xyz_3(&_domain_e,&_domain_f);}
{
typename Exact_traits::Compare_xyz_3 pe = traits_e.compare_xyz_3_object();
typename Filtering_traits::Compare_xyz_3 pf = traits_f.compare_xyz_3_object();
Coplanar_orientation_3 coplanar_orientation_3_object() const
{ return Coplanar_orientation_3(&_domain_e,&_domain_f); }
return Compare_xyz_3(pe, pf);
}
Orientation_3 orientation_3_object() const
{ return Orientation_3(&_domain_e,&_domain_f);}
{
typename Exact_traits::Orientation_3 pe = traits_e.orientation_3_object();
typename Filtering_traits::Orientation_3 pf = traits_f.orientation_3_object();
Coplanar_side_of_bounded_circle_3
coplanar_side_of_bounded_circle_3_object() const
{ return Coplanar_side_of_bounded_circle_3(&_domain_e,&_domain_f); }
return Orientation_3(pe, pf);
}
// The following are inherited since they are constructions :
// Construct_segment_3
// Construct_triangle_3
// Construct_tetrahedron_3
protected:
Exact_iso_cuboid_3 _domain_e;
Approximate_iso_cuboid_3 _domain_f;
protected:
Exact_traits traits_e;
Filtering_traits traits_f;
};
template < typename K,
typename Off = typename CGAL::Periodic_3_offset_3,
bool Has_static_filters = internal::Has_static_filters<K>::value >
class Periodic_3_triangulation_filtered_traits_3;
} //namespace CGAL
#include <CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h>
namespace CGAL {
template < typename K, typename Off = typename CGAL::Periodic_3_offset_3, bool Has_static_filters = internal::Has_static_filters<K>::value >
class Periodic_3_triangulation_filtered_traits_3
: public Periodic_3_triangulation_statically_filtered_traits_3<
Periodic_3_triangulation_filtered_traits_base_3<K, Off> > {
};
template < typename K, typename Off >
template<class K, class Off >
class Periodic_3_triangulation_filtered_traits_3<K, Off, false>
: public Periodic_3_triangulation_filtered_traits_base_3<K, Off>
{};
{
typedef Periodic_3_triangulation_filtered_traits_base_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_triangulation_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
};
template<class K, class Off>
class Periodic_3_triangulation_filtered_traits_3<K, Off, true>
: public Periodic_3_triangulation_statically_filtered_traits_3<K, Off>
{
typedef Periodic_3_triangulation_statically_filtered_traits_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
Periodic_3_triangulation_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
};
} //namespace CGAL
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -24,7 +24,6 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/triangulation_assertions.h>
#include <CGAL/array.h>
#include <CGAL/iterator.h>
@@ -49,7 +48,6 @@ class Periodic_3_triangulation_tetrahedron_iterator_3 {
// UNIQUE_COVER_DOMAIN.
public:
typedef typename T::Periodic_tetrahedron value_type;
typedef const typename T::Periodic_tetrahedron * pointer;
typedef const typename T::Periodic_tetrahedron & reference;
@@ -59,7 +57,7 @@ public:
typedef typename T::Periodic_tetrahedron Periodic_tetrahedron;
typedef Periodic_3_triangulation_tetrahedron_iterator_3<T>
Periodic_tetrahedron_iterator;
Periodic_tetrahedron_iterator;
typedef typename T::Cell Cell;
typedef typename T::Cell_iterator Cell_iterator;
@@ -70,17 +68,17 @@ public:
: _t(NULL), _it(it), _off(0) {}
Periodic_3_triangulation_tetrahedron_iterator_3(const T * t,
Iterator_type it = T::STORED)
Iterator_type it = T::STORED)
: _t(t), pos(_t->cells_begin()), _it(it), _off(0) {
if (_it == T::UNIQUE || _it == T::UNIQUE_COVER_DOMAIN) {
while (pos != _t->cells_end() && !is_canonical() )
++pos;
++pos;
}
}
// used to initialize the past-the-end iterator
Periodic_3_triangulation_tetrahedron_iterator_3(const T* t, int,
Iterator_type it = T::STORED)
Iterator_type it = T::STORED)
: _t(t), pos(_t->cells_end()), _it(it), _off(0) {}
Periodic_tetrahedron_iterator& operator++() {
@@ -117,41 +115,41 @@ public:
}
Periodic_tetrahedron_iterator operator++(int)
{
Periodic_tetrahedron_iterator tmp(*this);
++(*this);
return tmp;
}
{
Periodic_tetrahedron_iterator tmp(*this);
++(*this);
return tmp;
}
Periodic_tetrahedron_iterator operator--(int)
{
Periodic_tetrahedron_iterator tmp(*this);
--(*this);
return tmp;
}
{
Periodic_tetrahedron_iterator tmp(*this);
--(*this);
return tmp;
}
bool operator==(const Periodic_tetrahedron_iterator& ti) const
{
CGAL_triangulation_assertion(_it == ti._it);
return _t == ti._t && pos == ti.pos && _off == ti._off;
}
{
CGAL_triangulation_assertion(_it == ti._it);
return _t == ti._t && pos == ti.pos && _off == ti._off;
}
bool operator!=(const Periodic_tetrahedron_iterator& ti) const
{
return !(*this == ti);
}
{
return !(*this == ti);
}
reference operator*() const
{
periodic_tetrahedron = construct_periodic_tetrahedron();
return periodic_tetrahedron;
}
{
periodic_tetrahedron = construct_periodic_tetrahedron();
return periodic_tetrahedron;
}
pointer operator->() const
{
periodic_tetrahedron = construct_periodic_tetrahedron();
return &periodic_tetrahedron;
}
{
periodic_tetrahedron = construct_periodic_tetrahedron();
return &periodic_tetrahedron;
}
Cell_iterator get_cell() const
{
@@ -173,7 +171,7 @@ private:
// fetch all offsets
Offset off0, off1, off2, off3;
get_edge_offsets(off0, off1, off2, off3);
if (_t->number_of_sheets() != make_array(1,1,1)) {
// If there is one offset with entries larger than 1 then we are
// talking about a vertex that is too far away from the original
@@ -210,12 +208,12 @@ private:
if (_off == off) {
_off = 0;
do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN
&& pos != _t->cells_end() && !is_canonical());
&& pos != _t->cells_end() && !is_canonical());
} else {
do {
++_off;
++_off;
} while ((((~_off)|off)&7)!=7); // Increment until a valid
// offset has been found
// offset has been found
}
}
@@ -229,32 +227,32 @@ private:
} else {
int off = get_drawing_offsets();
do {
--_off;
--_off;
} while ((((~_off)|off)&7)!=7); // Decrement until a valid
// offset has been found
// offset has been found
}
}
// Get the canonicalized offsets of an edge.
// This works in any cover that is encoded in _t->combine_offsets
void get_edge_offsets(Offset &off0, Offset &off1,
Offset &off2, Offset &off3) const {
Offset &off2, Offset &off3) const {
Offset cell_off0 = _t->int_to_off(pos->offset(0));
Offset cell_off1 = _t->int_to_off(pos->offset(1));
Offset cell_off2 = _t->int_to_off(pos->offset(2));
Offset cell_off3 = _t->int_to_off(pos->offset(3));
Offset diff_off((cell_off0.x() == 1
&& cell_off1.x() == 1
&& cell_off2.x() == 1
&& cell_off3.x() == 1)?-1:0,
(cell_off0.y() == 1
&& cell_off1.y() == 1
&& cell_off2.y() == 1
&& cell_off3.y() == 1)?-1:0,
(cell_off0.z() == 1
&& cell_off1.z() == 1
&& cell_off2.z() == 1
&& cell_off3.z() == 1)?-1:0);
Offset diff_off((cell_off0.x() == 1
&& cell_off1.x() == 1
&& cell_off2.x() == 1
&& cell_off3.x() == 1)?-1:0,
(cell_off0.y() == 1
&& cell_off1.y() == 1
&& cell_off2.y() == 1
&& cell_off3.y() == 1)?-1:0,
(cell_off0.z() == 1
&& cell_off1.z() == 1
&& cell_off2.z() == 1
&& cell_off3.z() == 1)?-1:0);
off0 = _t->combine_offsets(_t->get_offset(pos,0), diff_off);
off1 = _t->combine_offsets(_t->get_offset(pos,1), diff_off);
off2 = _t->combine_offsets(_t->get_offset(pos,2), diff_off);
@@ -293,20 +291,20 @@ private:
CGAL_triangulation_assertion(off3.x() == 0 || off3.x() == 1);
CGAL_triangulation_assertion(off3.y() == 0 || off3.y() == 1);
CGAL_triangulation_assertion(off3.z() == 0 || off3.z() == 1);
int offx = ( ((off0.x() == 0 && off1.x() == 0
&& off2.x() == 0 && off3.x() == 0)
|| (off0.x() == 1 && off1.x() == 1
&& off2.x() == 1 && off3.x() == 1)) ? 0 : 1);
int offy = ( ((off0.y() == 0 && off1.y() == 0
&& off2.y() == 0 && off3.y() == 0)
|| (off0.y() == 1 && off1.y() == 1
&& off2.y() == 1 && off3.y() == 1)) ? 0 : 1);
int offz = ( ((off0.z() == 0 && off1.z() == 0
&& off2.z() == 0 && off3.z() == 0)
|| (off0.z() == 1 && off1.z() == 1
&& off2.z() == 1 && off3.z() == 1)) ? 0 : 1);
int offx = ( ((off0.x() == 0 && off1.x() == 0
&& off2.x() == 0 && off3.x() == 0)
|| (off0.x() == 1 && off1.x() == 1
&& off2.x() == 1 && off3.x() == 1)) ? 0 : 1);
int offy = ( ((off0.y() == 0 && off1.y() == 0
&& off2.y() == 0 && off3.y() == 0)
|| (off0.y() == 1 && off1.y() == 1
&& off2.y() == 1 && off3.y() == 1)) ? 0 : 1);
int offz = ( ((off0.z() == 0 && off1.z() == 0
&& off2.z() == 0 && off3.z() == 0)
|| (off0.z() == 1 && off1.z() == 1
&& off2.z() == 1 && off3.z() == 1)) ? 0 : 1);
return( 4*offx + 2*offy + offz );
}
@@ -315,8 +313,8 @@ private:
Offset off0, off1, off2, off3;
get_edge_offsets(off0, off1, off2, off3);
Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0),
(((_off>>1)&1)==1 ? -1:0),
(( _off &1)==1 ? -1:0));
(((_off>>1)&1)==1 ? -1:0),
(( _off &1)==1 ? -1:0));
if (_it == T::STORED_COVER_DOMAIN) {
off0 = _t->combine_offsets(off0,transl_off);
off1 = _t->combine_offsets(off1,transl_off);
@@ -330,10 +328,10 @@ private:
off3 += transl_off;
}
return make_array(
std::make_pair(pos->vertex(0)->point(),off0),
std::make_pair(pos->vertex(1)->point(),off1),
std::make_pair(pos->vertex(2)->point(),off2),
std::make_pair(pos->vertex(3)->point(),off3));
std::make_pair(pos->vertex(0)->point(),off0),
std::make_pair(pos->vertex(1)->point(),off1),
std::make_pair(pos->vertex(2)->point(),off2),
std::make_pair(pos->vertex(3)->point(),off3));
}
};
@@ -365,7 +363,7 @@ public:
typedef typename T::Periodic_triangle Periodic_triangle;
typedef Periodic_3_triangulation_triangle_iterator_3<T>
Periodic_triangle_iterator;
Periodic_triangle_iterator;
typedef typename T::Facet Facet;
typedef typename T::Facet_iterator Facet_iterator;
@@ -376,17 +374,17 @@ public:
: _t(NULL), _it(it), _off(0) {}
Periodic_3_triangulation_triangle_iterator_3(const T * t,
Iterator_type it = T::STORED)
Iterator_type it = T::STORED)
: _t(t), pos(_t->facets_begin()), _it(it), _off(0) {
if (_it == T::UNIQUE || _it == T::UNIQUE_COVER_DOMAIN) {
while (pos != _t->facets_end() && !is_canonical() )
++pos;
++pos;
}
}
// used to initialize the past-the-end iterator
Periodic_3_triangulation_triangle_iterator_3(const T* t, int,
Iterator_type it = T::STORED)
Iterator_type it = T::STORED)
: _t(t), pos(_t->facets_end()), _it(it), _off(0) {}
Periodic_triangle_iterator& operator++() {
@@ -423,41 +421,41 @@ public:
}
Periodic_triangle_iterator operator++(int)
{
Periodic_triangle_iterator tmp(*this);
++(*this);
return tmp;
}
{
Periodic_triangle_iterator tmp(*this);
++(*this);
return tmp;
}
Periodic_triangle_iterator operator--(int)
{
Periodic_triangle_iterator tmp(*this);
--(*this);
return tmp;
}
{
Periodic_triangle_iterator tmp(*this);
--(*this);
return tmp;
}
bool operator==(const Periodic_triangle_iterator& ti) const
{
CGAL_triangulation_assertion(_it == ti._it);
return _t == ti._t && pos == ti.pos && _off == ti._off;
}
{
CGAL_triangulation_assertion(_it == ti._it);
return _t == ti._t && pos == ti.pos && _off == ti._off;
}
bool operator!=(const Periodic_triangle_iterator& ti) const
{
return !(*this == ti);
}
{
return !(*this == ti);
}
reference operator*() const
{
periodic_triangle = construct_periodic_triangle();
return periodic_triangle;
}
{
periodic_triangle = construct_periodic_triangle();
return periodic_triangle;
}
pointer operator->() const
{
periodic_triangle = construct_periodic_triangle();
return &periodic_triangle;
}
{
periodic_triangle = construct_periodic_triangle();
return &periodic_triangle;
}
Facet_iterator get_facet() const
{
@@ -479,7 +477,7 @@ private:
// fetch all offsets
Offset off0, off1, off2;
get_edge_offsets(off0, off1, off2);
if (_t->number_of_sheets() != make_array(1,1,1)) {
// If there is one offset with entries larger than 1 then we are
// talking about a vertex that is too far away from the original
@@ -513,12 +511,12 @@ private:
if (_off == off) {
_off = 0;
do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN
&& pos != _t->facets_end() && !is_canonical());
&& pos != _t->facets_end() && !is_canonical());
} else {
do {
++_off;
++_off;
} while ((((~_off)|off)&7)!=7); // Increment until a valid
// offset has been found
// offset has been found
}
}
@@ -532,9 +530,9 @@ private:
} else {
int off = get_drawing_offsets();
do {
--_off;
--_off;
} while ((((~_off)|off)&7)!=7); // Decrement until a valid
// offset has been found
// offset has been found
}
}
@@ -544,24 +542,24 @@ private:
Offset cell_off0 = _t->int_to_off(pos->first->offset((pos->second+1)&3));
Offset cell_off1 = _t->int_to_off(pos->first->offset((pos->second+2)&3));
Offset cell_off2 = _t->int_to_off(pos->first->offset((pos->second+3)&3));
Offset diff_off((cell_off0.x() == 1
&& cell_off1.x() == 1
&& cell_off2.x() == 1)?-1:0,
(cell_off0.y() == 1
&& cell_off1.y() == 1
&& cell_off2.y() == 1)?-1:0,
(cell_off0.z() == 1
&& cell_off1.z() == 1
&& cell_off2.z() == 1)?-1:0);
Offset diff_off((cell_off0.x() == 1
&& cell_off1.x() == 1
&& cell_off2.x() == 1)?-1:0,
(cell_off0.y() == 1
&& cell_off1.y() == 1
&& cell_off2.y() == 1)?-1:0,
(cell_off0.z() == 1
&& cell_off1.z() == 1
&& cell_off2.z() == 1)?-1:0);
off0 = _t->combine_offsets(_t->get_offset(pos->first,
(pos->second+1)&3),
diff_off);
(pos->second+1)&3),
diff_off);
off1 = _t->combine_offsets(_t->get_offset(pos->first,
(pos->second+2)&3),
diff_off);
(pos->second+2)&3),
diff_off);
off2 = _t->combine_offsets(_t->get_offset(pos->first,
(pos->second+3)&3),
diff_off);
(pos->second+3)&3),
diff_off);
}
// return an integer that encodes the translations which have to be
@@ -592,14 +590,14 @@ private:
CGAL_triangulation_assertion(off2.x() == 0 || off2.x() == 1);
CGAL_triangulation_assertion(off2.y() == 0 || off2.y() == 1);
CGAL_triangulation_assertion(off2.z() == 0 || off2.z() == 1);
int offx = ( ((off0.x() == 0 && off1.x() == 0 && off2.x() == 0)
|| (off0.x() == 1 && off1.x() == 1 && off2.x() == 1)) ? 0 : 1);
|| (off0.x() == 1 && off1.x() == 1 && off2.x() == 1)) ? 0 : 1);
int offy = ( ((off0.y() == 0 && off1.y() == 0 && off2.y() == 0)
|| (off0.y() == 1 && off1.y() == 1 && off2.y() == 1)) ? 0 : 1);
|| (off0.y() == 1 && off1.y() == 1 && off2.y() == 1)) ? 0 : 1);
int offz = ( ((off0.z() == 0 && off1.z() == 0 && off2.z() == 0)
|| (off0.z() == 1 && off1.z() == 1 && off2.z() == 1)) ? 0 : 1);
|| (off0.z() == 1 && off1.z() == 1 && off2.z() == 1)) ? 0 : 1);
return( 4*offx + 2*offy + offz );
}
@@ -608,8 +606,8 @@ private:
Offset off0, off1, off2;
get_edge_offsets(off0, off1, off2);
Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0),
(((_off>>1)&1)==1 ? -1:0),
(( _off &1)==1 ? -1:0));
(((_off>>1)&1)==1 ? -1:0),
(( _off &1)==1 ? -1:0));
if (_it == T::STORED_COVER_DOMAIN) {
off0 = _t->combine_offsets(off0,transl_off);
off1 = _t->combine_offsets(off1,transl_off);
@@ -621,9 +619,9 @@ private:
off2 += transl_off;
}
return make_array(
std::make_pair(pos->first->vertex((pos->second+1)&3)->point(),off0),
std::make_pair(pos->first->vertex((pos->second+2)&3)->point(),off1),
std::make_pair(pos->first->vertex((pos->second+3)&3)->point(),off2));
std::make_pair(pos->first->vertex((pos->second+1)&3)->point(),off0),
std::make_pair(pos->first->vertex((pos->second+2)&3)->point(),off1),
std::make_pair(pos->first->vertex((pos->second+3)&3)->point(),off2));
}
};
@@ -655,7 +653,7 @@ public:
typedef typename T::Periodic_segment Periodic_segment;
typedef Periodic_3_triangulation_segment_iterator_3<T>
Periodic_segment_iterator;
Periodic_segment_iterator;
typedef typename T::Edge Edge;
typedef typename T::Edge_iterator Edge_iterator;
@@ -666,17 +664,17 @@ public:
: _t(NULL), _it(it), _off(0) {}
Periodic_3_triangulation_segment_iterator_3(const T * t,
Iterator_type it = T::STORED)
Iterator_type it = T::STORED)
: _t(t), pos(_t->edges_begin()), _it(it), _off(0) {
if (_it == T::UNIQUE || _it == T::UNIQUE_COVER_DOMAIN) {
while (pos != _t->edges_end() && !is_canonical() )
++pos;
++pos;
}
}
// used to initialize the past-the-end iterator
Periodic_3_triangulation_segment_iterator_3(const T* t, int,
Iterator_type it = T::STORED)
Iterator_type it = T::STORED)
: _t(t), pos(_t->edges_end()), _it(it), _off(0) {}
Periodic_segment_iterator& operator++() {
@@ -713,41 +711,41 @@ public:
}
Periodic_segment_iterator operator++(int)
{
Periodic_segment_iterator tmp(*this);
++(*this);
return tmp;
}
{
Periodic_segment_iterator tmp(*this);
++(*this);
return tmp;
}
Periodic_segment_iterator operator--(int)
{
Periodic_segment_iterator tmp(*this);
--(*this);
return tmp;
}
{
Periodic_segment_iterator tmp(*this);
--(*this);
return tmp;
}
bool operator==(const Periodic_segment_iterator& ti) const
{
CGAL_triangulation_assertion(_it == ti._it);
return _t == ti._t && pos == ti.pos && _off == ti._off;
}
{
CGAL_triangulation_assertion(_it == ti._it);
return _t == ti._t && pos == ti.pos && _off == ti._off;
}
bool operator!=(const Periodic_segment_iterator& ti) const
{
return !(*this == ti);
}
{
return !(*this == ti);
}
reference operator*() const
{
periodic_segment = construct_periodic_segment();
return periodic_segment;
}
{
periodic_segment = construct_periodic_segment();
return periodic_segment;
}
pointer operator->() const
{
periodic_segment = construct_periodic_segment();
return &periodic_segment;
}
{
periodic_segment = construct_periodic_segment();
return &periodic_segment;
}
Edge_iterator get_edge() const
{
@@ -768,7 +766,7 @@ private:
// fetch all offsets
Offset off0, off1;
get_edge_offsets(off0, off1);
if (_t->number_of_sheets() != make_array(1,1,1)) {
// If there is one offset with entries larger than 1 then we are
// talking about a vertex that is too far away from the original
@@ -799,12 +797,12 @@ private:
if (_off == off) {
_off = 0;
do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN
&& pos != _t->edges_end() && !is_canonical());
&& pos != _t->edges_end() && !is_canonical());
} else {
do {
++_off;
++_off;
} while ((((~_off)|off)&7)!=7); // Increment until a valid
// offset has been found
// offset has been found
}
}
@@ -818,9 +816,9 @@ private:
} else {
int off = get_drawing_offsets();
do {
--_off;
--_off;
} while ((((~_off)|off)&7)!=7); // Decrement until a valid
// offset has been found
// offset has been found
}
}
@@ -830,12 +828,12 @@ private:
Offset cell_off0 = _t->int_to_off(pos->first->offset(pos->second));
Offset cell_off1 = _t->int_to_off(pos->first->offset(pos->third));
Offset diff_off((cell_off0.x()==1 && cell_off1.x()==1)?-1:0,
(cell_off0.y()==1 && cell_off1.y()==1)?-1:0,
(cell_off0.z()==1 && cell_off1.z()==1)?-1:0);
(cell_off0.y()==1 && cell_off1.y()==1)?-1:0,
(cell_off0.z()==1 && cell_off1.z()==1)?-1:0);
off0 = _t->combine_offsets(_t->get_offset(pos->first,pos->second),
diff_off);
diff_off);
off1 = _t->combine_offsets(_t->get_offset(pos->first,pos->third),
diff_off);
diff_off);
}
// return an integer that encodes the translations which have to be
@@ -856,14 +854,14 @@ private:
off1 = _t->int_to_off(pos->first->offset(pos->third));
}
Offset diff_off = off0 - off1;
CGAL_triangulation_assertion(diff_off.x() >= -1 || diff_off.x() <= 1);
CGAL_triangulation_assertion(diff_off.y() >= -1 || diff_off.y() <= 1);
CGAL_triangulation_assertion(diff_off.z() >= -1 || diff_off.z() <= 1);
return( 4*(diff_off.x() == 0 ? 0:1)
+ 2*(diff_off.y() == 0 ? 0:1)
+ (diff_off.z() == 0 ? 0:1) );
+ 2*(diff_off.y() == 0 ? 0:1)
+ (diff_off.z() == 0 ? 0:1) );
}
Periodic_segment construct_periodic_segment() const {
@@ -871,8 +869,8 @@ private:
Offset off0, off1;
get_edge_offsets(off0, off1);
Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0),
(((_off>>1)&1)==1 ? -1:0),
(( _off &1)==1 ? -1:0));
(((_off>>1)&1)==1 ? -1:0),
(( _off &1)==1 ? -1:0));
if (_it == T::STORED_COVER_DOMAIN) {
off0 = _t->combine_offsets(off0,transl_off);
off1 = _t->combine_offsets(off1,transl_off);
@@ -882,8 +880,8 @@ private:
off1 += transl_off;
}
return make_array(
std::make_pair(pos->first->vertex(pos->second)->point(),off0),
std::make_pair(pos->first->vertex(pos->third)->point(),off1));
std::make_pair(pos->first->vertex(pos->second)->point(),off0),
std::make_pair(pos->first->vertex(pos->third)->point(),off1));
}
};
@@ -925,17 +923,17 @@ public:
: _t(NULL), _it(it) {}
Periodic_3_triangulation_point_iterator_3(const T * t,
Iterator_type it = T::STORED)
Iterator_type it = T::STORED)
: _t(t), pos(_t->vertices_begin()), _it(it) {
if (_it == T::UNIQUE || _it == T::UNIQUE_COVER_DOMAIN) {
while (pos != _t->vertices_end() && !is_canonical() )
++pos;
++pos;
}
}
// used to initialize the past-the-end iterator
Periodic_3_triangulation_point_iterator_3(const T* t, int,
Iterator_type it = T::STORED)
Iterator_type it = T::STORED)
: _t(t), pos(_t->vertices_end()), _it(it) {}
Periodic_point_iterator& operator++() {
@@ -976,37 +974,37 @@ public:
++(*this);
return tmp;
}
Periodic_point_iterator operator--(int)
{
Periodic_point_iterator tmp(*this);
--(*this);
return tmp;
}
bool operator==(const Periodic_point_iterator& pi) const
{
CGAL_triangulation_assertion(_it == pi._it);
return _t == pi._t && pos == pi.pos;
}
bool operator!=(const Periodic_point_iterator& pi) const
{
return !(*this == pi);
}
reference operator*() const
{
periodic_point = construct_periodic_point();
return periodic_point;
}
pointer operator->() const
{
periodic_point = construct_periodic_point();
return &periodic_point;
}
Vertex_iterator get_vertex() const
{
return pos;
@@ -1034,7 +1032,7 @@ private:
};
template <class T>
class Domain_tester {
class Domain_tester {
const T *t;
public:
@@ -12,53 +12,41 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#ifndef CGAL_PERIODIC_3_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
#define CGAL_PERIODIC_3_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
// This class gathers optimized predicates written by hand, using
// a few steps of filtering. It should work if the initial traits has
// cartesian coordinates which fit exactly in doubles.
//
// Purely static filters code has been removed, since it requires additional
// logic and is not plug'n play (requires users providing bounds).
// If it should be provided again, it should probably be separate.
#include <CGAL/basic.h>
#include <CGAL/Kernel/function_objects.h>
#include <CGAL/Cartesian/function_objects.h>
#include <CGAL/internal/Static_filters/tools.h>
#include <CGAL/internal/Static_filters/Periodic_3_orientation_3.h>
// TODO :
// - add more predicates :
#include <CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h>
namespace CGAL {
// The K_base argument is supposed to provide exact primitives.
template < typename Traits >
class Periodic_3_triangulation_statically_filtered_traits_3 : public Traits
template< typename K,
typename Off = typename CGAL::Periodic_3_offset_3>
class Periodic_3_triangulation_statically_filtered_traits_3
: public Periodic_3_triangulation_filtered_traits_base_3<K, Off>
{
typedef Periodic_3_triangulation_statically_filtered_traits_3<Traits> Self;
typedef Periodic_3_triangulation_statically_filtered_traits_3<K, Off> Self;
typedef Periodic_3_triangulation_filtered_traits_base_3<K, Off> Base;
public:
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
typedef internal::Static_filters_predicates::Periodic_3_orientation_3<Traits>
Orientation_3;
Periodic_3_triangulation_statically_filtered_traits_3(const Iso_cuboid_3& domain,
const K& k)
: Base(domain, k)
{ }
typedef internal::Static_filters_predicates::Periodic_3_orientation_3<
K, typename Base::Orientation_3> Orientation_3;
Orientation_3 orientation_3_object() const {
return Orientation_3(&this->_domain,&this->_domain_e,&this->_domain_f);
return Orientation_3(&this->_domain,
this->Base::orientation_3_object());
}
};
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -24,7 +24,6 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/Profile_counter.h>
#include <CGAL/internal/Static_filters/Static_filter_error.h>
#include <CGAL/internal/Static_filters/tools.h>
@@ -35,17 +34,21 @@
namespace CGAL { namespace internal { namespace Static_filters_predicates {
template < typename K_base >
template < class K, class Orientation_3_base >
class Periodic_3_orientation_3
: public K_base::Orientation_3
: public Orientation_3_base
{
typedef typename K_base::Orientation_3 Base;
typedef typename K_base::FT FT;
typedef typename K_base::Point_3 Point_3;
typedef typename K_base::Vector_3 Vector_3;
typedef typename K_base::Iso_cuboid_3 Iso_cuboid_3;
typedef typename K_base::Sphere_3 Sphere_3;
typedef CGAL::Periodic_3_offset_3 Offset;
typedef Orientation_3_base Base;
public:
typedef K Kernel;
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
typedef typename K::Sphere_3 Sphere_3;
typedef CGAL::Periodic_3_offset_3 Offset;
public:
const Iso_cuboid_3 * const _dom;
@@ -53,30 +56,30 @@ public:
public:
typedef typename Base::result_type result_type;
template <class EX, class AP>
Periodic_3_orientation_3(const Iso_cuboid_3 * const dom,
const EX * dom_e, const AP * dom_f) : Base(dom_e,dom_f), _dom(dom) {
}
const Orientation_3_base& o3b)
: Base(o3b), _dom(dom)
{ }
#ifndef CGAL_CFG_MATCHING_BUG_6
using Base::operator();
#else
#else
result_type
operator()(const Vector_3& u, const Vector_3& v, const Vector_3& w) const
{
{
return Base::operator()(u,v,w);
}
}
result_type
operator()(const Sphere_3& s) const
{
{
return Base::operator()(s);
}
#endif
result_type
result_type
operator()(const Point_3 &p, const Point_3 &q,
const Point_3 &r, const Point_3 &s) const
const Point_3 &r, const Point_3 &s) const
{
CGAL_PROFILER("Periodic_3_orientation_3 calls");
Get_approx<Point_3> get_approx; // Identity functor for all points
@@ -119,17 +122,37 @@ public:
double aprz = CGAL::abs(prz);
double apsz = CGAL::abs(psz);
#ifdef CGAL_USE_SSE2_MAX
CGAL::Max<double> mmax;
maxx = mmax(maxx, aprx, apsx);
maxy = mmax(maxy, apry, apsy);
maxz = mmax(maxz, aprz, apsz);
#else
if (maxx < aprx) maxx = aprx;
if (maxx < apsx) maxx = apsx;
if (maxy < apry) maxy = apry;
if (maxy < apsy) maxy = apsy;
if (maxz < aprz) maxz = aprz;
if (maxz < apsz) maxz = apsz;
double eps = 5.1107127829973299e-15 * maxx * maxy * maxz;
#endif
double det = CGAL::determinant(pqx, pqy, pqz,
prx, pry, prz,
psx, psy, psz);
double eps = 5.1107127829973299e-15 * maxx * maxy * maxz;
#ifdef CGAL_USE_SSE2_MAX
/*
CGAL::Min<double> mmin;
double tmp = mmin(maxx, maxy, maxz);
maxz = mmax(maxx, maxy, maxz);
maxx = tmp;
*/
sse2minmax(maxx,maxy,maxz);
// maxy can contain ANY element
#else
// Sort maxx < maxy < maxz.
if (maxx > maxz)
std::swap(maxx, maxz);
@@ -137,6 +160,7 @@ public:
std::swap(maxy, maxz);
else if (maxy < maxx)
std::swap(maxx, maxy);
#endif
// Protect against underflow in the computation of eps.
if (maxx < 1e-97) /* cbrt(min_double/eps) */ {
@@ -157,10 +181,10 @@ public:
result_type
operator()(const Point_3 &p, const Point_3 &q,
const Point_3 &r, const Point_3 &s,
const Offset &o_p, const Offset &o_q,
const Offset &o_r, const Offset &o_s) const {
const Point_3 &r, const Point_3 &s,
const Offset &o_p, const Offset &o_q,
const Offset &o_r, const Offset &o_s) const
{
CGAL_PROFILER("Periodic_3_orientation_3 calls");
Get_approx<Point_3> get_approx; // Identity functor for all points
// but lazy points.
@@ -180,18 +204,18 @@ public:
fit_in_double(get_approx(r).z(), rz) &&
fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) &&
fit_in_double(get_approx(s).z(), sz) &&
fit_in_double(_dom->xmax(), domxmax) &&
fit_in_double(_dom->xmin(), domxmin) &&
fit_in_double(_dom->ymax(), domymax) &&
fit_in_double(_dom->ymin(), domymin) &&
fit_in_double(_dom->zmax(), domzmax) &&
fit_in_double(_dom->zmin(), domzmin))
fit_in_double(_dom->xmax(), domxmax) &&
fit_in_double(_dom->xmin(), domxmin) &&
fit_in_double(_dom->ymax(), domymax) &&
fit_in_double(_dom->ymin(), domymin) &&
fit_in_double(_dom->zmax(), domzmax) &&
fit_in_double(_dom->zmin(), domzmin))
{
CGAL_PROFILER("Periodic_3_orientation_3 semi-static attempts");
double domx = domxmax - domxmin;
double domy = domymax - domymin;
double domz = domzmax - domzmin;
double domx = domxmax - domxmin;
double domy = domymax - domymin;
double domz = domzmax - domzmin;
double pqx = qx - px + domx * ( o_q.x() - opx );
double pqy = qy - py + domy * ( o_q.y() - opy );
@@ -216,6 +240,12 @@ public:
double apsy = CGAL::abs(psy);
double apsz = CGAL::abs(psz);
#ifdef CGAL_USE_SSE2_MAX
CGAL::Max<double> mmax;
maxx = mmax(maxx, aqtx, artx, astx);
maxy = mmax(maxy, aqty, arty, asty);
maxz = mmax(maxz, aqtz, artz, astz);
#else
if (maxx < aprx) maxx = aprx;
if (maxx < apsx) maxx = apsx;
@@ -224,11 +254,23 @@ public:
if (maxz < aprz) maxz = aprz;
if (maxz < apsz) maxz = apsz;
double eps = 4.111024169857068197e-15 * maxx * maxy * maxz;
#endif
double det = CGAL::determinant(pqx, pqy, pqz,
prx, pry, prz,
psx, psy, psz);
double eps = 4.111024169857068197e-15 * maxx * maxy * maxz;
#ifdef CGAL_USE_SSE2_MAX
/*
CGAL::Min<double> mmin;
double tmp = mmin(maxx, maxy, maxz);
maxz = mmax(maxx, maxy, maxz);
maxx = tmp;
*/
sse2minmax(maxx,maxy,maxz);
// maxy can contain ANY element
#else
// Sort maxx < maxy < maxz.
if (maxx > maxz)
std::swap(maxx, maxz);
@@ -236,6 +278,7 @@ public:
std::swap(maxy, maxz);
else if (maxy < maxx)
std::swap(maxx, maxy);
#endif
// Protect against underflow in the computation of eps.
if (maxx < 1e-97) /* cbrt(min_double/eps) */ {
@@ -264,8 +307,8 @@ public:
t1, t1, t1); // Full det
double err = det.error();
err += err * 2 * F::ulp(); // Correction due to "eps * maxx * maxy...".
std::cerr << "*** epsilon for Periodic_3_orientation_3 = " << err
<< std::endl;
std::cerr << "*** epsilon for Periodic_3_orientation_3 = " << err
<< std::endl;
return err;
}
@@ -0,0 +1,54 @@
// Copyright (c) 2017 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Mael Rouxel-Labbé
#ifndef CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_POWER_TEST_3_H
#define CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_POWER_TEST_3_H
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/Profile_counter.h>
#include <CGAL/internal/Static_filters/Static_filter_error.h>
#include <CGAL/internal/Static_filters/tools.h>
#include <CGAL/Periodic_3_offset_3.h>
#include <cmath>
namespace CGAL {
namespace internal {
namespace Static_filters_predicates {
template <class K, class Power_side_of_oriented_power_sphere_3_base>
class Periodic_3_power_side_of_oriented_power_sphere_3:
public Power_side_of_oriented_power_sphere_3_base
{
typedef Power_side_of_oriented_power_sphere_3_base Base;
public:
typedef K Kernel;
// @todo
};
} // namespace Static_filters_predicates
} // namespace internal
} //namespace CGAL
#endif // CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_POWER_TEST_3_H
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -24,23 +24,30 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/Profile_counter.h>
#include <CGAL/internal/Static_filters/Static_filter_error.h>
#include <CGAL/internal/Static_filters/tools.h>
#include <CGAL/Periodic_3_offset_3.h>
namespace CGAL { namespace internal { namespace Static_filters_predicates {
namespace CGAL {
template < typename K_base >
namespace internal {
namespace Static_filters_predicates {
template < class K, class Side_of_oriented_sphere_3_base >
class Periodic_3_side_of_oriented_sphere_3
: public K_base::Side_of_oriented_sphere_3
: public Side_of_oriented_sphere_3_base
{
typedef typename K_base::Side_of_oriented_sphere_3 Base;
typedef typename K_base::FT FT;
typedef typename K_base::Point_3 Point_3;
typedef typename K_base::Iso_cuboid_3 Iso_cuboid_3;
typedef Side_of_oriented_sphere_3_base Base;
public:
typedef K Kernel;
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
typedef CGAL::Periodic_3_offset_3 Offset;
public:
@@ -49,11 +56,9 @@ public:
public:
typedef typename Base::result_type result_type;
template <class EX, class AP>
Periodic_3_side_of_oriented_sphere_3(const Iso_cuboid_3 * dom,
const EX * dom_e,
const AP * dom_f)
: Base(dom_e,dom_f), _dom(dom) { }
const Side_of_oriented_sphere_3_base& sop3)
: Base(sop3), _dom(dom) { }
Oriented_side
operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r,
@@ -83,22 +88,22 @@ public:
double pty = py - ty;
double ptz = pz - tz;
double pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty)
+ CGAL_NTS square(ptz);
+ CGAL_NTS square(ptz);
double qtx = qx - tx;
double qty = qy - ty;
double qtz = qz - tz;
double qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty)
+ CGAL_NTS square(qtz);
+ CGAL_NTS square(qtz);
double rtx = rx - tx;
double rty = ry - ty;
double rtz = rz - tz;
double rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty)
+ CGAL_NTS square(rtz);
+ CGAL_NTS square(rtz);
double stx = sx - tx;
double sty = sy - ty;
double stz = sz - tz;
double st2 = CGAL_NTS square(stx) + CGAL_NTS square(sty)
+ CGAL_NTS square(stz);
+ CGAL_NTS square(stz);
// Compute the semi-static bound.
double maxx = CGAL::abs(ptx);
@@ -116,7 +121,13 @@ public:
double astx = CGAL::abs(stx);
double asty = CGAL::abs(sty);
double astz = CGAL::abs(stz);
#ifdef CGAL_USE_SSE2_MAX
CGAL::Max<double> mmax;
maxx = mmax(maxx, aqtx, artx, astx);
maxy = mmax(maxy, aqty, arty, asty);
maxz = mmax(maxz, aqtz, artz, astz);
#else
if (maxx < aqtx) maxx = aqtx;
if (maxx < artx) maxx = artx;
if (maxx < astx) maxx = astx;
@@ -128,7 +139,21 @@ public:
if (maxz < aqtz) maxz = aqtz;
if (maxz < artz) maxz = artz;
if (maxz < astz) maxz = astz;
#endif
double eps = 1.2466136531027298e-13 * maxx * maxy * maxz;
#ifdef CGAL_USE_SSE2_MAX
/*
CGAL::Min<double> mmin;
double tmp = mmin(maxx, maxy, maxz);
maxz = mmax(maxx, maxy, maxz);
maxx = tmp;
*/
sse2minmax(maxx,maxy,maxz);
// maxy can contain ANY element
#else
// Sort maxx < maxy < maxz.
if (maxx > maxz)
std::swap(maxx, maxz);
@@ -136,10 +161,7 @@ public:
std::swap(maxy, maxz);
else if (maxy < maxx)
std::swap(maxx, maxy);
double eps = 1.2466136531027298e-13 * maxx * maxy * maxz
* (maxz * maxz);
#endif
double det = CGAL::determinant(ptx,pty,ptz,pt2,
rtx,rty,rtz,rt2,
qtx,qty,qtz,qt2,
@@ -152,6 +174,7 @@ public:
}
// Protect against overflow in the computation of det.
else if (maxz < 1e61) /* sqrt^5(max_double/4 [hadamard]) */ {
eps *= (maxz * maxz);
if (det > eps) return ON_POSITIVE_SIDE;
if (det < -eps) return ON_NEGATIVE_SIDE;
}
@@ -163,10 +186,10 @@ public:
Oriented_side
operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r,
const Point_3 &s, const Point_3 &t, const Offset &o_p,
const Offset &o_q, const Offset &o_r,
const Offset &o_s, const Offset &o_t) const {
const Point_3 &s, const Point_3 &t,
const Offset &o_p, const Offset &o_q, const Offset &o_r,
const Offset &o_s, const Offset &o_t) const
{
CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 calls");
Get_approx<Point_3> get_approx; // Identity functor for all points
@@ -190,12 +213,12 @@ public:
fit_in_double(get_approx(s).z(), sz) &&
fit_in_double(get_approx(t).x(), tx) && fit_in_double(get_approx(t).y(), ty) &&
fit_in_double(get_approx(t).z(), tz) &&
fit_in_double(_dom->xmax(), domxmax) &&
fit_in_double(_dom->xmin(), domxmin) &&
fit_in_double(_dom->ymax(), domymax) &&
fit_in_double(_dom->ymin(), domymin) &&
fit_in_double(_dom->zmax(), domzmax) &&
fit_in_double(_dom->zmin(), domzmin))
fit_in_double(_dom->xmax(), domxmax) &&
fit_in_double(_dom->xmin(), domxmin) &&
fit_in_double(_dom->ymax(), domymax) &&
fit_in_double(_dom->ymin(), domymin) &&
fit_in_double(_dom->zmax(), domzmax) &&
fit_in_double(_dom->zmin(), domzmin))
{
CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static attempts");
@@ -228,7 +251,7 @@ public:
double maxx = CGAL::abs(ptx);
double maxy = CGAL::abs(pty);
double maxz = CGAL::abs(ptz);
double aqtx = CGAL::abs(qtx);
double aqty = CGAL::abs(qty);
double aqtz = CGAL::abs(qtz);
@@ -240,7 +263,13 @@ public:
double astx = CGAL::abs(stx);
double asty = CGAL::abs(sty);
double astz = CGAL::abs(stz);
#ifdef CGAL_USE_SSE2_MAX
CGAL::Max<double> mmax;
maxx = mmax(maxx, aqtx, artx, astx);
maxy = mmax(maxy, aqty, arty, asty);
maxz = mmax(maxz, aqtz, artz, astz);
#else
if (maxx < aqtx) maxx = aqtx;
if (maxx < artx) maxx = artx;
if (maxx < astx) maxx = astx;
@@ -252,7 +281,20 @@ public:
if (maxz < aqtz) maxz = aqtz;
if (maxz < artz) maxz = artz;
if (maxz < astz) maxz = astz;
#endif
double eps = 1.0466759304746772485e-13 * maxx * maxy * maxz;
#ifdef CGAL_USE_SSE2_MAX
/*
CGAL::Min<double> mmin;
double tmp = mmin(maxx, maxy, maxz);
maxz = mmax(maxx, maxy, maxz);
maxx = tmp;
*/
sse2minmax(maxx,maxy,maxz);
// maxy can contain ANY element
#else
// Sort maxx < maxy < maxz.
if (maxx > maxz)
std::swap(maxx, maxz);
@@ -260,14 +302,11 @@ public:
std::swap(maxy, maxz);
else if (maxy < maxx)
std::swap(maxx, maxy);
double eps = 1.0466759304746772485e-13 * maxx * maxy * maxz
* (maxz * maxz);
#endif
double det = CGAL::determinant(ptx,pty,ptz,pt2,
rtx,rty,rtz,rt2,
qtx,qty,qtz,qt2,
stx,sty,stz,st2);
rtx,rty,rtz,rt2,
qtx,qty,qtz,qt2,
stx,sty,stz,st2);
// Protect against underflow in the computation of eps.
if (maxx < 1e-58) /* sqrt^5(min_double/eps) */ {
@@ -276,6 +315,7 @@ public:
}
// Protect against overflow in the computation of det.
else if (maxz < 1e61) /* sqrt^5(max_double/4 [hadamard]) */ {
eps *= (maxz * maxz);
if (det > eps) return ON_POSITIVE_SIDE;
if (det < -eps) return ON_NEGATIVE_SIDE;
}
@@ -299,11 +339,15 @@ public:
err += err * 3 * F::ulp(); // Correction due to "eps * maxx * ...".
std::cerr << "*** epsilon for Periodic_3_side_of_oriented_sphere_3 = "
<< err << std::endl;
<< err << std::endl;
return err;
}
};
} } } // namespace CGAL::internal::Static_filters_predicates
} // namespace Static_filters_predicates
} // namespace internal
} // namespace CGAL
#endif // CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_SIDE_OF_ORIENTED_SPHERE_3_H
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -23,9 +23,10 @@
#include <CGAL/license/Periodic_3_triangulation_3.h>
#include <CGAL/array.h>
#include <iostream>
#include <utility>
template <class Stream, class Triangulation>
Stream &write_triangulation_to_off(Stream &out, Triangulation &t) {
@@ -51,26 +52,26 @@ Stream &write_triangulation_to_off(Stream &out, Triangulation &t) {
if (t.number_of_sheets() == CGAL::make_array(1,1,1)) {
for (typename Triangulation::Cell_iterator it = t.cells_begin();
it != t.cells_end(); it++) {
it != t.cells_end(); it++) {
for (int i=0; i<4; i++) {
Point p = t.point(t.periodic_point(it,i));
out << p.x() << " "
<< p.y() << " "
<< p.z() << std::endl;
Point p = t.point(t.periodic_point(it,i));
out << p.x() << " "
<< p.y() << " "
<< p.z() << std::endl;
}
}
} else {
for (typename Triangulation::Cell_iterator it = t.cells_begin();
it != t.cells_end(); it++) {
it != t.cells_end(); it++) {
for (int i=0; i<4; i++) {
typename Triangulation::Vertex_handle vh;
typename Triangulation::Offset off;
t.get_vertex(it, i, vh, off);
Point p = t.point(t.periodic_point(it, i));
out << p.x() << " "
<< p.y() << " "
<< p.z() << std::endl;
typename Triangulation::Vertex_handle vh;
typename Triangulation::Offset off;
t.get_vertex(it, i, vh, off);
Point p = t.point(t.periodic_point(it, i));
out << p.x() << " "
<< p.y() << " "
<< p.z() << std::endl;
}
}
}
@@ -93,7 +94,7 @@ Stream &write_triangulation_to_off(Stream &out, Triangulation &t) {
template<class Stream, class Triangulation, class Cell_iterator>
Stream &write_cells_to_off(Stream &out, Triangulation &t, int number_of_cells,
Cell_iterator cit, Cell_iterator cells_end) {
Cell_iterator cit, Cell_iterator cells_end) {
typedef typename Triangulation::Point Point;
out << "OFF "
<< "\n" << 4*number_of_cells
@@ -119,26 +120,18 @@ Stream &write_cells_to_off(Stream &out, Triangulation &t, int number_of_cells,
return out;
}
#if 0
//TODO: rewrite this to wrap the stream coming from draw_dual
template <class Stream>
Stream& draw_dual_to_off(Stream &os) {
os << "OFF " << "\n"
<< 2*number_of_facets() << " "
<< number_of_facets() << " 0" << std::endl;
for (Facet_iterator fit = facets_begin(), end = facets_end();
fit != end; ++fit) {
if (!is_canonical(*fit)) continue;
std::pair<Segment,Offset> pso = dual(*fit);
os << pso.first.source() << std::endl
<< pso.first.target() - pso.second<< std::endl;
}
CGAL_triangulation_assertion( i==number_of_facets());
for(unsigned int i=0 ; i < number_of_facets() ; i++) {
os << "2 " << i*2 << " " << i*2+1 << std::endl;
template <class Stream, class Triangulation>
Stream& draw_dual_to_off(Stream &os, Triangulation &t) {
os << "OFF " << "\n"
<< 2*t.number_of_facets() << " "
<< t.number_of_facets() << " 0" << std::endl;
t.draw_dual(os);
for(unsigned int i=0; i < t.number_of_facets(); i++) {
os << "3 " << i*2 << " " << i*2+1 << " " << i*2 << std::endl;
}
return os;
}
#endif
#endif //CGAL_PERIODIC_3_TRIANGULATION_3_IO_H
@@ -1,2 +1,2 @@
INRIA Sophia-Antipolis (France)
INRIA Sophia Antipolis (France)
@@ -1,2 +1 @@
Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
Monique Teillaud <Monique.Teillaud@inria.fr>
@@ -6,7 +6,9 @@ project( Periodic_3_triangulation_3_Tests )
cmake_minimum_required(VERSION 2.8.10)
find_package(CGAL QUIET COMPONENTS Core)
set(CMAKE_CXX_STANDARD 14)
find_package(CGAL QUIET COMPONENTS Core )
if ( CGAL_FOUND )
@@ -18,11 +20,20 @@ if ( CGAL_FOUND )
include_directories (BEFORE "include")
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program( "${cppfile}" )
endforeach()
create_single_source_cgal_program( "test_p3rt3_as_p3t3.cpp" )
create_single_source_cgal_program( "test_p3rt3_insert_remove_point_set.cpp" )
create_single_source_cgal_program( "test_periodic_3_alpha_shape_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_delaunay_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_delaunay_hierarchy_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_offset_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_regular_triangulation_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_regular_triangulation_traits_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_triangulation_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_triangulation_tds.cpp" )
create_single_source_cgal_program( "test_periodic_3_triangulation_traits_C_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_triangulation_traits_H_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_triangulation_traits_SC_3.cpp" )
create_single_source_cgal_program( "test_periodic_3_triangulation_traits_SH_3.cpp" )
else()
@@ -22,29 +22,32 @@
#ifndef CGAL_TEST_CLS_CIRCULATOR_C
#define CGAL_TEST_CLS_CIRCULATOR_C
#include <CGAL/circulator.h>
#include <cassert>
#include <iterator>
#include <utility>
#include <vector>
template < class Triangulation >
int
_test_circulator( const Triangulation &T )
{
typedef typename Triangulation::Edge_iterator Edge_iterator;
typedef typename Triangulation::Facet_circulator Facet_circulator;
typedef typename Triangulation::Cell_circulator Cell_circulator;
typedef typename Triangulation::Vertex_handle Vertex_handle;
typedef typename Triangulation::Cell_handle Cell_handle;
typedef typename Triangulation::Facet Facet;
typedef typename Triangulation::Cell_handle Cell_handle;
int n = 0;
Cell_circulator cc, cc0;
Edge_iterator eit, eit2;
// testing incident_cells(edge *);
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin();
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit = T.edges_begin();
{
cc0=cc=T.incident_cells(*eit);
@@ -63,14 +66,14 @@ _test_circulator( const Triangulation &T )
eit=T.edges_begin();
{
cc0=cc=T.incident_cells(eit->first, eit->second, eit->third);
do {
assert(cc->has_vertex(eit->first->vertex(eit->second)));
assert(cc->has_vertex(eit->first->vertex(eit->third)));
cc--; n++;
} while (cc != cc0);
}
do {
assert(cc->has_vertex(eit->first->vertex(eit->second)));
assert(cc->has_vertex(eit->first->vertex(eit->third)));
cc--; n++;
} while (cc != cc0);
}
// testing incident_cells(edge *,cell *); and ++
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin();
{
cc0=cc=T.incident_cells(*eit, eit->first);
@@ -84,15 +87,16 @@ _test_circulator( const Triangulation &T )
eit=T.edges_begin();
{
cc0=cc=T.incident_cells(eit->first, eit->second, eit->third,
eit->first);
do {
assert(cc->has_vertex(eit->first->vertex(eit->second)));
assert(cc->has_vertex(eit->first->vertex(eit->third)));
cc--; n++;
} while (cc != cc0);
}
// the following is not useful here, it tests iterators more than
// circulators
eit->first);
do {
assert(cc->has_vertex(eit->first->vertex(eit->second)));
assert(cc->has_vertex(eit->first->vertex(eit->third)));
cc--; n++;
} while (cc != cc0);
}
// the following is not useful here, it tests iterators more than
// circulators
// for (eit=T.finite_edges_begin(); eit!=T.edges_end(); eit++)
// {
// cc0=cc=T.incident_cells(*eit);
@@ -131,92 +135,92 @@ _test_circulator( const Triangulation &T )
assert( fit->second != (fit->first)->index(vh) );
}
Facet_circulator fc, fc0, fc1;
assert(fc1 == 0);
int i,j;
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (edge)
{
fc0=fc=T.incident_facets(*eit);
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc++; n++;
} while (fc != fc0);
}
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (cell*,int,int)
{
fc0=fc=T.incident_facets(eit->first, eit->second, eit->third);
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc--; n++;
} while (fc != fc0);
}
// int fi;
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (edge, Cell*,int)
{
// for (fi=0; fi!=4 ; fi++)
// {
// if (t.dimension()==2) {fi=3;}
fc0=fc=T.incident_facets(*eit, eit->first,
T.next_around_edge(eit->second, eit->third));
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc++; n++;
} while (fc != fc0);
// }
}
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (Cell*,int,int,cell*,int)
{
fc0=fc=T.incident_facets(eit->first, eit->second, eit->third,
eit->first,
T.next_around_edge(eit->second, eit->third));
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc--; n++;
} while (fc != fc0);
}
Facet_circulator fc, fc0, fc1;
assert(fc1 == 0);
int i,j;
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (edge)
{
fc0=fc=T.incident_facets(*eit);
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc++; n++;
} while (fc != fc0);
}
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (cell*,int,int)
{
fc0=fc=T.incident_facets(eit->first, eit->second, eit->third);
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc--; n++;
} while (fc != fc0);
}
// int fi;
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (edge, Cell*,int)
{
// for (fi=0; fi!=4 ; fi++)
// {
// if (t.dimension()==2) {fi=3;}
fc0=fc=T.incident_facets(*eit, eit->first,
T.next_around_edge(eit->second, eit->third));
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc++; n++;
} while (fc != fc0);
// }
}
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (Cell*,int,int,cell*,int)
{
fc0=fc=T.incident_facets(eit->first, eit->second, eit->third,
eit->first,
T.next_around_edge(eit->second, eit->third));
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc--; n++;
} while (fc != fc0);
}
eit=T.edges_begin(); // test (edge, Facet)
{
// for (fi=0; fi!=4 ; fi++)
// {
// if (t.dimension()==2) {fi=3;}
fc0=fc=T.incident_facets(*eit, std::make_pair( eit->first,
T.next_around_edge(eit->second,
eit->third)) );
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc++; n++;
} while (fc != fc0);
// }
}
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (Cell*,int,int,Facet)
{
fc0=fc=T.incident_facets(eit->first, eit->second, eit->third,
std::make_pair( eit->first,
T.next_around_edge(eit->second,
eit->third)) );
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc--; n++;
} while (fc != fc0);
}
eit=T.edges_begin(); // test (edge, Facet)
{
// for (fi=0; fi!=4 ; fi++)
// {
// if (t.dimension()==2) {fi=3;}
fc0=fc=T.incident_facets(*eit, std::make_pair( eit->first,
T.next_around_edge(eit->second,
eit->third)) );
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc++; n++;
} while (fc != fc0);
// }
}
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
eit=T.edges_begin(); // test (Cell*,int,int,Facet)
{
fc0=fc=T.incident_facets(eit->first, eit->second, eit->third,
std::make_pair( eit->first,
T.next_around_edge(eit->second,
eit->third)) );
do {
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
assert(fc->second == T.next_around_edge(i, j) );
fc--; n++;
} while (fc != fc0);
}
return n;
}
@@ -265,12 +265,12 @@ _test_triangulation_iterator( const Triangulation &T )
Cell_iterator Cit2;
Cit = T.cells_begin();
Cit2=Cit;
assert(T.tetrahedron(T.periodic_tetrahedron(Cit))
==T.tetrahedron(T.periodic_tetrahedron(Cit2)));
assert(T.construct_tetrahedron(T.periodic_tetrahedron(Cit))
== T.construct_tetrahedron(T.periodic_tetrahedron(Cit2)));
Cit++ ; Cit-- ; ++Cit ; --Cit ;
assert(Cit==Cit2);
assert(T.tetrahedron(T.periodic_tetrahedron(Cit))
==T.tetrahedron(T.periodic_tetrahedron(Cit2)));
assert(T.construct_tetrahedron(T.periodic_tetrahedron(Cit))
== T.construct_tetrahedron(T.periodic_tetrahedron(Cit2)));
}
{
Facet_iterator Fit2;
@@ -0,0 +1,311 @@
// Copyright (c) 1998, 2015 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Date$
// Author(s) : Aymeric PELLE <aymeric.pelle@sophia.inria.fr>
// Mael Rouxel-Labbé
#if (__GNUC__>4) || (__GNUC__ == 4 && __GNUC_MINOR__ >=6)
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/use.h>
#include <CGAL/number_type_config.h>
#include <cassert>
#include <iostream>
template<class Traits>
void _test_for_given_domain (const Traits& traits,
typename Traits::Weighted_point_3* wp)
{
typedef typename Traits::FT FT;
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Periodic_3_offset_3 Offset;
CGAL_USE_TYPE(typename Traits::Weighted_point_3);
CGAL_USE_TYPE(typename Traits::Vector_3);
CGAL_USE_TYPE(typename Traits::Iso_cuboid_3);
CGAL_USE_TYPE(typename Traits::Segment_3);
CGAL_USE_TYPE(typename Traits::Triangle_3);
CGAL_USE_TYPE(typename Traits::Tetrahedron_3);
CGAL_USE_TYPE(typename Traits::Comparison_result);
CGAL_USE_TYPE(typename Traits::Orientation);
CGAL_USE_TYPE(typename Traits::Oriented_side);
CGAL_USE_TYPE(typename Traits::Bounded_side);
CGAL_USE_TYPE(typename Traits::Compare_xyz_3);
CGAL_USE_TYPE(typename Traits::Orientation_3);
CGAL_USE_TYPE(typename Traits::Coplanar_orientation_3);
CGAL_USE_TYPE(typename Traits::Construct_segment_3);
CGAL_USE_TYPE(typename Traits::Construct_triangle_3);
CGAL_USE_TYPE(typename Traits::Construct_tetrahedron_3);
typedef typename Traits::Construct_point_3 Construct_point_3;
typedef typename Traits::Power_side_of_oriented_power_sphere_3 Power_side_of_oriented_power_sphere_3;
typedef typename Traits::Compare_power_distance_3 Compare_power_distance_3;
typedef typename Traits::Construct_weighted_circumcenter_3 Construct_weighted_circumcenter_3;
typedef typename Traits::Compare_weighted_squared_radius_3 Compare_weighted_squared_radius_3;
typedef typename Traits::Coplanar_orientation_3 Coplanar_orientation_3;
// Create offset array for tests
Offset o[9] = { Offset(0, 0, 0),
Offset(1, 0, 0), Offset(0, 1, 0), Offset(0, 0, 1),
Offset(1, 1, 0), Offset(1, 0, 1), Offset(0, 1, 1),
Offset(1, 1, 1), Offset(10, 10, 10)};
std::cout << "test of Construct_weighted_circumcenter_3" << std::endl;
Construct_weighted_circumcenter_3 weighted_circumcenter = traits.construct_weighted_circumcenter_3_object();
std::cout << "test of Compare_power_distance_3" << std::endl;
Compare_power_distance_3 compare_power_distance = traits.compare_power_distance_3_object();
{
// basic version
Point_3 c;
c = weighted_circumcenter(wp[0],wp[1],wp[2],wp[3]);
assert (compare_power_distance(c,wp[0],wp[1]) == CGAL::EQUAL);
assert (compare_power_distance(c,wp[4],wp[0]) == CGAL::LARGER);
assert (compare_power_distance(c,wp[6],wp[0]) == CGAL::SMALLER);
c = weighted_circumcenter(wp[4],wp[1],wp[2],wp[3]);
assert (compare_power_distance(c,wp[4],wp[2]) == CGAL::EQUAL);
c = weighted_circumcenter(wp[5],wp[1],wp[2],wp[3]);
assert (compare_power_distance(c,wp[5],wp[3]) == CGAL::EQUAL);
}
{
// uniform (zero) offsets
Point_3 c;
c = weighted_circumcenter(wp[0],wp[1],wp[2],wp[3], o[0],o[0],o[0],o[0]);
assert (compare_power_distance(c,wp[0],wp[1], o[0],o[0],o[0]) == CGAL::EQUAL);
assert (compare_power_distance(c,wp[4],wp[0], o[0],o[0],o[0]) == CGAL::LARGER);
assert (compare_power_distance(c,wp[6],wp[0], o[0],o[0],o[0]) == CGAL::SMALLER);
c = weighted_circumcenter(wp[4],wp[1],wp[2],wp[3], o[0],o[0],o[0],o[0]);
assert (compare_power_distance(c,wp[4],wp[2], o[0],o[0],o[0]) == CGAL::EQUAL);
c = weighted_circumcenter(wp[5],wp[1],wp[2],wp[3], o[0],o[0],o[0],o[0]);
assert (compare_power_distance(c,wp[5],wp[3], o[0],o[0],o[0]) == CGAL::EQUAL);
}
{
// uniform (non-zero) offsets
Point_3 c;
c = weighted_circumcenter(wp[0],wp[1],wp[2],wp[3], o[1],o[1],o[1],o[1]);
assert (compare_power_distance(c,wp[0],wp[1], o[0],o[1],o[1]) == CGAL::EQUAL);
assert (compare_power_distance(c,wp[4],wp[0], o[0],o[1],o[1]) == CGAL::LARGER);
assert (compare_power_distance(c,wp[6],wp[0], o[0],o[1],o[1]) == CGAL::SMALLER);
c = weighted_circumcenter(wp[4],wp[1],wp[2],wp[3], o[1],o[1],o[1],o[1]);
assert (compare_power_distance(c,wp[4],wp[2], o[0],o[1],o[1]) == CGAL::EQUAL);
c = weighted_circumcenter(wp[5],wp[1],wp[2],wp[3], o[1],o[1],o[1],o[1]);
assert (compare_power_distance(c,wp[5],wp[3], o[0],o[1],o[1]) == CGAL::EQUAL);
}
{
// non-uniform offsets
Point_3 c;
c = weighted_circumcenter(wp[0],wp[1],wp[2],wp[3], o[1],o[2],o[3],o[2]);
assert (compare_power_distance(c,wp[0],wp[1], o[0],o[1],o[2]) == CGAL::EQUAL);
assert (compare_power_distance(c,wp[4],wp[0], o[0],o[2],o[2]) == CGAL::LARGER);
assert (compare_power_distance(c,wp[6],wp[0], o[0],o[2],o[2]) == CGAL::SMALLER);
assert (compare_power_distance(c,wp[1],wp[1], o[0],o[2],o[8]) == CGAL::SMALLER);
assert (compare_power_distance(c,wp[1],wp[4], o[5],o[2],o[6]) == CGAL::LARGER);
c = weighted_circumcenter(wp[4],wp[1],wp[2],wp[3], o[4],o[3],o[2],o[1]);
assert (compare_power_distance(c,wp[4],wp[2], o[0],o[4],o[2]) == CGAL::EQUAL);
c = weighted_circumcenter(wp[5],wp[1],wp[2],wp[3], o[2],o[1],o[3],o[1]);
assert (compare_power_distance(c,wp[5],wp[3], o[0],o[2],o[1]) == CGAL::EQUAL);
}
std::cout << "test of Power_side_of_oriented_power_sphere_3" << std::endl;
Power_side_of_oriented_power_sphere_3 power_test = traits.power_side_of_oriented_power_sphere_3_object();
{
// Triangulation_3's testsuite will check the base version in detail
assert(power_test(wp[7],wp[8],wp[9],wp[10],wp[11]) ==
traits.side_of_oriented_sphere_3_object()(
wp[7].point(),wp[8].point(),wp[9].point(),wp[10].point(),wp[11].point()));
assert(power_test(wp[8],wp[7],wp[9],wp[10],wp[13]) ==
traits.side_of_oriented_sphere_3_object()(
wp[8].point(),wp[7].point(),wp[9].point(),wp[10].point(),wp[13].point()));
assert(power_test(wp[7],wp[8],wp[9],wp[13]) ==
static_cast<CGAL::Oriented_side>(traits.coplanar_side_of_bounded_circle_3_object()(
wp[7].point(),wp[8].point(),wp[9].point(),wp[13].point())));
// no weight, with offsets
assert(power_test(wp[8],wp[7],wp[9],wp[10],wp[13]) ==
power_test(wp[8],wp[7],wp[9],wp[10],wp[13], o[2],o[2],o[2],o[2],o[2]));
assert(power_test(wp[10],wp[9],wp[8],wp[7]) ==
power_test(wp[10],wp[9],wp[8],wp[7], o[3],o[3],o[3],o[3]));
assert(power_test(wp[9],wp[11],wp[13]) ==
power_test(wp[9],wp[11],wp[13], o[4],o[4],o[4]));
assert(power_test(wp[8],wp[14]) ==
power_test(wp[8],wp[14],o[5],o[5]));
assert(power_test(wp[7],wp[8],wp[9],wp[10],wp[11], o[0],o[0],o[0],o[0],o[0]) ==
traits.side_of_oriented_sphere_3_object()(
wp[7].point(),wp[8].point(),wp[9].point(),wp[10].point(),wp[11].point()));
assert(power_test(wp[9],wp[13],wp[12],wp[8],wp[11],o[4],o[3],o[2],o[1],o[0]) == CGAL::ON_POSITIVE_SIDE);
assert(power_test(wp[7],wp[8],wp[9],wp[13], o[1], o[2], o[3], o[4]) == CGAL::ON_NEGATIVE_SIDE);
assert(power_test(wp[8],wp[11],wp[8],o[1],o[2],o[1]) == CGAL::ON_ORIENTED_BOUNDARY);
assert(power_test(wp[0],wp[6],o[1],o[1]) == CGAL::ON_POSITIVE_SIDE);
assert(power_test(wp[0],wp[5],o[2],o[2]) == CGAL::ON_NEGATIVE_SIDE);
assert(power_test(wp[0],wp[0],o[3],o[3]) == CGAL::ON_ORIENTED_BOUNDARY);
}
std::cout << "test of Compare_weighted_squared_radius_3" << std::endl;
Compare_weighted_squared_radius_3 compare_weighted_squared_radius = traits.compare_weighted_squared_radius_3_object();
{
// base, no offset
assert(compare_weighted_squared_radius(wp[0],wp[15],wp[2],wp[3], FT(0.)) == CGAL::LARGER);
assert(compare_weighted_squared_radius(wp[0],wp[15],wp[2], FT(1.)) == CGAL::SMALLER);
assert(compare_weighted_squared_radius(wp[0],wp[9], FT(5.)) == CGAL::SMALLER);
assert(compare_weighted_squared_radius(wp[15], FT(-2.)) == CGAL::EQUAL);
// with offsets
assert(compare_weighted_squared_radius(wp[0],wp[15],wp[2],wp[3],
o[2], o[2], o[2], o[2],
FT(0.))
== compare_weighted_squared_radius(wp[0],wp[15],wp[2],wp[3], FT(0.)));
assert(compare_weighted_squared_radius(wp[0], wp[11], wp[13],
o[1], o[1], o[1],
FT(1.))
== compare_weighted_squared_radius(wp[0],wp[11],wp[13], FT(1.)));
assert(compare_weighted_squared_radius(wp[0], wp[11], o[3], o[3], FT(1.))
== compare_weighted_squared_radius(wp[0],wp[11], FT(1.)));
assert(compare_weighted_squared_radius(wp[4], o[1], FT(1.))
== compare_weighted_squared_radius(wp[4], FT(1.)));
}
std::cout << "test of Coplanar_orientation_3" << std::endl;
Construct_point_3 cp = traits.construct_point_3_object();
Coplanar_orientation_3 coplanar_orientation = traits.coplanar_orientation_3_object();
{
assert(coplanar_orientation(cp(wp[0]), cp(wp[1]), cp(wp[2]), cp(wp[3]),
o[3], o[3], o[3], o[3])
== coplanar_orientation(cp(wp[0]), cp(wp[1]), cp(wp[2]), cp(wp[3])));
assert(coplanar_orientation(cp(wp[0], o[3]), cp(wp[1], o[3]), cp(wp[2], o[3]), cp(wp[3], o[3]))
== coplanar_orientation(cp(wp[0]), cp(wp[1]), cp(wp[2]), cp(wp[3])));
assert(coplanar_orientation(cp(wp[4]), cp(wp[3]), cp(wp[2]), o[4], o[4], o[4])
== coplanar_orientation(cp(wp[4]), cp(wp[3]), cp(wp[2])));
assert(coplanar_orientation(cp(wp[1]), cp(wp[1]), cp(wp[1]), cp(wp[1]),
o[0], o[7], o[1], o[8]) == CGAL::COLLINEAR);
assert(coplanar_orientation(cp(wp[3]), cp(wp[3]), cp(wp[3]),
o[0], o[7], o[8]) == CGAL::COLLINEAR);
assert(coplanar_orientation(cp(wp[1]), cp(wp[2]), cp(wp[3]), cp(wp[4]),
o[6], o[7], o[4], o[1]) == CGAL::POSITIVE);
}
}
template<class K>
void _test_cls_periodic_3_regular_triangulation_traits_3_rational ()
{
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Traits;
typedef typename Traits::Weighted_point_3 Weighted_point_3;
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Iso_cuboid_3 Iso_cuboid;
Traits traits;
std::cout << "Iso_cuboid(0,0,0,4,4,4)" << std::endl;
traits.set_domain(Iso_cuboid(0, 0, 0, 4, 4, 4));
Point_3 p0(0.,0.,0.);
Point_3 p1(2.,0.,0.);
Point_3 p2(0.,2.,0.);
Point_3 p3(0.,0.,2.);
Point_3 p4(2.,2.,2.);
Point_3 p5(1.,0.,0.);
Point_3 p6(3.,0.,0.);
Weighted_point_3 wp[19] =
{
Weighted_point_3(p0, 9.),
Weighted_point_3(p1, 9.),
Weighted_point_3(p2, 9.),
Weighted_point_3(p3, 9.),
Weighted_point_3(p0, 6.),
Weighted_point_3(p0, 3.),
Weighted_point_3(p0, 12.),
Weighted_point_3(p0,0.), // [7]
Weighted_point_3(p1,0.),
Weighted_point_3(p2,0.),
Weighted_point_3(p3,0.),
Weighted_point_3(p4,0.),
Weighted_point_3(p5,0.),
Weighted_point_3(p6,0.),
Weighted_point_3(p0,2.),
Weighted_point_3(p1,2.),
Weighted_point_3(p2,2.),
Weighted_point_3(p3,2.),
Weighted_point_3(p4,2.)
};
_test_for_given_domain(traits, wp);
}
template<class K>
void _test_cls_periodic_3_regular_triangulation_traits_3_irrational ()
{
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Traits;
typedef typename Traits::Weighted_point_3 Weighted_point_3;
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Iso_cuboid_3 Iso_cuboid;
Traits traits;
std::cout << "Iso_cuboid(-pi,-sqrt(3)/2, -0.1, pi/3, pi/2, sqrt(14))" << std::endl;
traits.set_domain(Iso_cuboid(-CGAL_PI, - CGAL::sqrt(3.) / 2., -0.1,
CGAL_PI / 3., CGAL_PI / 2., CGAL::sqrt(14.)));
Point_3 p0(CGAL_PI/4., std::cos(0.7), 1./3.);
Point_3 p1(-0.75, -1.24, CGAL::sqrt(3.));
Point_3 p2(0.1, std::sin(1./0.002478), CGAL_PI);
Point_3 p3(0., 0., 0.);
Point_3 p4(1./3., 20./6., 0.);
Point_3 p5(-2., 0., 0.);
Point_3 p6(-4., 0., 0.);
Weighted_point_3 wp[19] =
{
Weighted_point_3(p0, 9.),
Weighted_point_3(p1, 9.),
Weighted_point_3(p2, 9.),
Weighted_point_3(p3, 9.),
Weighted_point_3(p0, 6.),
Weighted_point_3(p0, 3.),
Weighted_point_3(p0, 12.),
Weighted_point_3(p0,0.), // 7th
Weighted_point_3(p1,0.),
Weighted_point_3(p2,0.),
Weighted_point_3(p3,0.),
Weighted_point_3(p4,0.),
Weighted_point_3(p5,0.),
Weighted_point_3(p6,0.),
Weighted_point_3(p0,2.),
Weighted_point_3(p1,2.),
Weighted_point_3(p2,2.),
Weighted_point_3(p3,2.),
Weighted_point_3(p4,2.)
};
_test_for_given_domain(traits, wp);
}
@@ -1,4 +1,4 @@
// Copyright (c) 1998 INRIA Sophia-Antipolis (France).
// Copyright (c) 1998, 2015 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -14,21 +14,23 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Francois Rebufat
// Manuel Caroli
// Aymeric Pelle
#include "_test_cls_periodic_3_iterator.h"
#include "_test_cls_periodic_3_circulator.h"
#include <cassert>
#include <iostream>
#include <iterator>
#include <fstream>
#include <sstream>
#include <list>
#include <vector>
#include "_test_cls_periodic_3_iterator.h"
#include "_test_cls_periodic_3_circulator.h"
template <class PeriodicTriangulation>
void
_test_periodic_3_triangulation_3_constructors(const PeriodicTriangulation &)
@@ -38,9 +40,9 @@ _test_periodic_3_triangulation_3_constructors(const PeriodicTriangulation &)
assert(PT_def.is_valid());
PeriodicTriangulation PT_dom(
typename PeriodicTriangulation::Iso_cuboid(-1,-2,-3,3,2,1));
typename PeriodicTriangulation::Iso_cuboid(-1,-2,-3,3,2,1));
assert(PT_def.is_valid());
PeriodicTriangulation PT_cp(PT_dom);
assert(PT_dom.is_valid());
assert(PT_cp == PT_dom);
@@ -49,7 +51,12 @@ _test_periodic_3_triangulation_3_constructors(const PeriodicTriangulation &)
template <class PeriodicTriangulation>
void
_test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
bool ex = false, bool hom = false)
const typename PeriodicTriangulation::Point& pointtt,
const char* covering_test_HOM_filename,
const char* covering_test_filename,
bool ex = false,
bool hom = false,
bool test_input_ouput = true)
{
typedef PeriodicTriangulation P3T3;
@@ -64,6 +71,7 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
typedef typename P3T3::Covering_sheets Covering_sheets;
CGAL_USE_TYPE(Covering_sheets);
typedef typename P3T3::Point_3 Point_3;
typedef typename P3T3::Point Point;
typedef typename P3T3::Segment Segment;
typedef typename P3T3::Triangle Triangle;
@@ -89,7 +97,7 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
CGAL_USE_TYPE(Cell);
typedef typename P3T3::Vertex_handle Vertex_handle;
typedef typename P3T3::Cell_handle Cell_handle;
typedef typename P3T3::Cell_handle Cell_handle;
typedef typename P3T3::size_type size_type;
typedef typename P3T3::difference_type difference_type;
@@ -145,13 +153,21 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
std::cout<<" non-degenerate, 1-sheeted covering"<<std::endl;
std::ifstream fin;
if (hom) fin.open("data/P3DT3_covering_test_HOM.tri");
else fin.open("data/P3DT3_covering_test.tri");
if (hom)
fin.open(covering_test_HOM_filename);
else
fin.open(covering_test_filename);
P3T3 PT1;
fin >> PT1;
PT1.insert(Point(0.711476,-0.0713565,-0.52312));
// assert(PT1.number_of_vertices() == 70);
assert(PT1.is_valid());
// assert(!PT1.is_extensible_triangulation_in_1_sheet_h1());
// assert(!PT1.is_extensible_triangulation_in_1_sheet_h2());
PT1.insert(pointtt);
assert(PT1.is_extensible_triangulation_in_1_sheet_h1());
assert(PT1.is_extensible_triangulation_in_1_sheet_h2());
assert(PT1.number_of_sheets() == CGAL::make_array(1,1,1));
assert(PT1.number_of_vertices() == 71);
// assert(PT1.number_of_vertices() == 71);
assert(PT1.is_valid());
std::cout<<" degenerate, 3-sheeted covering"<<std::endl;
@@ -159,39 +175,41 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
for (int i=0 ; i<6 ; i+=2)
for (int j=0 ; j<6 ; j+=2)
for (int k=0 ; k<6 ; k+=2)
PT3_deg.insert(Point(i,j,k));
PT3_deg.insert(Point(i,j,k));
assert(PT3_deg.number_of_sheets() == CGAL::make_array(3,3,3));
assert(PT3_deg.number_of_vertices() == 27);
assert(PT3_deg.is_valid());
std::cout<<" degenerate, 1-sheeted covering"<<std::endl;
P3T3 PT1_deg(PT3_deg);
for (int i=1 ; i<6 ; i+=2)
for (int j=1 ; j<6 ; j+=2)
for (int k=1 ; k<6 ; k+=2)
PT1_deg.insert(Point(i,j,k));
P3T3 PT1_deg(Iso_cuboid(0,0,0,4,4,4));;
for (unsigned i = 0; i < 8; ++i)
for (unsigned j = 0; j < 8; ++j)
for (unsigned k = 0; k < 8; ++k)
PT1_deg.insert(Point(static_cast<float>(i)*4./8.,static_cast<float>(j)*4./8.,static_cast<float>(k)*4./8.));
assert(PT1_deg.number_of_sheets() == CGAL::make_array(1,1,1));
assert(PT1_deg.number_of_vertices() == 54);
// assert(PT1_deg.number_of_vertices() == 54);
assert(PT1_deg.is_valid());
std::cout<<"Constructor"<<std::endl;
typename P3T3::FT ft1(-0.1);
typename P3T3::FT ft2(0.2);
Iso_cuboid domain(ft1,ft1,ft1,ft2,ft2,ft2);
std::cout<<"x-length: "<<domain.xmax()-domain.xmin()<<'\t'
<<"y-length: "<<domain.ymax()-domain.ymin()<<'\t'
<<"z-length: "<<domain.zmax()-domain.zmin()<<std::endl;
// RT used to make it work with homogeneous kernels
typename Geometric_traits::RT ft1(1);
typename Geometric_traits::RT ft2(2);
Iso_cuboid domain(ft1, ft1, ft1, ft2, ft2, ft2, 10);
std::cout << "x-length: "<<domain.xmax()-domain.xmin()<<'\t'
<< "y-length: "<<domain.ymax()-domain.ymin()<<'\t'
<< "z-length: "<<domain.zmax()-domain.zmin()<<std::endl;
std::cout<<"Comparisons: "
<<(domain.xmax()-domain.xmin() == domain.ymax()-domain.ymin())
<<(domain.xmax()-domain.xmin() == domain.zmax()-domain.zmin())
<<(domain.ymax()-domain.ymin() == domain.zmax()-domain.zmin())
<<((domain.xmax()-domain.xmin()) == (domain.ymax()-domain.ymin()))
<<((domain.xmax()-domain.xmin()) == (domain.zmax()-domain.zmin()))
<<((domain.ymax()-domain.ymin()) == (domain.zmax()-domain.zmin()))
<<std::endl;
<< (domain.xmax()-domain.xmin() == domain.ymax()-domain.ymin())
<< (domain.xmax()-domain.xmin() == domain.zmax()-domain.zmin())
<< (domain.ymax()-domain.ymin() == domain.zmax()-domain.zmin())
<< ((domain.xmax()-domain.xmin()) == (domain.ymax()-domain.ymin()))
<< ((domain.xmax()-domain.xmin()) == (domain.zmax()-domain.zmin()))
<< ((domain.ymax()-domain.ymin()) == (domain.zmax()-domain.zmin()))
<< std::endl;
P3T3 PT_constr(domain);
@@ -219,7 +237,7 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
assert(PT == PT1_deg);
assert(PT.is_valid());
assert(PT3.is_valid());
PT.clear();
assert(PT.number_of_vertices() == 0);
assert(PT.number_of_sheets() == CGAL::make_array(3,3,3));
@@ -228,7 +246,7 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
// operator== and operator!= are tested in the asserts above
std::cout<<"Access"<<std::endl;
Geometric_traits gt = PT.geom_traits();
Triangulation_data_structure tds = PT.tds();
assert(P3T3().domain() == Iso_cuboid(0,0,0,1,1,1));
@@ -243,7 +261,7 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
assert(PT1.number_of_sheets() == CGAL::make_array(1,1,1));
assert(PT3_deg.number_of_sheets() == CGAL::make_array(3,3,3));
assert(PT1_deg.number_of_sheets() == CGAL::make_array(1,1,1));
assert(PT1.is_extensible_triangulation_in_1_sheet_h1());
assert(!PT3.is_extensible_triangulation_in_1_sheet_h1());
assert(PT1_deg.is_extensible_triangulation_in_1_sheet_h1());
@@ -274,21 +292,21 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
// Check the Euler relation
assert(PT1.number_of_vertices() - PT1.number_of_edges()
+ PT1.number_of_facets() - PT1.number_of_cells() == 0);
+ PT1.number_of_facets() - PT1.number_of_cells() == 0);
assert(PT1.number_of_stored_vertices() - PT1.number_of_stored_edges()
+ PT1.number_of_stored_facets() - PT1.number_of_stored_cells() == 0);
+ PT1.number_of_stored_facets() - PT1.number_of_stored_cells() == 0);
assert(PT3.number_of_vertices() - PT3.number_of_edges()
+ PT3.number_of_facets() - PT3.number_of_cells() == 0);
+ PT3.number_of_facets() - PT3.number_of_cells() == 0);
assert(PT3.number_of_stored_vertices() - PT3.number_of_stored_edges()
+ PT3.number_of_stored_facets() - PT3.number_of_stored_cells() == 0);
+ PT3.number_of_stored_facets() - PT3.number_of_stored_cells() == 0);
assert(PT1_deg.number_of_vertices() - PT1_deg.number_of_edges()
+ PT1_deg.number_of_facets() - PT1_deg.number_of_cells() == 0);
+ PT1_deg.number_of_facets() - PT1_deg.number_of_cells() == 0);
assert(PT1_deg.number_of_stored_vertices() - PT1_deg.number_of_stored_edges()
+ PT1_deg.number_of_stored_facets()-PT1_deg.number_of_stored_cells()==0);
+ PT1_deg.number_of_stored_facets()-PT1_deg.number_of_stored_cells()==0);
assert(PT3_deg.number_of_vertices() - PT3_deg.number_of_edges()
+ PT3_deg.number_of_facets() - PT3_deg.number_of_cells() == 0);
+ PT3_deg.number_of_facets() - PT3_deg.number_of_cells() == 0);
assert(PT3_deg.number_of_stored_vertices() - PT3_deg.number_of_stored_edges()
+ PT3_deg.number_of_stored_facets()-PT3_deg.number_of_stored_cells()==0);
+ PT3_deg.number_of_stored_facets()-PT3_deg.number_of_stored_cells()==0);
// Checking the number copies of each item in 27-sheeted covering space
assert(PT1.number_of_cells() == PT1.number_of_stored_cells());
@@ -317,17 +335,17 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
assert(PT3.periodic_segment(Edge(ch,2,3)).at(0).second != Offset());
assert(PT3.periodic_segment(ch,2,1).at(1).second != Offset());
PT3.segment(PT3.periodic_segment(ch,0,3));
PT3.construct_segment(PT3.periodic_segment(ch,0,3));
assert(PT3.periodic_triangle(Facet(ch,0)).at(2).second != Offset());
assert(PT3.periodic_triangle(ch,2).at(1).second != Offset());
PT3.triangle(PT3.periodic_triangle(ch,0));
PT3.construct_triangle(PT3.periodic_triangle(ch,0));
assert(PT3.periodic_tetrahedron(ch).at(3).second != Offset());
PT3.tetrahedron(PT3.periodic_tetrahedron(ch));
PT3.construct_tetrahedron(PT3.periodic_tetrahedron(ch));
std::cout<<"Queries"<<std::endl;
Vertex_handle vh;
assert(PT3.is_vertex(ch->vertex(0)->point(),vh));
assert(ch->vertex(0) != vh);
@@ -352,54 +370,54 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
assert(ch->vertex(0) == c->vertex(i));
assert(ch->vertex(1) == c->vertex(j));
assert(!PT3.is_edge(ch->vertex(0),
ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j));
ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j));
assert(PT3.is_edge(ch->vertex(0),off0,ch->vertex(1),off1,c,i,j));
assert(ch->vertex(0) == c->vertex(i));
assert(ch->vertex(1) == c->vertex(j));
assert(!PT3.is_edge(ch->vertex(0),off0,ch->vertex(1),off1+Offset(0,0,1),
c,i,j));
c,i,j));
assert(PT3.is_facet(ch->vertex(0),ch->vertex(1),ch->vertex(2), c,i,j,k));
assert(ch->vertex(0) == c->vertex(i));
assert(ch->vertex(1) == c->vertex(j));
assert(ch->vertex(2) == c->vertex(k));
assert(!PT3.is_facet(ch->vertex(0),ch->vertex(1),
ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j,k));
ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j,k));
assert(PT3.is_facet(ch->vertex(0),off0,ch->vertex(1),off1,ch->vertex(2),off2,
c,i,j,k));
c,i,j,k));
assert(ch->vertex(0) == c->vertex(i));
assert(ch->vertex(1) == c->vertex(j));
assert(ch->vertex(2) == c->vertex(k));
assert(!PT3.is_facet(ch->vertex(0),off0,ch->vertex(1),off1,
ch->vertex(2),off2+Offset(0,0,1),c,i,j,k));
ch->vertex(2),off2+Offset(0,0,1),c,i,j,k));
c = Cell_handle();
assert(PT3.is_cell(ch));
assert(!PT3.is_cell(c));
assert(PT3.is_cell(ch->vertex(0),ch->vertex(1),ch->vertex(2),ch->vertex(3),
c));
c));
assert(!PT3.is_cell(ch->vertex(0),ch->vertex(1),ch->vertex(2),
ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c));
ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c));
assert(PT3.is_cell(ch->vertex(0),ch->vertex(1),ch->vertex(2),ch->vertex(3),
c,i,j,k,l));
c,i,j,k,l));
assert(ch->vertex(0) == c->vertex(i));
assert(ch->vertex(1) == c->vertex(j));
assert(ch->vertex(2) == c->vertex(k));
assert(ch->vertex(3) == c->vertex(l));
assert(!PT3.is_cell(ch->vertex(0),ch->vertex(1),ch->vertex(2),
ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j,k,l));
ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j,k,l));
assert(PT3.is_cell(ch->vertex(0),off0,ch->vertex(1),off1,
ch->vertex(2),off2,ch->vertex(3),off3,c,i,j,k,l));
ch->vertex(2),off2,ch->vertex(3),off3,c,i,j,k,l));
assert(PT3.is_cell(ch->vertex(0),off0,ch->vertex(1),off1,
ch->vertex(2),off2,ch->vertex(3),off3,c));
ch->vertex(2),off2,ch->vertex(3),off3,c));
assert(ch->vertex(0) == c->vertex(i));
assert(ch->vertex(1) == c->vertex(j));
assert(ch->vertex(2) == c->vertex(k));
assert(ch->vertex(3) == c->vertex(l));
assert(!PT3.is_cell(ch->vertex(0),off0,ch->vertex(1),off1+Offset(0,0,1),
ch->vertex(2),off2,ch->vertex(3),off3,c,i,j,k,l));
ch->vertex(2),off2,ch->vertex(3),off3,c,i,j,k,l));
assert(!PT3.is_cell(ch->vertex(0),off0,ch->vertex(1),off1+Offset(0,0,1),
ch->vertex(2),off2,ch->vertex(3),off3,c));
ch->vertex(2),off2,ch->vertex(3),off3,c));
assert(PT3.has_vertex(Facet(ch,0),ch->vertex(1),i));
assert(PT3.has_vertex(ch,0,ch->vertex(1),i));
@@ -420,14 +438,14 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
std::cout<<"Point location"<<std::endl;
ch = PT3_deg.inexact_locate(Point(0.5,0.5,0.5));
assert( PT3_deg.tetrahedron(PT3_deg.periodic_tetrahedron(ch))
== PT3_deg.geom_traits().construct_tetrahedron_3_object()(
Point(0,0,0), Point(0,2,0), Point(0,0,2), Point(2,0,0)) );
assert( PT3_deg.construct_tetrahedron(PT3_deg.periodic_tetrahedron(ch))
== PT3_deg.geom_traits().construct_tetrahedron_3_object()(
Point_3(0,0,0), Point_3(0,2,0), Point_3(0,0,2), Point_3(2,0,0)) );
ch = PT3_deg.locate(Point(0.5,0.5,0.5));
assert( PT3_deg.tetrahedron(PT3_deg.periodic_tetrahedron(ch))
== PT3_deg.geom_traits().construct_tetrahedron_3_object()(
Point(0,0,0), Point(0,2,0), Point(0,0,2), Point(2,0,0)) );
assert( PT3_deg.construct_tetrahedron(PT3_deg.periodic_tetrahedron(ch))
== PT3_deg.geom_traits().construct_tetrahedron_3_object()(
Point_3(0,0,0), Point_3(0,2,0), Point_3(0,0,2), Point_3(2,0,0)) );
Locate_type lt;
int li,lj;
@@ -435,33 +453,33 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
assert(c == ch);
assert(lt == P3T3::CELL);
assert(PT3_deg.side_of_cell(Point(0.5,0.5,0.5),c,lt,li,lj)
== CGAL::ON_BOUNDED_SIDE);
== CGAL::ON_BOUNDED_SIDE);
assert(lt == P3T3::CELL);
assert(PT3_deg.side_of_cell(Point(0.5,0.5,0.5),c->neighbor(0),lt,li,lj)
== CGAL::ON_UNBOUNDED_SIDE);
== CGAL::ON_UNBOUNDED_SIDE);
c = PT3_deg.locate(Point(2,0.5,0.5),lt,li,lj);
assert(lt == P3T3::FACET);
assert( PT3_deg.triangle(PT3_deg.periodic_triangle(c,li))
== PT3_deg.geom_traits().construct_triangle_3_object()(
Point(2,0,2), Point(2,0,0), Point(2,2,0)) );
assert( PT3_deg.construct_triangle(PT3_deg.periodic_triangle(c,li))
== PT3_deg.geom_traits().construct_triangle_3_object()(
Point_3(2,0,2), Point_3(2,0,0), Point_3(2,2,0)) );
assert(PT3_deg.side_of_cell(Point(2,0.5,0.5),c,lt,li,lj)
== CGAL::ON_BOUNDARY);
== CGAL::ON_BOUNDARY);
assert(lt == P3T3::FACET);
assert( PT3_deg.triangle(PT3_deg.periodic_triangle(c,li))
== PT3_deg.geom_traits().construct_triangle_3_object()(
Point(2,0,2), Point(2,0,0), Point(2,2,0)) );
assert( PT3_deg.construct_triangle(PT3_deg.periodic_triangle(c,li))
== PT3_deg.geom_traits().construct_triangle_3_object()(
Point_3(2,0,2), Point_3(2,0,0), Point_3(2,2,0)) );
c = PT3_deg.locate(Point(2,2,1),lt,li,lj);
assert(lt == P3T3::EDGE);
assert( PT3_deg.segment(PT3_deg.periodic_segment(c,li,lj))
== PT3_deg.geom_traits().construct_segment_3_object()(
Point(2,2,0), Point(2,2,2)) );
assert( PT3_deg.construct_segment(PT3_deg.periodic_segment(c,li,lj))
== PT3_deg.geom_traits().construct_segment_3_object()(
Point_3(2,2,0), Point_3(2,2,2)) );
assert(PT3_deg.side_of_cell(Point(2,2,1),c,lt,li,lj) == CGAL::ON_BOUNDARY);
assert(lt == P3T3::EDGE);
assert( PT3_deg.segment(PT3_deg.periodic_segment(c,li,lj))
== PT3_deg.geom_traits().construct_segment_3_object()(
Point(2,2,0), Point(2,2,2)) );
assert( PT3_deg.construct_segment(PT3_deg.periodic_segment(c,li,lj))
== PT3_deg.geom_traits().construct_segment_3_object()(
Point_3(2,2,0), Point_3(2,2,2)) );
c = PT3_deg.locate(Point(2,2,2),lt,li,lj);
assert(lt == P3T3::VERTEX);
@@ -470,12 +488,12 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
assert(lt == P3T3::VERTEX);
assert(c->vertex(li)->point() == Point(2,2,2));
c = P3T3().locate(Point(1,2,3),lt,li,lj);
assert(c == Cell_handle());
assert(lt == P3T3::EMPTY);
assert(P3T3().side_of_cell(Point(1,2,3),c,lt,li,lj)
== CGAL::ON_UNBOUNDED_SIDE);
assert(lt == P3T3::EMPTY);
c = P3T3().locate(Point(1,2,3),lt,li,lj);
assert(c == Cell_handle());
assert(lt == P3T3::EMPTY);
assert(P3T3().side_of_cell(Point(1,2,3),c,lt,li,lj)
== CGAL::ON_UNBOUNDED_SIDE);
assert(lt == P3T3::EMPTY);
std::cout << "Testing Iterators "<< std::endl;
@@ -511,50 +529,50 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
PT3.incident_cells(PT3.vertices_begin(),std::back_inserter(cellv));
for (unsigned int n=0 ; n<cellv.size() ; n++) {
assert( (PT3.vertices_begin() == cellv[n]->vertex(0))
|| (PT3.vertices_begin() == cellv[n]->vertex(1))
|| (PT3.vertices_begin() == cellv[n]->vertex(2))
|| (PT3.vertices_begin() == cellv[n]->vertex(3)) );
|| (PT3.vertices_begin() == cellv[n]->vertex(1))
|| (PT3.vertices_begin() == cellv[n]->vertex(2))
|| (PT3.vertices_begin() == cellv[n]->vertex(3)) );
assert(PT3.is_cell(cellv[n]));
assert(PT3.is_cell(cellv[n]->vertex(0),cellv[n]->vertex(1),
cellv[n]->vertex(2),cellv[n]->vertex(3),c));
cellv[n]->vertex(2),cellv[n]->vertex(3),c));
assert(PT3.is_cell(
cellv[n]->vertex(0),PT3.periodic_point(cellv[n],0).second,
cellv[n]->vertex(1),PT3.periodic_point(cellv[n],1).second,
cellv[n]->vertex(2),PT3.periodic_point(cellv[n],2).second,
cellv[n]->vertex(3),PT3.periodic_point(cellv[n],3).second,c));
cellv[n]->vertex(0),PT3.periodic_point(cellv[n],0).second,
cellv[n]->vertex(1),PT3.periodic_point(cellv[n],1).second,
cellv[n]->vertex(2),PT3.periodic_point(cellv[n],2).second,
cellv[n]->vertex(3),PT3.periodic_point(cellv[n],3).second,c));
}
PT3.incident_facets(PT3.vertices_begin(),std::back_inserter(facetv));
for (unsigned int n=0 ; n<facetv.size() ; n++) {
assert( (PT3.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+1)&3))
|| (PT3.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+2)&3))
|| (PT3.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+3)&3)) );
== facetv[n].first->vertex((facetv[n].second+1)&3))
|| (PT3.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+2)&3))
|| (PT3.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+3)&3)) );
assert(PT3.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3),
facetv[n].first->vertex((facetv[n].second+2)&3),
facetv[n].first->vertex((facetv[n].second+3)&3),c,i,j,k));
facetv[n].first->vertex((facetv[n].second+2)&3),
facetv[n].first->vertex((facetv[n].second+3)&3),c,i,j,k));
assert(PT3.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3),
PT3.periodic_point(facetv[n].first,(facetv[n].second+1)&3).second,
facetv[n].first->vertex((facetv[n].second+2)&3),
PT3.periodic_point(facetv[n].first,(facetv[n].second+2)&3).second,
facetv[n].first->vertex((facetv[n].second+3)&3),
PT3.periodic_point(facetv[n].first,(facetv[n].second+3)&3).second,
c,i,j,k));
PT3.periodic_point(facetv[n].first,(facetv[n].second+1)&3).second,
facetv[n].first->vertex((facetv[n].second+2)&3),
PT3.periodic_point(facetv[n].first,(facetv[n].second+2)&3).second,
facetv[n].first->vertex((facetv[n].second+3)&3),
PT3.periodic_point(facetv[n].first,(facetv[n].second+3)&3).second,
c,i,j,k));
}
PT3.incident_edges(PT3.vertices_begin(),std::back_inserter(edgev));
for (unsigned int n=0 ; n<edgev.size() ; n++) {
assert( (PT3.vertices_begin()
== edgev[n].first->vertex(edgev[n].second))
|| (PT3.vertices_begin()
== edgev[n].first->vertex(edgev[n].third)) );
== edgev[n].first->vertex(edgev[n].second))
|| (PT3.vertices_begin()
== edgev[n].first->vertex(edgev[n].third)) );
assert(PT3.is_edge(edgev[n].first->vertex(edgev[n].second),
edgev[n].first->vertex(edgev[n].third),c,i,j));
edgev[n].first->vertex(edgev[n].third),c,i,j));
assert(PT3.is_edge(edgev[n].first->vertex(edgev[n].second),
PT3.periodic_point(edgev[n].first,edgev[n].second).second,
edgev[n].first->vertex(edgev[n].third),
PT3.periodic_point(edgev[n].first,edgev[n].third).second,c,i,j));
PT3.periodic_point(edgev[n].first,edgev[n].second).second,
edgev[n].first->vertex(edgev[n].third),
PT3.periodic_point(edgev[n].first,edgev[n].third).second,c,i,j));
}
PT3.adjacent_vertices(PT3.vertices_begin(),std::back_inserter(vertexv));
for (unsigned int n=0 ; n<vertexv.size() ; n++) {
@@ -573,50 +591,50 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
PT1.incident_cells(PT1.vertices_begin(),std::back_inserter(cellv));
for (unsigned int n=0 ; n<cellv.size() ; n++) {
assert( (PT1.vertices_begin() == cellv[n]->vertex(0))
|| (PT1.vertices_begin() == cellv[n]->vertex(1))
|| (PT1.vertices_begin() == cellv[n]->vertex(2))
|| (PT1.vertices_begin() == cellv[n]->vertex(3)) );
|| (PT1.vertices_begin() == cellv[n]->vertex(1))
|| (PT1.vertices_begin() == cellv[n]->vertex(2))
|| (PT1.vertices_begin() == cellv[n]->vertex(3)) );
assert(PT1.is_cell(cellv[n]));
assert(PT1.is_cell(cellv[n]->vertex(0),cellv[n]->vertex(1),
cellv[n]->vertex(2),cellv[n]->vertex(3),c));
cellv[n]->vertex(2),cellv[n]->vertex(3),c));
assert(PT1.is_cell(
cellv[n]->vertex(0),PT1.periodic_point(cellv[n],0).second,
cellv[n]->vertex(1),PT1.periodic_point(cellv[n],1).second,
cellv[n]->vertex(2),PT1.periodic_point(cellv[n],2).second,
cellv[n]->vertex(3),PT1.periodic_point(cellv[n],3).second,c));
cellv[n]->vertex(0),PT1.periodic_point(cellv[n],0).second,
cellv[n]->vertex(1),PT1.periodic_point(cellv[n],1).second,
cellv[n]->vertex(2),PT1.periodic_point(cellv[n],2).second,
cellv[n]->vertex(3),PT1.periodic_point(cellv[n],3).second,c));
}
PT1.incident_facets(PT1.vertices_begin(),std::back_inserter(facetv));
for (unsigned int n=0 ; n<facetv.size() ; n++) {
assert( (PT1.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+1)&3))
|| (PT1.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+2)&3))
|| (PT1.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+3)&3)) );
== facetv[n].first->vertex((facetv[n].second+1)&3))
|| (PT1.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+2)&3))
|| (PT1.vertices_begin()
== facetv[n].first->vertex((facetv[n].second+3)&3)) );
assert(PT1.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3),
facetv[n].first->vertex((facetv[n].second+2)&3),
facetv[n].first->vertex((facetv[n].second+3)&3),c,i,j,k));
assert(PT1.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3),
PT1.periodic_point(facetv[n].first,(facetv[n].second+1)&3).second,
facetv[n].first->vertex((facetv[n].second+2)&3),
PT1.periodic_point(facetv[n].first,(facetv[n].second+2)&3).second,
facetv[n].first->vertex((facetv[n].second+3)&3),
PT1.periodic_point(facetv[n].first,(facetv[n].second+3)&3).second,
c,i,j,k));
facetv[n].first->vertex((facetv[n].second+2)&3),
facetv[n].first->vertex((facetv[n].second+3)&3),c,i,j,k));
assert(PT1.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3),
PT1.periodic_point(facetv[n].first,(facetv[n].second+1)&3).second,
facetv[n].first->vertex((facetv[n].second+2)&3),
PT1.periodic_point(facetv[n].first,(facetv[n].second+2)&3).second,
facetv[n].first->vertex((facetv[n].second+3)&3),
PT1.periodic_point(facetv[n].first,(facetv[n].second+3)&3).second,
c,i,j,k));
}
PT1.incident_edges(PT1.vertices_begin(),std::back_inserter(edgev));
for (unsigned int n=0 ; n<edgev.size() ; n++) {
assert( (PT1.vertices_begin()
== edgev[n].first->vertex(edgev[n].second))
|| (PT1.vertices_begin()
== edgev[n].first->vertex(edgev[n].third)) );
== edgev[n].first->vertex(edgev[n].second))
|| (PT1.vertices_begin()
== edgev[n].first->vertex(edgev[n].third)) );
assert(PT1.is_edge(edgev[n].first->vertex(edgev[n].second),
edgev[n].first->vertex(edgev[n].third),c,i,j));
edgev[n].first->vertex(edgev[n].third),c,i,j));
assert(PT1.is_edge(edgev[n].first->vertex(edgev[n].second),
PT1.periodic_point(edgev[n].first,edgev[n].second).second,
edgev[n].first->vertex(edgev[n].third),
PT1.periodic_point(edgev[n].first,edgev[n].third).second,c,i,j));
PT1.periodic_point(edgev[n].first,edgev[n].second).second,
edgev[n].first->vertex(edgev[n].third),
PT1.periodic_point(edgev[n].first,edgev[n].third).second,c,i,j));
}
PT1.adjacent_vertices(PT1.vertices_begin(),std::back_inserter(vertexv));
for (unsigned int n=0 ; n<vertexv.size() ; n++) {
@@ -630,62 +648,66 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &,
assert(ch->neighbor(0)->neighbor(PT3.mirror_index(ch,0)) == ch);
assert(ch->neighbor(0)->neighbor(
ch->neighbor(0)->index(PT3.mirror_vertex(ch,0))) == ch);
ch->neighbor(0)->index(PT3.mirror_vertex(ch,0))) == ch);
assert(ch->neighbor(0)->vertex(PT3.mirror_facet(Facet(ch,0)).second)
== PT3.mirror_vertex(ch,0));
== PT3.mirror_vertex(ch,0));
assert(PT3.mirror_facet(Facet(ch,0)).first == ch->neighbor(0));
std::cout << "I/O" << std::endl;
std::cout << " ascii" << std::endl;
std::stringstream ss1;
std::stringstream ss3;
ss1 << PT1;
ss3 << PT3;
P3T3 PT1r, PT3r;
ss1 >> PT1r;
ss3 >> PT3r;
assert(CGAL::is_ascii(ss1));
assert(CGAL::is_ascii(ss3));
if (!ex) assert(PT1 == PT1r);
if (!ex) assert(PT3 == PT3r);
std::cout << " binary" << std::endl;
PT1r.clear();
PT3r.clear();
// There are problems with the IO of exact number types in binary mode.
if (!ex) {
std::stringstream ss1b;
std::stringstream ss3b;
CGAL::set_binary_mode(ss1b);
CGAL::set_binary_mode(ss3b);
ss1b << PT1;
ss3b << PT3;
ss1b >> PT1r;
ss3b >> PT3r;
assert(CGAL::is_binary(ss1b));
assert(CGAL::is_binary(ss3b));
if(test_input_ouput)
{
std::cout << "I/O" << std::endl;
std::cout << " ascii" << std::endl;
assert(PT1 == PT1r);
assert(PT3 == PT3r);
std::stringstream ss1;
std::stringstream ss3;
ss1 << PT1;
ss3 << PT3;
P3T3 PT1r, PT3r;
ss1 >> PT1r;
ss3 >> PT3r;
assert(CGAL::is_ascii(ss1));
assert(CGAL::is_ascii(ss3));
if (!ex) assert(PT1 == PT1r);
if (!ex) assert(PT3 == PT3r);
std::cout << " binary" << std::endl;
PT1r.clear();
PT3r.clear();
if (!ex) {
std::stringstream ss1b;
std::stringstream ss3b;
CGAL::set_binary_mode(ss1b);
CGAL::set_binary_mode(ss3b);
ss1b << PT1;
ss3b << PT3;
ss1b >> PT1r;
ss3b >> PT3r;
assert(CGAL::is_binary(ss1b));
assert(CGAL::is_binary(ss3b));
assert(PT1 == PT1r);
assert(PT3 == PT3r);
}
std::cout << " pretty" << std::endl;
PT1r.clear();
PT3r.clear();
std::stringstream ss1p;
std::stringstream ss3p;
CGAL::set_pretty_mode(ss1p);
CGAL::set_pretty_mode(ss3p);
ss1p << PT1;
ss3p << PT3;
assert(CGAL::is_pretty(ss1p));
assert(CGAL::is_pretty(ss3p));
}
std::cout << " pretty" << std::endl;
PT1r.clear();
PT3r.clear();
std::stringstream ss1p;
std::stringstream ss3p;
CGAL::set_pretty_mode(ss1p);
CGAL::set_pretty_mode(ss3p);
ss1p << PT1;
ss3p << PT3;
assert(CGAL::is_pretty(ss1p));
assert(CGAL::is_pretty(ss3p));
}
@@ -0,0 +1,59 @@
// Copyright (c) 2015 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Aymeric Pelle
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/_test_cls_periodic_3_triangulation_3.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Periodic_3_triangulation_3.h>
#include <CGAL/Periodic_3_triangulation_traits_3.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Epeck;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<Epeck> PRTT_Exact;
// Explicit instantiation of the whole class:
template class CGAL::Periodic_3_regular_triangulation_3<PRTT_Exact>;
typedef CGAL::Exact_predicates_inexact_constructions_kernel Epick;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<Epick> PRTT_Inexact;
// Explicit instantiation of the whole class:
template class CGAL::Periodic_3_regular_triangulation_3<PRTT_Inexact>;
int main(int, char**)
{
typedef CGAL::Periodic_3_regular_triangulation_3<PRTT_Exact> P3RT3_Exact;
_test_periodic_3_triangulation_3_constructors( P3RT3_Exact() );
_test_cls_periodic_3_triangulation_3(P3RT3_Exact(),
PRTT_Exact::Weighted_point_3(0.816982, 0.161518, -0.0942375),
"data/P3RT3_covering_test_HOM.tri",
"data/P3RT3_covering_test.tri",
true);
typedef CGAL::Periodic_3_regular_triangulation_3<PRTT_Inexact> P3RT3_Inexact;
_test_periodic_3_triangulation_3_constructors( P3RT3_Inexact() );
_test_cls_periodic_3_triangulation_3(P3RT3_Inexact(),
PRTT_Inexact::Weighted_point_3(0.816982, 0.161518, -0.0942375),
"data/P3RT3_covering_test_HOM.tri",
"data/P3RT3_covering_test.tri");
return 0;
}
@@ -0,0 +1,189 @@
// Copyright (c) 1998 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Date$
//
//
// Author(s) : Aymeric PELLE <aymeric.pelle@sophia.inria.fr>
#include <CGAL/Gmpz.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Lazy_exact_nt.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <CGAL/Random.h>
#include <CGAL/point_generators_3.h>
#include <algorithm>
#include <cassert>
#include <iostream>
#include <fstream>
#include <set>
#include <string>
typedef CGAL::Periodic_3_regular_triangulation_traits_3<CGAL::Epeck> Traits_Epeck;
/* Explicit instantiation.
* It allows us to test if the template class, instantiated with given template parameters, compiles.
*/
template class CGAL::Periodic_3_regular_triangulation_3<Traits_Epeck>;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<CGAL::Epick> Traits_Epick;
/* Explicit instantiation.
* It allows us to test if the template class, instantiated with given template parameters, compiles.
*/
template class CGAL::Periodic_3_regular_triangulation_3<Traits_Epick>;
template <class Kernel>
class Tests
{
public:
typedef Kernel K;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Traits;
typedef CGAL::Periodic_3_regular_triangulation_3<Traits> P3RT3;
typedef typename P3RT3::Vertex_handle Vertex_handle;
typedef typename P3RT3::Facet Facet;
typedef typename P3RT3::Cell Cell;
typedef typename P3RT3::Cell_handle Cell_handle;
typedef typename P3RT3::Vertex_iterator Vertex_iterator;
typedef typename P3RT3::Cell_iterator Cell_iterator;
typedef typename P3RT3::Segment Segment;
typedef typename P3RT3::Triangle Triangle;
typedef typename P3RT3::Tetrahedron Tetrahedron;
typedef typename P3RT3::Periodic_tetrahedron Periodic_tetrahedron;
typedef typename P3RT3::Locate_type Locate_type;
typedef typename P3RT3::Offset Offset;
typedef typename Traits::Weighted_point_3 Weighted_point_3;
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Iso_cuboid_3 Iso_cuboid;
static void test_insert_rnd_then_remove_all (unsigned pt_count,
unsigned seed,
const std::string& path)
{
std::cout << "--- test_insert_rnd (" << pt_count << ", " << seed << ')' << std::endl;
CGAL::Random random(seed);
typedef CGAL::Creator_uniform_3<double, Point_3> Creator;
CGAL::Random_points_in_cube_3<Point_3, Creator> in_cube(0.5, random);
Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
P3RT3 p3rt3(iso_cuboid);
std::ofstream stream("p3rt3_ir_point_set");
assert(stream);
std::ifstream input_stream(path.c_str());
std::vector<Weighted_point_3> insert_set;
insert_set.reserve(pt_count);
std::vector<Weighted_point_3> remove_set;
remove_set.reserve(pt_count);
std::cout << "-- insert" << std::endl;
for (unsigned cnt = 1; cnt <= pt_count; ++cnt)
{
// Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625));
// std::cout << cnt << " : " << p << std::endl;
Weighted_point_3 p;
input_stream >> p;
assert(p.weight() < 0.015625);
stream << p << std::endl;
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
Vertex_handle vh = p3rt3.insert(p);
std::size_t hidden_point_count_2 = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count_2 += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count <= hidden_point_count_2);
assert(hidden_point_count_2 + p3rt3.number_of_vertices() == cnt);
std::cout << cnt << " - p3rt3.number_of_vertices() : " << p3rt3.number_of_vertices() << " .number_of_stored_vertices : " << p3rt3.number_of_stored_vertices() << std::endl;
if (vh == Vertex_handle())
{
if (find(insert_set.begin(), insert_set.end(), p) == insert_set.end())
insert_set.push_back(p);
}
else
insert_set.push_back(p);
}
stream.close();
assert(p3rt3.is_valid());
std::cout << "-- remove" << std::endl;
unsigned cnt = 1;
for (; p3rt3.number_of_vertices() != 0; ++cnt)
{
Vertex_iterator iter = p3rt3.vertices_begin();
for (int j = random.get_int(0, static_cast<int>(p3rt3.number_of_vertices())); j; --j)
++iter;
std::cout << cnt << " : " << iter->point() << std::endl;
remove_set.push_back(iter->point());
p3rt3.remove(iter);
std::cout << " p3rt3.number_of_vertices() : " << p3rt3.number_of_vertices() << " .number_of_stored_vertices : " << p3rt3.number_of_stored_vertices() << std::endl;
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count + cnt + p3rt3.number_of_vertices() == insert_set.size());
}
std::sort(insert_set.begin(), insert_set.end());
std::sort(remove_set.begin(), remove_set.end());
assert(insert_set == remove_set);
assert(p3rt3.is_valid());
assert(p3rt3.number_of_stored_vertices() == 0);
}
static void test ()
{
////// Iso_cuboid unitaire -> 0 <= weight < 0.015625
test_insert_rnd_then_remove_all(800, 7, "data/p3rt3_point_set__s7_n800");
test_insert_rnd_then_remove_all(800, 12, "data/p3rt3_point_set__s12_n800");
}
};
int main (int, char**)
{
std::cout << "TESTING ..." << std::endl;
CGAL::force_ieee_double_precision();
std::cout << "Epeck ..." << std::endl;
Tests<CGAL::Epeck>::test();
std::cout << "Epick ..." << std::endl;
Tests<CGAL::Epick>::test();
std::cout << "EXIT SUCCESS" << std::endl;
return EXIT_SUCCESS;
}
@@ -12,10 +12,10 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $URL$
// $Id$
// $Date$
//
//
//
// Author(s) : Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -64,7 +64,7 @@ typedef CGAL::Triangulation_data_structure_3<EAsVb,EAsCb> ETds;
typedef CGAL::Periodic_3_Delaunay_triangulation_3<EK,ETds> EP3DT3;
typedef CGAL::Alpha_shape_3<EP3DT3> EAlpha_shape_3;
int main()
int main(int, char**)
{
CGAL::Timer timer;
timer.start();
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Nico Kruithof
// Manuel Caroli
@@ -47,7 +47,7 @@ typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K3> PTT3;
template class CGAL::Periodic_3_Delaunay_triangulation_3<PTT3>;
#include <CGAL/_test_cls_periodic_3_delaunay_3.h>
int main()
int main(int, char**)
{
CGAL::Timer timer;
timer.start();
@@ -14,7 +14,7 @@
//
// $URL: svn+ssh://mcaroli@scm.gforge.inria.fr/svn/cgal/trunk/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_3.cpp $
// $Id: test_periodic_3_delaunay_3.cpp 48874 2009-04-23 13:54:38Z mcaroli $
//
//
//
// Author(s) : Nico Kruithof
// Manuel Caroli
@@ -30,7 +30,7 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K1;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K1> PTT1;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K1> PTT1;
typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> DSVB1;
typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> DSCB1;
typedef CGAL::Triangulation_vertex_base_3<PTT1,DSVB1> VBB1;
@@ -43,7 +43,7 @@ template class CGAL::Periodic_3_triangulation_hierarchy_3<PDT1>;
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel K2;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K2> PTT2;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K2> PTT2;
typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> DSVB2;
typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> DSCB2;
typedef CGAL::Triangulation_vertex_base_3<PTT2,DSVB2> VBB2;
@@ -57,7 +57,7 @@ template class CGAL::Periodic_3_triangulation_hierarchy_3<PDT2>;
#include <CGAL/MP_Float.h>
#include <CGAL/Simple_homogeneous.h>
typedef CGAL::Simple_homogeneous<CGAL::MP_Float> K3;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K3> PTT3;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K3> PTT3;
typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> DSVB3;
typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> DSCB3;
typedef CGAL::Triangulation_vertex_base_3<PTT3,DSVB3> VBB3;
@@ -69,16 +69,16 @@ typedef CGAL::Periodic_3_Delaunay_triangulation_3<PTT3,TDS3> PDT3;
template class CGAL::Periodic_3_triangulation_hierarchy_3<PDT3>;
#include <CGAL/_test_cls_periodic_3_delaunay_3.h>
int main()
int main(int, char**)
{
CGAL::Timer timer;
timer.start();
typedef CGAL::Periodic_3_triangulation_hierarchy_3< PDT1 > P3T3_1;
_test_cls_periodic_3_delaunay_3( P3T3_1() );
// typedef CGAL::Periodic_3_triangulation_hierarchy_3< PDT2 > P3T3_2;
// this takes too much time for the test suite.
//_test_cls_periodic_3_delaunay_3( P3T3_2() );
typedef CGAL::Periodic_3_triangulation_hierarchy_3< PDT2 > P3T3_2;
_test_cls_periodic_3_delaunay_3( P3T3_2() );
// typedef CGAL::Periodic_3_triangulation_hierarchy_3< PDT3 > P3T3_3;
// this takes too much time for the test suite.
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Manuel Caroli
@@ -27,7 +27,8 @@
typedef CGAL::Periodic_3_offset_3 Offset;
#include <CGAL/_test_cls_periodic_3_offset_3.h>
int main()
int main(int, char**)
{
CGAL::Timer timer;
timer.start();
@@ -0,0 +1,776 @@
// Copyright (c) 1998 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Date$
//
//
// Author(s) : Aymeric PELLE <aymeric.pelle@sophia.inria.fr>
#include <CGAL/Gmpz.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Lazy_exact_nt.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Periodic_3_regular_triangulation_3.h>
#include <CGAL/Periodic_3_regular_triangulation_traits_3.h>
#include <CGAL/Random.h>
#include <CGAL/point_generators_3.h>
#include <algorithm>
#include <cassert>
#include <iostream>
#include <iterator>
#include <fstream>
#include <vector>
typedef CGAL::Periodic_3_regular_triangulation_traits_3<CGAL::Epeck> Traits_Epeck;
/* Explicit instantiation.
* It allows us to test if the template class, instantiated with given template parameters, compiles.
*/
template class CGAL::Periodic_3_regular_triangulation_3<Traits_Epeck>;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<CGAL::Epick> Traits_Epick;
/* Explicit instantiation.
* It allows us to test if the template class, instantiated with given template parameters, compiles.
*/
template class CGAL::Periodic_3_regular_triangulation_3<Traits_Epick>;
template <class Kernel>
class Tests
{
public:
typedef Kernel K;
typedef typename K::FT FT;
typedef CGAL::Periodic_3_regular_triangulation_traits_3<K> Traits;
typedef CGAL::Periodic_3_regular_triangulation_3<Traits> P3RT3;
typedef typename P3RT3::Vertex_handle Vertex_handle;
typedef typename P3RT3::Cell_handle Cell_handle;
typedef typename P3RT3::Facet Facet;
typedef typename P3RT3::Cell Cell;
typedef typename P3RT3::Vertex_iterator Vertex_iterator;
typedef typename P3RT3::Cell_iterator Cell_iterator;
typedef typename P3RT3::Segment Segment;
typedef typename P3RT3::Triangle Triangle;
typedef typename P3RT3::Tetrahedron Tetrahedron;
typedef typename P3RT3::Periodic_tetrahedron Periodic_tetrahedron;
typedef typename P3RT3::Locate_type Locate_type;
typedef typename P3RT3::Offset Offset;
typedef typename Traits::Weighted_point_3 Weighted_point_3;
typedef typename Traits::Point_3 Point_3;
typedef typename Traits::Iso_cuboid_3 Iso_cuboid;
static Weighted_point_3 read_wpoint (std::istream& stream)
{
FT x = 0., y = 0., z = 0., w = 0.;
stream >> x;
assert(stream && !stream.eof());
stream >> y;
assert(stream && !stream.eof());
stream >> z;
assert(stream && !stream.eof());
stream >> w;
assert(stream);
return Weighted_point_3(Point_3(x, y, z), w);
}
static void test_construction ()
{
std::cout << "--- test_construction" << std::endl;
P3RT3 p3rt3;
assert(p3rt3.is_valid());
}
static void test_insert_1 ()
{
std::cout << "--- test_insert_1" << std::endl;
P3RT3 p3rt3;
Weighted_point_3 p(Point_3(0,0,0), 0.01);
p3rt3.insert(p);
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 1);
assert(p3rt3.number_of_stored_vertices() == 27);
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
}
static void test_insert_point ()
{
std::cout << "--- test_insert_point" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1));
Vertex_handle vh;
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01));
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
Weighted_point_3 p(Point_3(0.4, 0.4, 0.4), 0.001);
vh = p3rt3.insert(p);
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 5);
assert(p3rt3.number_of_stored_vertices() == 135);
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
}
static void test_insert_hidden_point ()
{
std::cout << "--- test_insert_hidden_point" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1));
Vertex_handle vh;
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01));
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
Weighted_point_3 hidden_point(Point_3(0.101, 0.101, 0.101), 0.001);
vh = p3rt3.insert(hidden_point);
assert(vh == Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
unsigned hidden_found_count = 0;
hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
{
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
hidden_found_count += static_cast<unsigned>(std::find(iter->hidden_points_begin(), iter->hidden_points_end(), hidden_point) != iter->hidden_points_end());
}
assert(hidden_point_count == 1);
assert(hidden_found_count == 1);
}
static void test_insert_hiding_point ()
{
std::cout << "--- test_insert_hiding_point" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1));
Vertex_handle vh;
vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01));
assert(vh != Vertex_handle());
Weighted_point_3 hidden_point(Point_3(0.101, 0.101, 0.101), 0.001);
vh = p3rt3.insert(hidden_point);
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01));
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
unsigned hidden_found_count = 0;
hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
{
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
hidden_found_count += static_cast<unsigned>(std::find(iter->hidden_points_begin(), iter->hidden_points_end(), hidden_point) != iter->hidden_points_end());
}
assert(hidden_point_count == 1);
assert(hidden_found_count == 1);
}
static void test_insert_a_point_twice ()
{
std::cout << "--- test_insert_a_point_twice" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1));
Vertex_handle vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01));
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 1);
assert(p3rt3.number_of_stored_vertices() == 27);
Vertex_handle vh2 = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01));
assert(vh2 == vh);
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 1);
assert(p3rt3.number_of_stored_vertices() == 27);
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
}
static void test_insert_two_points_with_the_same_position ()
{
std::cout << "--- test_insert_two_points_with_the_same_position" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1));
Weighted_point_3 hidden_point(Point_3(0.1,0.1,0.1),0.01);
Vertex_handle vh = p3rt3.insert(hidden_point);
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 1);
assert(p3rt3.number_of_stored_vertices() == 27);
Vertex_handle vh2 = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.015));
assert(vh2 != Vertex_handle());
assert(vh2 != vh);
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 1);
assert(p3rt3.number_of_stored_vertices() == 27);
unsigned hidden_found_count = 0;
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
{
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
hidden_found_count += static_cast<unsigned>(std::find(iter->hidden_points_begin(), iter->hidden_points_end(), hidden_point) != iter->hidden_points_end());
}
assert(hidden_point_count == 1);
assert(hidden_found_count == 1);
}
static void test_remove ()
{
std::cout << "--- test_remove" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1));
Vertex_handle vh;
vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01));
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
Weighted_point_3 hidden_point(Point_3(0.101, 0.101, 0.101), 0.001);
Vertex_handle vhh = p3rt3.insert(hidden_point);
assert(vhh == Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
p3rt3.remove(vh);
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
unsigned point_found_count = 0;
for (Vertex_iterator iter = p3rt3.vertices_begin(), end_iter = p3rt3.vertices_end(); iter != end_iter; ++iter)
point_found_count += (iter->point() == hidden_point);
assert(point_found_count == 27);
}
static void test_insert_rnd_as_delaunay (unsigned pt_count, double weight)
{
std::cout << "--- test_insert_rnd_as_delaunay (" << pt_count << ',' << weight << ')' << std::endl;
CGAL::Random random(7);
typedef CGAL::Creator_uniform_3<double, Point_3> Creator;
CGAL::Random_points_in_cube_3<Point_3, Creator> in_cube(0.5, random);
Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
P3RT3 p3rt3(iso_cuboid);
for (unsigned cnt = 1; cnt <= pt_count; ++cnt)
{
Point_3 p(*in_cube++);
Weighted_point_3 wp(p, weight);
assert(iso_cuboid.has_on_bounded_side(p));
assert(weight < 0.015625);
p3rt3.insert(wp);
}
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == pt_count);
assert(p3rt3.number_of_sheets() == CGAL::make_array(3,3,3) ?
p3rt3.number_of_stored_vertices() == 27 * pt_count
: p3rt3.number_of_stored_vertices() == pt_count);
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
}
static void test_insert_from_file (const char* filename)
{
std::cout << "--- test_insert_from_file" << std::endl;
P3RT3 p3rt3(Iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5));
std::ifstream stream(filename);
assert(stream);
unsigned cnt = 1;
while (stream && !(stream.eof()))
{
Weighted_point_3 p = read_wpoint(stream);
std::cout << cnt << " : " << p << std::endl;
assert(p.weight() < 0.015625);
std::cout << "p3rt3.number_of_vertices() : " << p3rt3.number_of_vertices() << " .number_of_stored_vertices : " << p3rt3.number_of_stored_vertices() << std::endl;
p3rt3.insert(p);
std::cout << "p3rt3.number_of_vertices() : " << p3rt3.number_of_vertices() << " .number_of_stored_vertices : " << p3rt3.number_of_stored_vertices() << std::endl;
++cnt;
}
assert(p3rt3.is_valid());
}
static void test_insert_rt3_pointset ()
{
P3RT3 p3rt3(Iso_cuboid(Point_3(-100,-100,-100), Point_3(100,100,100)));
for (int a=0;a!=10;a++)
for (int b=0;b!=5;b++)
for (int d=0;d!=5;d++)
{
Weighted_point_3 p( Point_3(a*b-d*a + (a-b)*10 +a , a-b+d +5*b, a*a-d*d+b), a*b-a*d );
std::cout << p << std::endl;
p3rt3.insert(p);
}
assert(p3rt3.is_valid());
}
static void test_27_to_1_sheeted_covering ()
{
std::cout << "--- test_27_to_1_sheeted_covering" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0, 0, 0, 1, 1, 1));
unsigned count = 1;
for (unsigned i = 0; i < 6; ++i)
for (unsigned j = 0; j < 6; ++j)
for (unsigned k = 0; k < 8; ++k)
{
FT x = FT(i) / FT(6);
if (k % 2)
x += FT(1) / FT(12);
FT y = FT(j) / FT(6);
if (k % 2)
y += FT(1) / FT(12);
FT z = FT(k) / FT(8);
std::cout << count++ << " - " << i << " " << j << " " << k << std::endl;
Weighted_point_3 point(Point_3(x, y, z), 0);
p3rt3.insert(point);
if (CGAL::make_array(i,j,k) != CGAL::make_array<unsigned>(5,5,7))
{
assert(p3rt3.number_of_sheets() == CGAL::make_array(3,3,3));
}
}
assert(p3rt3.number_of_sheets() == CGAL::make_array(1,1,1));
assert(p3rt3.number_of_vertices() == 6*6*8);
assert(p3rt3.is_valid());
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
}
static void test_dummy_points ()
{
std::cout << "--- test_dummy_points" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0, 0, 0, 1, 1, 1));
std::vector<Vertex_handle> vertices;
vertices.reserve(p3rt3.number_of_vertices());
unsigned count = 1;
for (unsigned i = 0; i < 6; ++i)
for (unsigned j = 0; j < 6; ++j)
for (unsigned k = 0; k < 8; ++k)
{
FT x = FT(i) / FT(6);
if (k % 2)
x += FT(1) / FT(12);
FT y = FT(j) / FT(6);
if (k % 2)
y += FT(1) / FT(12);
FT z = FT(k) / FT(8);
std::cout << count++ << " - " << i << " " << j << " " << k << std::endl;
Weighted_point_3 point(Point_3(x, y, z), 0);
vertices.push_back(p3rt3.insert(point));
if (CGAL::make_array(i,j,k) != CGAL::make_array<unsigned>(5,5,7))
{
assert(p3rt3.number_of_sheets() == CGAL::make_array(3,3,3));
}
}
assert(p3rt3.number_of_sheets() == CGAL::make_array(1,1,1));
assert(p3rt3.number_of_vertices() == 6*6*8);
assert(p3rt3.is_valid());
P3RT3 p3rt3_b(Iso_cuboid(0, 0, 0, 1, 1, 1));
p3rt3_b.insert_dummy_points();
assert(p3rt3_b.number_of_sheets() == CGAL::make_array(1,1,1));
assert(p3rt3_b.number_of_vertices() == 6*6*8);
assert(p3rt3_b.is_valid());
assert(p3rt3 == p3rt3_b);
}
static void test_insert_range (unsigned pt_count, unsigned seed)
{
std::cout << "--- test_insert_range" << std::endl;
CGAL::Random random(seed);
typedef CGAL::Creator_uniform_3<double, Point_3> Creator;
CGAL::Random_points_in_cube_3<Point_3, Creator> in_cube(0.5, random);
Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
P3RT3 p3rt3(iso_cuboid);
std::vector<Weighted_point_3> points;
points.reserve(pt_count);
std::ifstream input_stream("data/p3rt3_point_set__s7_n800");
while (points.size() != pt_count)
{
// Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625));
Weighted_point_3 p;
input_stream >> p;
points.push_back(p);
}
std::cout << "--- done " << std::endl;
p3rt3.insert(points.begin(), points.end(), true);
for (Vertex_iterator iter = p3rt3.vertices_begin(), end_iter = p3rt3.vertices_end(); iter != end_iter; ++iter)
{
typename std::vector<Weighted_point_3>::iterator it = std::find(points.begin(), points.end(), iter->point());
assert(it != points.end());
}
unsigned hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
{
for (typename Cell::Point_iterator it = iter->hidden_points_begin(), end_it = iter->hidden_points_end(); it != end_it; ++it)
{
assert(std::find(points.begin(), points.end(), *it) != points.end());
++hidden_point_count;
}
}
assert(p3rt3.number_of_vertices() == 659);
assert(p3rt3.number_of_vertices() + hidden_point_count == 800);
assert(p3rt3.is_valid());
assert(p3rt3.number_of_sheets() == CGAL::make_array(1,1,1));
}
static void test_construction_and_insert_range (unsigned pt_count, unsigned seed)
{
std::cout << "--- test_construction_and_insert_range" << std::endl;
CGAL::Random random(seed);
typedef CGAL::Creator_uniform_3<double, Point_3> Creator;
CGAL::Random_points_in_cube_3<Point_3, Creator> in_cube(0.5, random);
Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
std::vector<Weighted_point_3> points;
points.reserve(pt_count);
while (points.size() != pt_count)
{
Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625));
points.push_back(p);
}
P3RT3 p3rt3(points.begin(), points.end(), iso_cuboid);
for (Vertex_iterator iter = p3rt3.vertices_begin(), end_iter = p3rt3.vertices_end(); iter != end_iter; ++iter)
{
typename std::vector<Weighted_point_3>::iterator it = std::find(points.begin(), points.end(), iter->point());
assert(it != points.end());
}
unsigned hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
{
for (typename Cell::Point_iterator it = iter->hidden_points_begin(), end_it = iter->hidden_points_end(); it != end_it; ++it)
{
assert(std::find(points.begin(), points.end(), *it) != points.end());
++hidden_point_count;
}
}
assert(p3rt3.number_of_vertices() == 659);
assert(p3rt3.number_of_vertices() + hidden_point_count == 800);
assert(p3rt3.is_valid());
assert(p3rt3.number_of_sheets() == CGAL::make_array(1,1,1));
}
static void test_locate_geometry ()
{
std::cout << "--- test_locate_geometry" << std::endl;
unsigned pt_count = 600;
CGAL::Random random(7);
typedef CGAL::Creator_uniform_3<double, Point_3> Creator;
CGAL::Random_points_in_cube_3<Point_3, Creator> in_cube(0.5, random);
Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
P3RT3 p3rt3(iso_cuboid);
std::vector<Weighted_point_3> points;
points.reserve(pt_count);
while (points.size() != pt_count)
{
Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625));
points.push_back(p);
}
p3rt3.insert(points.begin(), points.end(), true);
Point_3 point(-0.49, -0.49, -0.49);
Weighted_point_3 wpoint(point);
Offset lo;
Cell_handle ch = p3rt3.locate(wpoint, lo);
Periodic_tetrahedron p_tetra = p3rt3.periodic_tetrahedron(ch, lo);
Tetrahedron tetra = p3rt3.construct_tetrahedron(p_tetra);
assert(p3rt3.orientation(point, tetra[1], tetra[2], tetra[3]) == CGAL::POSITIVE);
assert(p3rt3.orientation(tetra[0], point, tetra[2], tetra[3]) == CGAL::POSITIVE);
assert(p3rt3.orientation(tetra[0], tetra[1], point, tetra[3]) == CGAL::POSITIVE);
assert(p3rt3.orientation(tetra[0], tetra[1], tetra[2], point) == CGAL::POSITIVE);
CGAL::Vector_3<K> v(tetra[0], tetra[1]);
v = v * 0.5;
point = tetra[0] + v;
wpoint = Weighted_point_3(point);
Locate_type lt;
int li, lj;
ch = p3rt3.locate(wpoint, lo, lt, li, lj);
assert(lt == P3RT3::EDGE);
Segment segment = p3rt3.construct_segment(p3rt3.periodic_segment(ch, lo, li, lj));
assert(CGAL::collinear(segment[0], segment[1], point));
v = CGAL::Vector_3<K>(point, tetra[2]);
v = v * 0.5;
point = point + v;
wpoint = Weighted_point_3(point);
ch = p3rt3.locate(wpoint, lo, lt, li, lj);
assert(lt == P3RT3::FACET);
Triangle triangle = p3rt3.construct_triangle(p3rt3.periodic_triangle(ch, lo, li));
assert(p3rt3.coplanar(triangle[0], triangle[1], triangle[2], point));
}
static void test_number_of_hidden_points ()
{
std::cout << "--- test_number_of_hidden_points" << std::endl;
P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1));
Vertex_handle vh;
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01));
assert(vh != Vertex_handle());
vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01));
assert(vh != Vertex_handle());
assert(p3rt3.is_valid());
assert(p3rt3.number_of_vertices() == 4);
assert(p3rt3.number_of_stored_vertices() == 108);
std::size_t hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 0);
assert(p3rt3.number_of_hidden_points() == 0);
vh = p3rt3.insert(Weighted_point_3(Point_3(0.101, 0.101, 0.101), 0.001));
assert(vh == Vertex_handle());
hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 1);
assert(p3rt3.number_of_hidden_points() == 1);
vh = p3rt3.insert(Weighted_point_3(Point_3(0.101, 0.101, 0.102), 0.001));
assert(vh == Vertex_handle());
hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 2);
assert(p3rt3.number_of_hidden_points() == 2);
vh = p3rt3.insert(Weighted_point_3(Point_3(0.101, 0.102, 0.101), 0.001));
assert(vh == Vertex_handle());
hidden_point_count = 0;
for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter)
hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end());
assert(hidden_point_count == 3);
assert(p3rt3.number_of_hidden_points() == 3);
}
static void test_find_conflicts ()
{
std::cout << "--- test_find_conflicts" << std::endl;
CGAL::Random random(7);
typedef CGAL::Creator_uniform_3<double, Point_3> Creator;
CGAL::Random_points_in_cube_3<Point_3, Creator> in_cube(0.5, random);
Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
P3RT3 p3rt3(iso_cuboid);
std::vector<Weighted_point_3> points;
points.reserve(800);
for(int i=0; i<800; ++i)
{
Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625));
points.push_back(p);
}
p3rt3.insert(points.begin(), points.end(), false);
std::vector<Facet> bd_facets;
std::vector<Cell_handle> conflict_cells;
std::vector<Facet> int_facets;
Point_3 bp(-0.5,-0.5,0.5);
Weighted_point_3 p(bp);
Cell_handle ch = p3rt3.locate(p);
p3rt3.find_conflicts(p, ch,
std::back_inserter(bd_facets),
std::back_inserter(conflict_cells),
std::back_inserter(int_facets));
for (unsigned int i = 0; i < bd_facets.size(); i++)
{
assert(
(p3rt3.side_of_power_sphere(bd_facets[i].first, p) == CGAL::ON_BOUNDED_SIDE)
^ (p3rt3.side_of_power_sphere(bd_facets[i].first->neighbor(bd_facets[i].second), p)
== CGAL::ON_BOUNDED_SIDE));
}
for (unsigned int i = 0; i < conflict_cells.size(); i++)
{
assert(p3rt3.side_of_power_sphere(conflict_cells[i], p) == CGAL::ON_BOUNDED_SIDE);
}
for (unsigned int i = 0; i < int_facets.size(); i++)
{
assert((p3rt3.side_of_power_sphere(int_facets[i].first, p) == CGAL::ON_BOUNDED_SIDE));
assert(
(p3rt3.side_of_power_sphere(int_facets[i].first->neighbor(int_facets[i].second), p)
== CGAL::ON_BOUNDED_SIDE));
}
}
static void test ()
{
test_find_conflicts();
test_insert_range(800, 7);
test_construction_and_insert_range(800, 7);
test_number_of_hidden_points();
test_locate_geometry();
test_dummy_points();
test_construction();
test_insert_1();
test_insert_point();
test_insert_hidden_point();
test_insert_hiding_point();
test_insert_a_point_twice();
test_insert_two_points_with_the_same_position();
test_remove();
test_27_to_1_sheeted_covering();
////// Iso_cuboid unitaire -> 0 <= weight < 0.015625
test_insert_rnd_as_delaunay(100, 0.);
test_insert_rnd_as_delaunay(100, 0.01);
}
};
int main (int, char**)
{
std::cout << "TESTING ..." << std::endl;
CGAL::force_ieee_double_precision();
std::cout << "Epeck ..." << std::endl;
Tests<CGAL::Epeck>::test();
std::cout << "Epick ..." << std::endl;
Tests<CGAL::Epick>::test();
std::cout << "EXIT SUCCESS" << std::endl;
return EXIT_SUCCESS;
}
@@ -0,0 +1,27 @@
// Copyright (c) 1998 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Date$
//
//
// Author(s) : Aymeric PELLE <aymeric.pelle@sophia.inria.fr>
#include "test_periodic_3_regular_triangulation_traits_3.h"
int main (int, char**)
{
test_periodic_3_regular_triangulation_traits_3();
}
@@ -0,0 +1,43 @@
// Copyright (c) 1998 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Date$
//
//
// Author(s) : Aymeric PELLE <aymeric.pelle@sophia.inria.fr>
#include <CGAL/Gmpz.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Lazy_exact_nt.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/_test_cls_periodic_3_regular_triangulation_traits_3.h>
#include <iostream>
void test_periodic_3_regular_triangulation_traits_3()
{
std::cout << "EPECK" << std::endl;
_test_cls_periodic_3_regular_triangulation_traits_3_rational<CGAL::Exact_predicates_exact_constructions_kernel>();
_test_cls_periodic_3_regular_triangulation_traits_3_irrational<CGAL::Exact_predicates_exact_constructions_kernel>();
std::cout << "EPICK" << std::endl;
_test_cls_periodic_3_regular_triangulation_traits_3_rational<CGAL::Exact_predicates_inexact_constructions_kernel>();
}
@@ -1,4 +1,4 @@
// Copyright (c) 1998 INRIA Sophia-Antipolis (France).
// Copyright (c) 1998, 2015 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -14,13 +14,13 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Francois Rebufat
// Manuel Caroli
// Aymeric Pelle
#include <iostream>
#include <cassert>
#include <CGAL/Timer.h>
@@ -30,21 +30,21 @@
#include <CGAL/Periodic_3_triangulation_traits_3.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K1;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K1> PDTT1;
typedef CGAL::Exact_predicates_inexact_constructions_kernel K1;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K1> PDTT1;
// Explicit instantiation of the whole class:
template class CGAL::Periodic_3_triangulation_3<PDTT1>;
template class CGAL::Periodic_3_Delaunay_triangulation_3<PDTT1>;
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel K2;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K2> PDTT2;
typedef CGAL::Exact_predicates_exact_constructions_kernel K2;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K2> PDTT2;
// Explicit instantiation of the whole class:
template class CGAL::Periodic_3_triangulation_3<PDTT2>;
template class CGAL::Periodic_3_Delaunay_triangulation_3<PDTT2>;
#include <CGAL/MP_Float.h>
#include <CGAL/Simple_homogeneous.h>
typedef CGAL::Simple_homogeneous<CGAL::MP_Float> K3;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K3> PDTT3;
typedef CGAL::Simple_homogeneous<CGAL::MP_Float> K3;
typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3<K3> PDTT3;
// Explicit instantiation of the whole class:
template class CGAL::Periodic_3_triangulation_3<PDTT3>;
@@ -55,24 +55,35 @@ template class CGAL::Periodic_3_triangulation_3<PDTT3>;
// thus we cannot construct non-trivial triangulations without using
// the insert from the periodic Delaunay triangulation.
int main()
int main(int, char**)
{
CGAL::Timer timer;
timer.start();
typedef CGAL::Periodic_3_triangulation_3<PDTT1> P3T3_1;
_test_periodic_3_triangulation_3_constructors( P3T3_1() );
typedef CGAL::Periodic_3_Delaunay_triangulation_3<PDTT1> P3DT3_1;
_test_cls_periodic_3_triangulation_3( P3DT3_1() );
typedef CGAL::Periodic_3_triangulation_3<PDTT2> P3T3_2;
_test_periodic_3_triangulation_3_constructors( P3T3_2() );
typedef CGAL::Periodic_3_Delaunay_triangulation_3<PDTT2> P3DT3_2;
_test_cls_periodic_3_triangulation_3( P3DT3_2(), true );
typedef CGAL::Periodic_3_Delaunay_triangulation_3<PDTT1> P3TD3_K1;
_test_periodic_3_triangulation_3_constructors( P3TD3_K1() );
_test_cls_periodic_3_triangulation_3(P3TD3_K1(),
PDTT1::Point(0.711476,-0.0713565,-0.52312),
"data/P3DT3_covering_test_HOM.tri",
"data/P3DT3_covering_test.tri");
typedef CGAL::Periodic_3_triangulation_3<PDTT3> P3T3_3;
_test_periodic_3_triangulation_3_constructors( P3T3_3() );
// typedef CGAL::Periodic_3_Delaunay_triangulation_3<PDTT3> P3DT3_3;
// _test_cls_periodic_3_triangulation_3( P3DT3_3(), false, true );
typedef CGAL::Periodic_3_Delaunay_triangulation_3<PDTT2> P3TD3_K2;
_test_periodic_3_triangulation_3_constructors( P3TD3_K2() );
_test_cls_periodic_3_triangulation_3(P3TD3_K2(),
PDTT2::Point(0.711476,-0.0713565,-0.52312),
"data/P3DT3_covering_test_HOM.tri",
"data/P3DT3_covering_test.tri",
true /*exact*/);
typedef CGAL::Periodic_3_Delaunay_triangulation_3<PDTT3> P3TD3_K3;
_test_periodic_3_triangulation_3_constructors( P3TD3_K3() );
_test_cls_periodic_3_triangulation_3(P3TD3_K3(),
PDTT3::Point(0.711476,-0.0713565,-0.52312),
"data/P3DT3_covering_test_HOM.tri",
"data/P3DT3_covering_test.tri",
false /*not exact*/,
true /*homogeneous*/,
false /*do not test input/output*/);
std::cerr << timer.time() << " sec." << std::endl;
return 0;
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
//
//
//
// Author(s) : Francois Rebufat
// Manuel Caroli
@@ -37,7 +37,7 @@ typedef CGAL::Triangulation_data_structure_3<
K,
CGAL::Periodic_3_triangulation_ds_vertex_base_3<> >,
CGAL::Triangulation_cell_base_3<
K,
K,
CGAL::Periodic_3_triangulation_ds_cell_base_3<> > > Tds;
// Explicit instantiation :
@@ -51,9 +51,9 @@ template class CGAL::Triangulation_data_structure_3<
CGAL::Triangulation_ds_cell_base_3<> >
>;
// just reusing the tests from the T3 package to check whether the
// just reusing the tests from the T3 package to check whether the
// periodic vertices and cells fulfill the requirements.
int main()
int main(int, char**)
{
CGAL::Timer timer;
timer.start();
@@ -13,9 +13,9 @@
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Id$
// $Date$
//
//
//
// Author(s) : Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
// Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
@@ -13,19 +13,19 @@
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Id$
// $Date$
//
//
//
// Author(s) : Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#define TEST_CARTESIAN 1
#define KERNEL CGAL::Cartesian< FT >
#define LAZY_KERNEL CGAL::Cartesian< LFT >
#define KERNEL CGAL::Cartesian< FT >
#define LAZY_KERNEL CGAL::Cartesian< LFT >
#include "test_periodic_3_triangulation_traits_3.h"
int main()
int main(int, char**)
{
test_periodic_3_triangulation_traits_3();
}
@@ -13,18 +13,18 @@
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Id$
// $Date$
//
//
//
// Author(s) : Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#define KERNEL CGAL::Homogeneous< FT >
#define LAZY_KERNEL CGAL::Homogeneous< LFT >
#define KERNEL CGAL::Homogeneous< FT >
#define LAZY_KERNEL CGAL::Homogeneous< LFT >
#include "test_periodic_3_triangulation_traits_3.h"
int main()
int main(int, char**)
{
test_periodic_3_triangulation_traits_3();
}
@@ -13,19 +13,19 @@
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Id$
// $Date$
//
//
//
// Author(s) : Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#define TEST_CARTESIAN 1
#define KERNEL CGAL::Simple_cartesian< FT >
#define LAZY_KERNEL CGAL::Simple_cartesian< LFT >
#define KERNEL CGAL::Simple_cartesian< FT >
#define LAZY_KERNEL CGAL::Simple_cartesian< LFT >
#include "test_periodic_3_triangulation_traits_3.h"
int main()
int main(int, char**)
{
test_periodic_3_triangulation_traits_3();
}
@@ -13,18 +13,18 @@
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Id$
// $Date$
//
//
//
// Author(s) : Manuel Caroli <Manuel.Caroli@sophia.inria.fr>
#define KERNEL CGAL::Simple_homogeneous< FT >
#define LAZY_KERNEL CGAL::Simple_homogeneous< LFT >
#define KERNEL CGAL::Simple_homogeneous< FT >
#define LAZY_KERNEL CGAL::Simple_homogeneous< LFT >
#include "test_periodic_3_triangulation_traits_3.h"
int main()
int main(int, char**)
{
test_periodic_3_triangulation_traits_3();
}
@@ -854,10 +854,8 @@ power_test(const Weighted_point &p0,
// We sort the points lexicographically.
const Weighted_point * points[4] = {&p0, &p1, &p2, &p};
std::sort(points, points + 4,
boost::bind(&Self::compare_xy, this,
boost::bind(Dereference<Weighted_point>(), _1),
boost::bind(Dereference<Weighted_point>(), _2)) == SMALLER);
std::sort(points, points + 4, typename Base::Perturbation_order(this));
// We successively look whether the leading monomial, then 2nd monomial
// of the determinant has non null coefficient.
@@ -31,13 +31,13 @@
namespace CGAL {
template < class R, class W = typename R::RT>
template < class K, class W = typename K::RT>
class Regular_triangulation_euclidean_traits_2
: public R
: public K
{
public:
Regular_triangulation_euclidean_traits_2() {}
Regular_triangulation_euclidean_traits_2(const R& k) : R(k) {}
Regular_triangulation_euclidean_traits_2(const K& k) : K(k) {}
};
} //namespace CGAL

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