merge packages related to projection traits into the trunk.

This commit is contained in:
Sébastien Loriot 2011-01-11 07:18:36 +00:00
parent af6f99ed1a
commit 3e04fb16fb
29 changed files with 472 additions and 84 deletions

2
.gitattributes vendored
View File

@ -1689,6 +1689,7 @@ Kernel_23/doc_tex/Kernel_23_ref/fig/transvectwo.gif -text svneol=unset#image/gif
Kernel_23/doc_tex/Kernel_23_ref/radical_line.tex -text
Kernel_23/examples/Kernel_23/cartesian_converter.cpp -text
Kernel_23/include/CGAL/functions_on_enums.h -text
Kernel_23/include/CGAL/internal/Projection_traits_3.h -text
Kernel_23/test/Kernel_23/CMakeLists.txt -text
Kernel_d/doc_tex/Kernel_d/hypercube.png -text
Kernel_d/doc_tex/Kernel_d_ref/Kernel_Compute_coordinate_d.tex -text
@ -3914,7 +3915,6 @@ Triangulation_2/doc_tex/Triangulation_2_ref/insert3.gif -text svneol=unset#image
Triangulation_2/doc_tex/Triangulation_2_ref/neighbors.gif -text svneol=unset#image/gif
Triangulation_2/doc_tex/Triangulation_2_ref/remove.gif -text svneol=unset#image/gif
Triangulation_2/doc_tex/Triangulation_2_ref/walk.gif -text svneol=unset#image/gif
Triangulation_2/include/CGAL/internal/Triangulation_euclidean_traits_projected_3.h -text
Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_proj.cpp -text
Triangulation_3/demo/Triangulation_3/CMakeLists.txt -text
Triangulation_3/demo/Triangulation_3/MainWindow.cpp -text

View File

@ -64,6 +64,7 @@ metric for regular triangulation.
The kernels supplied by \cgal\ are models of \ccRefName.
\ccRefConceptPage{Projection_traits_xy_3<K>}
\ccTypes

View File

@ -12,13 +12,12 @@ points lie. The class
is a second traits class based on \cgal\ primitives but differs from
\ccc{Convex_hull_traits_2} in that some of its primitives reuse
intermediate results to speed up computation.
In addition, there are three projective traits classes
(\ccc{Convex_hull_projective_xy_traits_2},
\ccc{Convex_hull_projective_xz_traits_2}, and
\ccc{Convex_hull_projective_yz_traits_2}), %
\ccIndexMainItem[C]{Convex_hull_projective_xy_traits_2}%
\ccIndexMainItem[C]{Convex_hull_projective_xz_traits_2}%
\ccIndexMainItem[C]{Convex_hull_projective_yz_traits_2}%
In addition, the 2D and 3D Linear Geometric Kernel provides three projective traits classes
(\ccc{Projection_traits_xy_3<K>},
\ccc{Projection_traits_zx_3<K}, and
\ccc{Projection_traits_yz_3<K}),
which may be used to compute the convex hull of a set of three-dimensional
points projected into each of the three coordinate planes.

View File

@ -105,10 +105,15 @@ object types must exist.
\ccHasModels
\ccRefIdfierPage{CGAL::Convex_hull_constructive_traits_2<R>} \\
\ccRefIdfierPage{CGAL::Convex_hull_traits_2<R>} \\
\ccRefIdfierPage{CGAL::Projection_traits_xy_3<K>}\\
\ccc{CGAL::Projection_traits_yz_3<K>}\\
\ccc{CGAL::Projection_traits_zx_3<K>}
\begin{ccDeprecated}
\ccRefIdfierPage{CGAL::Convex_hull_projective_xy_traits_2<Point_3>} \\
\ccRefIdfierPage{CGAL::Convex_hull_projective_xz_traits_2<Point_3>} \\
\ccRefIdfierPage{CGAL::Convex_hull_projective_yz_traits_2<Point_3>} \\
\ccRefIdfierPage{CGAL::Convex_hull_traits_2<R>} \\
\end{ccDeprecated}
\ccAutoIndexingOn
\ccSeeAlso

View File

@ -11,6 +11,14 @@
\ccAutoIndexingOn
\ccIndexTraitsClassBegin{Convex_hull_projective_xy_traits_2}{}{convex hull, 2D}
\begin{ccDeprecated}
The functionality of this class has been generalized to other packages than 2D convex hulls.
The more general class \ccc{Projection_traits_xy_3} can be found in the 2D and 3D Linear Geometric Kernel.
Note that the deprecated class was templated by a point class, whereas the new class
is templated by a geometric kernel.
\end{ccDeprecated}
\ccDefinition
The class \ccRefName\ serves as a traits class for all the two-dimensional

View File

@ -11,6 +11,14 @@
\ccAutoIndexingOn
\ccIndexTraitsClassBegin{Convex_hull_projective_xz_traits_2}{}{convex hull, 2D}
\begin{ccDeprecated}
The functionality of this class has been generalized to other packages than 2D convex hulls.
The more general class \ccc{Projection_traits_xy_3} can be found in the 2D and 3D Linear Geometric Kernel.
Note that the deprecated class was templated by a point class, whereas the new class
is templated by a geometric kernel.
\end{ccDeprecated}
\ccDefinition
The class \ccRefName\ serves as a traits class for all the two-dimensional

View File

@ -11,6 +11,14 @@
\ccAutoIndexingOn
\ccIndexTraitsClassBegin{Convex_hull_projective_yz_traits_2}{}{convex hull, 2D}
\begin{ccDeprecated}
The functionality of this class has been generalized to other packages than 2D convex hulls.
The more general class \ccc{Projection_traits_xy_3} can be found in the 2D and 3D Linear Geometric Kernel.
Note that the deprecated class was templated by a point class, whereas the new class
is templated by a geometric kernel.
\end{ccDeprecated}
\ccDefinition
The class \ccRefName\ serves as a traits class for all the two-dimensional

View File

@ -19,6 +19,7 @@
\ccRefIdfierPage{CGAL::quotient_cartesian_to_homogeneous} \\
\ccRefIdfierPage{CGAL::Simple_cartesian<FieldNumberType>} \\
\ccRefIdfierPage{CGAL::Simple_homogeneous<RingNumberType>} \\
\ccRefIdfierPage{CGAL::Projection_traits_xy_3<K>}
\subsubsection*{Predefined Kernels}

View File

@ -13,5 +13,6 @@
\input{Kernel_23/kernel_geometry}
\input{Kernel_23/predicates_constructions}
\input{Kernel_23/extensible_kernel}
\input{Kernel_23/projection_traits}
\input{Kernel_23/history}

View File

@ -0,0 +1,12 @@
\section{Projection Traits Classes \label{section-projection-traits}}
It is sometimes useful to apply 2D algorithms to the projection of 3D points on
a plane. Examples are
triangulated terrains, which are points with elevation, or surface
reconstruction from parallel slices, where one wants to check the simplicity
or orientation of polygons.
For this purpose \cgal\ provides several projection traits classes,
which are a model of traits class concepts of 2D triangulations,
2D polygon and 2D convex hull traits classes. The projection traits classes
are listed in the ``{\em Is Model for the Concepts}'' sections of the concepts.

View File

@ -0,0 +1,101 @@
\begin{ccRefClass}{Projection_traits_xy_3<K>} %% add template arg's if necessary
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
%% \ccHtmlIndexC[class]{} %% add further index entries
\ccCreationVariable{traits}
\ccDefinition
The class \ccRefName\ is an adapter to apply 2D algorithms to the projections of 3D data on the \ccc{xy}-plane.
\cgal\ provides also predefined geometric traits classes
\ccc{Projection_traits_yz_3<K>} and
\ccc{Projection_traits_zx_3<K>} to
deal with projections on the
\ccc{zx}- and the \ccc{yz}-plane,
respectively. It is the \ccc{zx}-plane and not the \ccc{xz}-plane
in order that the third unit vector is on the positive halfspace
defined by the plane.
\ccParameters
The template parameter \ccc{K} has to
be instantiated by a model of the \ccc{Kernel} concept.
\ccRefName\ uses types
and predicates defined in \ccc{K}.
\ccInclude{CGAL/Projection_traits_xy_3.h}
\ccIsModel
The class is a model of several 2D triangulation traits class concepts,
except that it does not provide the type and constructors
required to build the dual Voronoi diagram. The class is also a model
of the concepts \ccc{PolygonTraits_2} and \ccc{ConvexHullTraits_2}.
\ccRefConceptPage{TriangulationTraits_2} \\
\ccRefConceptPage{DelaunayTriangulationTraits_2} \\
\ccRefConceptPage{ConstrainedTriangulationTraits_2} \\
\ccRefConceptPage{PolygonTraits_2} \\
\ccRefConceptPage{ConvexHullTraits_2}
\ccTypes
\ccTwo{typedef Triangle_3<K>}{}
\ccTypedef{typedef Point_3<K> Point_2;}{}
\ccGlue
\ccTypedef{typedef Segment_3<K> Segment_2;}{}
\ccGlue
\ccTypedef{typedef Triangle_3<K> Triangle_2;}{}
\ccGlue
\ccTypedef{typedef Line_3<K> Line_2;}{}
\ccTypedef{typedef K::Object_3 Object_2;}{}
The functors provided by this class are those listed in the concepts,
except that it does not provide the type and constructors
required to build the dual Voronoi diagram.
The functors operate on the 2D projection of their arguments. They come with preconditions that projections of the arguments are non-degenerate, eg. a line segment does not project on a single point, two points do not project on the same point, etc.
In the following, we specify the choice of the \ccc{z}-coordinate
in case a new point is constructed.
\ccNestedType{Intersect_2}{A construction object.
Provides the operator~:\\
\ccHtmlNoLinksFrom{\ccc{Object_2 operator()(Segment_2 s1, Segment_2 s2);}}
which returns a 3D object whose projection on the xy-plane
is the intersection of the projections of \ccc{s1} and \ccc{s2}.
If non empty, the returned object is either a segment or a point.
Its embedding in 3D is computed as the interpolation
between \ccc{s1} and \ccc{s2},
meaning that any point \ccc{p} of the returned object
is the midpoint of segment \ccc{p1p2} where \ccc{p1} and \ccc{p2} are the two points of \ccc{s1} and \ccc{s2} respectively, both projecting on \ccc{p}.
\ccPrecond{The projection of \ccc{s1} and the projection of \ccc{s2} are non-degenerate
\ccc{2D} segments.}
}
\ccCreation
\ccCreationVariable{traits}
\ccThree{Projection_traits_xy_3()}{traits=tr }{}
\ccConstructor{Projection_traits_xy_3();}{
default constructor.}
\ccGlue
\ccConstructor{Projection_traits_xy_3(
Projection_traits_xy_3 tr);}
{Copy constructor.}
\ccMethod{Projection_traits_xy_3 operator=
(Projection_traits_xy_3 tr);}
{Assignment operator.}
\end{ccRefClass}
% +------------------------------------------------------------------------+
%%RefPage: end of main body, begin of footer
% EOF
% +------------------------------------------------------------------------+

View File

@ -43,6 +43,7 @@ in the kernel.
\input{Kernel_23_ref/Kernel_traits.tex}
\input{Kernel_23_ref/Simple_cartesian.tex}
\input{Kernel_23_ref/Simple_homogeneous.tex}
\input{Kernel_23_ref/Projection_traits_xy_3.tex}
\clearpage
\section{Predefined Kernels}

View File

@ -0,0 +1,34 @@
// Copyright (c) 1997-2010 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// 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) : Mariette Yvinec
#ifndef CGAL_PROJECTION_TRAITS_XY_3_H
#define CGAL_PROJECTION_TRAITS_XY_3_H
#include <CGAL/internal/Projection_traits_3.h>
namespace CGAL {
template < class R >
class Projection_traits_xy_3
: public internal::Projection_traits_3<R,2>
{};
} //namespace CGAL
#endif // CGAL_PROJECTION_TRAITS_XY_3_H

View File

@ -0,0 +1,34 @@
// Copyright (c) 1997-2010 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// 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) : Mariette Yvinec
#ifndef CGAL_PROJECTION_TRAITS_YZ_3_H
#define CGAL_PROJECTION_TRAITS_YZ_3_H
#include <CGAL/internal/Projection_traits_3.h>
namespace CGAL {
template < class R >
class Projection_traits_yz_3
: public internal::Projection_traits_3<R,0>
{};
} //namespace CGAL
#endif // CGAL_PROJECTION_TRAITS_YZ_3_H

View File

@ -0,0 +1,34 @@
// Copyright (c) 1997-2010 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// 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) : Mariette Yvinec
#ifndef CGAL_PROJECTION_TRAITS_XZ_3_H
#define CGAL_PROJECTION_TRAITS_XZ_3_H
#include <CGAL/internal/Projection_traits_3.h>
namespace CGAL {
template < class R >
class Projection_traits_xz_3
: public internal::Projection_traits_3<R,1>
{};
} //namespace CGAL
#endif // CGAL_PROJECTION_TRAITS_XZ_3_H

View File

@ -17,15 +17,14 @@
//
// Author(s) : Mariette Yvinec, Sebastien Loriot
#ifndef CGAL_INTERNAL_TRIANGULATION_EUCLIDEAN_TRAITS_PROJECTED_3_H
#define CGAL_INTERNAL_TRIANGULATION_EUCLIDEAN_TRAITS_PROJECTED_3_H
#ifndef CGAL_INTERNAL_PROJECTION_TRAITS_3_H
#define CGAL_INTERNAL_PROJECTION_TRAITS_3_H
#include <CGAL/triangulation_assertions.h>
#include <CGAL/Point_3.h>
#include <CGAL/Segment_3.h>
#include <CGAL/Triangle_3.h>
#include <CGAL/predicates/kernel_ftC2.h>
namespace CGAL {
@ -51,21 +50,22 @@ struct Projector<R,0>
static const int x_index=1;
static const int y_index=2;
};
//project onto xz
//project onto zx
template <class R>
struct Projector<R,1>
{
typedef typename R::Less_x_3 Less_x_2;
typedef typename R::Less_z_3 Less_y_2;
typedef typename R::Compare_x_3 Compare_x_2;
typedef typename R::Compare_z_3 Compare_y_2;
typedef typename R::Equal_x_3 Equal_x_2;
typedef typename R::Equal_z_3 Equal_y_2;
static typename R::FT x(const typename R::Point_3& p) {return p.x();}
static typename R::FT y(const typename R::Point_3& p) {return p.z();}
static const int x_index=0;
static const int y_index=2;
typedef typename R::Less_z_3 Less_x_2;
typedef typename R::Less_x_3 Less_y_2;
typedef typename R::Compare_z_3 Compare_x_2;
typedef typename R::Compare_x_3 Compare_y_2;
typedef typename R::Equal_z_3 Equal_x_2;
typedef typename R::Equal_x_3 Equal_y_2;
static typename R::FT x(const typename R::Point_3& p) {return p.z();}
static typename R::FT y(const typename R::Point_3& p) {return p.x();}
static const int x_index=2;
static const int y_index=0;
};
//project onto xy
template <class R>
struct Projector<R,2>
@ -90,11 +90,16 @@ public:
typename R::FT x(const Point &p) const { return Projector<R,dim>::x(p); }
typename R::FT y(const Point &p) const { return Projector<R,dim>::y(p); }
typename R::Point_2 project(const Point& p) const
{
return typename R::Point_2(x(p),y(p));
}
CGAL::Orientation operator()(const Point& p,
const Point& q,
const Point& r) const
{
return orientationC2(x(p), y(p), x(q), y(q), x(r), y(r));
return CGAL::orientation(project(p), project(q), project(r));
}
};
@ -106,15 +111,39 @@ public:
typename R::FT x(const Point &p) const { return Projector<R,dim>::x(p); }
typename R::FT y(const Point &p) const { return Projector<R,dim>::y(p); }
typename R::Point_2 project(const Point& p) const
{
return typename R::Point_2(x(p),y(p));
}
CGAL::Oriented_side operator() (const Point &p,
const Point &q,
const Point &r,
const Point &s) const
{
return side_of_oriented_circleC2(x(p), y(p),
x(q), y(q),
x(r), y(r),
x(s), y(s));
return CGAL::side_of_oriented_circle(project(p),project(q),project(r),project(s) );
}
};
template <class R,int dim>
class Side_of_bounded_circle_projected_3
{
public:
typedef typename R::Point_3 Point;
typename R::FT x(const Point &p) const { return Projector<R,dim>::x(p); }
typename R::FT y(const Point &p) const { return Projector<R,dim>::y(p); }
typename R::Point_2 project(const Point& p) const
{
return typename R::Point_2(x(p),y(p));
}
CGAL::Bounded_side operator() (const Point &p,
const Point &q,
const Point &r,
const Point &s) const
{
return CGAL::side_of_bounded_circle(project(p),project(q),project(r),project(s) );
}
};
@ -205,7 +234,18 @@ public:
const Segment_2* si=CGAL::object_cast<Segment_2>(&o);
if (si==NULL) return Object();
FT src[3],tgt[3];
tgt[dim] = src[dim] = FT(0); //the third coordinate is arbitrarily set to 0 (not used in Constrained DT)
tgt[dim] = src[dim] = FT(0); //the third coordinate is the midpoint between the points on s1 and s2
FT z1 = s1.source()[dim] + ( si->source().x()-s1_source.x() ) / (s1_target.x() - s1_source.x()) * ( s1.target()[dim] - s1.source()[dim] );
FT z2 = s2.source()[dim] + ( si->source().x()-s2_source.x() ) / (s2_target.x() - s2_source.x()) * ( s2.target()[dim] - s2.source()[dim] );
src[dim] = (z1+z2) / FT(2);
z1 = s1.source()[dim] + ( si->target().x()-s1_source.x() ) / (s1_target.x() - s1_source.x()) * ( s1.target()[dim] - s1.source()[dim] );
z2 = s2.source()[dim] + ( si->target().x()-s2_source.x() ) / (s2_target.x() - s2_source.x()) * ( s2.target()[dim] - s2.source()[dim] );
tgt[dim] = (z1+z2) / FT(2);
src[Projector<R,dim>::x_index] = si->source().x();
src[Projector<R,dim>::y_index] = si->source().y();
tgt[Projector<R,dim>::x_index] = si->target().x();
@ -216,6 +256,7 @@ public:
//compute the third coordinate of the projected intersection point onto 3D segments
FT z1 = s1.source()[dim] + ( pi->x()-s1_source.x() ) / (s1_target.x() - s1_source.x()) * ( s1.target()[dim] - s1.source()[dim] );
FT z2 = s2.source()[dim] + ( pi->x()-s2_source.x() ) / (s2_target.x() - s2_source.x()) * ( s2.target()[dim] - s2.source()[dim] );
coords[dim] = (z1+z2) / FT(2);
coords[Projector<R,dim>::x_index] = pi->x();
coords[Projector<R,dim>::y_index] = pi->y();
@ -284,9 +325,9 @@ public:
};
template < class R, int dim >
class Triangulation_euclidean_traits_projected_3 {
class Projection_traits_3 {
public:
typedef Triangulation_euclidean_traits_projected_3<R,dim> Traits;
typedef Projection_traits_3<R,dim> Traits;
typedef R Rp;
typedef typename R::FT FT;
typedef typename Rp::Point_3 Point_2;
@ -300,12 +341,39 @@ public:
typedef typename Projector<R,dim>::Compare_y_2 Compare_y_2;
typedef Orientation_projected_3<Rp,dim> Orientation_2;
typedef Side_of_oriented_circle_projected_3<Rp,dim> Side_of_oriented_circle_2;
typedef Side_of_bounded_circle_projected_3<Rp,dim> Side_of_bounded_circle_2;
typedef Compare_distance_projected_3<Rp,dim> Compare_distance_2;
typedef Squared_distance_projected_3<Rp,dim> Compute_squared_distance_2;
typedef Intersect_projected_3<Rp,dim> Intersect_2;
typedef typename Rp::Construct_segment_3 Construct_segment_2;
typedef typename Rp::Construct_triangle_3 Construct_triangle_2;
typedef typename Rp::Construct_line_3 Construct_line_2;
typedef typename Rp::Compute_squared_radius_3 Compute_squared_radius_2;
struct Less_xy_2 {
bool operator()(const Point_2& p, const Point_2& q) const
{
Compare_x_2 cx;
Comparison_result crx = cx(p,q);
if(crx == SMALLER){ return true;}
if(crx == LARGER){return false;}
Less_y_2 ly;
return ly(p,q);
}
};
struct Less_yx_2 {
bool operator()(const Point_2& p, const Point_2& q) const
{
Compare_y_2 cy;
Comparison_result cry = cy(p,q);
if(cry == SMALLER){ return true;}
if(cry == LARGER){return false;}
Less_x_2 lx;
return lx(p,q);
}
};
//for natural_neighbor_coordinates_2
typedef typename Projector<R,dim>::Equal_x_2 Equal_x_2;
@ -320,11 +388,11 @@ public:
typedef Segment_2 Segment;
typedef Triangle_2 Triangle;
Triangulation_euclidean_traits_projected_3(){}
Triangulation_euclidean_traits_projected_3(
const Triangulation_euclidean_traits_projected_3&){}
Triangulation_euclidean_traits_projected_3 &operator=(
const Triangulation_euclidean_traits_projected_3&){return *this;}
Projection_traits_3(){}
Projection_traits_3(
const Projection_traits_3&){}
Projection_traits_3 &operator=(
const Projection_traits_3&){return *this;}
typename Rp::FT x(const Point_2 &p) const { return Projector<R,dim>::x(p); }
typename Rp::FT y(const Point_2 &p) const { return Projector<R,dim>::y(p); }
@ -334,10 +402,13 @@ public:
less_x_2_object() const
{ return Less_x_2();}
Less_xy_2
less_xy_2_object() const
{ return Less_xy_2();}
Less_y_2
less_y_2_object() const
{ return Less_y_2();}
Compare_x_2
compare_x_2_object() const
{ return Compare_x_2();}
@ -354,6 +425,10 @@ public:
side_of_oriented_circle_2_object() const
{return Side_of_oriented_circle_2();}
Side_of_bounded_circle_2
side_of_bounded_circle_2_object() const
{return Side_of_bounded_circle_2();}
Compare_distance_2
compare_distance_2_object() const
{
@ -366,6 +441,12 @@ public:
return Compute_squared_distance_2();
}
Compute_squared_radius_2
compute_squared_radius_2_object () const
{
return Compute_squared_radius_2();
}
Intersect_2
intersect_2_object () const
{
@ -386,4 +467,4 @@ public:
} } //namespace CGAL::internal
#endif // CGAL_INTERNAL_TRIANGULATION_EUCLIDEAN_TRAITS_PROJECTED_3_H
#endif // CGAL_INTERNAL_PROJECTION_TRAITS_3_H

View File

@ -30,9 +30,11 @@ points, but little more. Especially, computed values are not cached.
That is, when the \ccc{is_simple()} member function is called twice or more,
the result is computed each time anew.
\section{Example}
\section{Examples}
The following code fragment creates a polygon and does some checks.
\subsection{The Polygon Class}
The following example creates a polygon and illustrates the usage of some member functions.
\ccIncludeExampleCode{Polygon/Polygon.cpp}
@ -51,4 +53,23 @@ The following code fragment creates a polygon and does some checks.
\label{I1_Fig_a_polygon}}
\end{figure}
\subsection{Algorithms Operating on Sequences of Points}
The following example creates a polygon and illustrates the usage of some
global functions that operate on sequences of points.
\ccIncludeExampleCode{Polygon/polygon_algorithms.cpp}
\subsection{Polygons in 3D Space}
Sometimes it is useful to run a 2D algorithm on 3D data.
Polygons may be contours of a 3D object, where the contours
are organized in parallel slices, generated by segmentation
of image data from a scanner.
In order to avoid an explixit projection on the \ccc{xy}
plane, one can use the traits class \ccc{Projection_traits_xy_3<K>}
which is part of the 2D and 3D Linear Geometric Kernel,
\ccIncludeExampleCode{Polygon/projected_polygon.cpp}

View File

@ -71,9 +71,10 @@ types must exist.
\ccHasModels
The kernels supplied by \cgal\ are models of \ccRefName.
\ccRefConceptPage{Projection_traits_xy_3<K>}
The kernels supplied by \cgal\ are models of \ccRefName. \\
\ccRefConceptPage{CGAL::Projection_traits_xy_3<K>}\\
\ccc{CGAL::Projection_traits_yz_3<K>}\\
\ccc{CGAL::Projection_traits_zx_3<K>}
\ccSeeAlso

View File

@ -0,0 +1,15 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Projection_traits_yz_3.h>
#include <CGAL/Polygon_2_algorithms.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point_3;
int main()
{
Point_3 points[4] = { Point_3(0,1,1), Point_3(0,2,1), Point_3(0,2,2), Point_3(0,1,2) };
bool b = CGAL::is_simple_2(points,
points+4,
CGAL::Projection_traits_yz_3<K>());
return 0;
}

View File

@ -662,6 +662,10 @@ terrain model. The points have elevation, that is they are 3D points,
but the predicates used to build the Delaunay triangulation
are computed using only the $x$ and $y$ coordinates
of these points.
The class \ccc{Projection_traits_xy_3<K>} is part of the 2D and 3D Linear Geometric Kernel,
and replaces the class \ccc{Triangulation_euclidean_traits_xy_3<K>} which is deprecated.
\ccIncludeExampleCode{Triangulation_2/terrain.cpp}
\subsection{Example: Voronoi Diagram\label{Subsection_2D_Triangulations_Voronoi}}

View File

@ -78,9 +78,14 @@ the intersection tag is \ccc{Exact_predicates_tag}.}
\ccHasModels
The kernels of \cgal\ are models for this traits class.\\
\ccc{Triangulation_euclidean_traits_xy<K>}\\
\ccc{Triangulation_euclidean_traits_yz<K>}\\
\ccc{Triangulation_euclidean_traits_xz<K>}
\ccRefIdfierPage{CGAL::Projection_traits_xy_3<K>}\\
\ccc{CGAL::Projection_traits_yz_3<K>}\\
\ccc{CGAL::Projection_traits_zx_3<K>}
\begin{ccDeprecated}
\ccRefIdfierPage{CGAL::Triangulation_euclidean_traits_xy_3<K>}, \\
\ccc{CGAL::Triangulation_euclidean_traits_yz_3<K>}, \\
\ccc{CGAL::Triangulation_euclidean_traits_zx_3<K>}.
\end{ccDeprecated}
\ccSeeAlso

View File

@ -128,11 +128,16 @@ compare_distance_2_object();} {}
\cgal\ kernels\\
\ccc{CGAL::Triangulation_euclidean_traits_2<Rep>}.
The following traits class provide everything except types and member
functions required for the dual Voronoi diagram~;\\
\ccc{CGAL::Triangulation_euclidean_traits_xy_3<Rep>}, \\
\ccc{CGAL::Triangulation_euclidean_traits_yz_3<Rep>}, \\
\ccc{CGAL::Triangulation_euclidean_traits_zx_3<Rep>}.
The following traits classes provide everything except types and member
functions required for the dual Voronoi diagram:\\
\ccRefIdfierPage{CGAL::Projection_traits_xy_3<K>}\\
\ccc{CGAL::Projection_traits_yz_3<K>}\\
\ccc{CGAL::Projection_traits_zx_3<K>}
\begin{ccDeprecated}
\ccRefIdfierPage{CGAL::Triangulation_euclidean_traits_xy_3<K>}, \\
\ccc{CGAL::Triangulation_euclidean_traits_yz_3<K>}, \\
\ccc{CGAL::Triangulation_euclidean_traits_zx_3<K>}.
\end{ccDeprecated}
\ccSeeAlso
\ccc{TriangulationTraits_2}

View File

@ -142,10 +142,15 @@ called.}
\ccHasModels
All the CGAL Kernels \\
\ccc{CGAL::Triangulation_euclidean_traits_2<K>} \\
\ccc{CGAL::Triangulation_euclidean_traits_xy_3<K>} \\
\ccc{CGAL::Triangulation_euclidean_traits_yz_3<K>} \\
\ccc{CGAL::Triangulation_euclidean_traits_zx_3<K>} \\
\ccRefIdfierPage{CGAL::Triangulation_euclidean_traits_2<K>} \\
\ccRefIdfierPage{CGAL::Projection_traits_xy_3<K>}\\
\ccc{CGAL::Projection_traits_yz_3<K>}\\
\ccc{CGAL::Projection_traits_zx_3<K>}
\begin{ccDeprecated}
\ccRefIdfierPage{CGAL::Triangulation_euclidean_traits_xy_3<K>}, \\
\ccc{CGAL::Triangulation_euclidean_traits_yz_3<K>}, \\
\ccc{CGAL::Triangulation_euclidean_traits_zx_3<K>}.
\end{ccDeprecated}
\ccSeeAlso
\ccc{CGAL::Triangulation_2<Traits,Tds>}

View File

@ -13,6 +13,11 @@
\begin{ccRefClass}{Triangulation_euclidean_traits_xy_3<K>} %% add template arg's if necessary
\begin{ccDeprecated}
The functionality of this class has been generalized to other packages than 2D triangulations.
The more general class \ccc{Projection_traits_xy_3} can be found in the 2D and 3D Linear Geometric Kernel.
\end{ccDeprecated}
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
%% \ccHtmlIndexC[class]{} %% add further index entries
\ccCreationVariable{traits}

View File

@ -1,12 +1,12 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_euclidean_traits_xy_3.h>
#include <CGAL/Projection_traits_xy_3.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_euclidean_traits_xy_3<K> Gt;
typedef CGAL::Projection_traits_xy_3<K> Gt;
typedef CGAL::Delaunay_triangulation_2<Gt> Delaunay;
typedef K::Point_3 Point;

View File

@ -20,13 +20,13 @@
#ifndef CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XY_3_H
#define CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XY_3_H
#include <CGAL/internal/Triangulation_euclidean_traits_projected_3.h>
#include <CGAL/internal/Projection_traits_3.h>
namespace CGAL {
template < class R >
class Triangulation_euclidean_traits_xy_3
: public internal::Triangulation_euclidean_traits_projected_3<R,2>
: public internal::Projection_traits_3<R,2>
{};
} //namespace CGAL

View File

@ -20,13 +20,12 @@
#ifndef CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XZ_3_H
#define CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_XZ_3_H
#include <CGAL/internal/Triangulation_euclidean_traits_projected_3.h>
#include <CGAL/internal/Projection_traits_3.h>
namespace CGAL {
template < class R >
class Triangulation_euclidean_traits_xz_3
: public internal::Triangulation_euclidean_traits_projected_3<R,1>
: public internal::Projection_traits_3<R,1>
{};
} //namespace CGAL

View File

@ -20,13 +20,13 @@
#ifndef CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_YZ_3_H
#define CGAL_TRIANGULATION_EUCLIDEAN_TRAITS_YZ_3_H
#include <CGAL/internal/Triangulation_euclidean_traits_projected_3.h>
#include <CGAL/internal/Projection_traits_3.h>
namespace CGAL {
template < class R >
class Triangulation_euclidean_traits_yz_3
: public internal::Triangulation_euclidean_traits_projected_3<R,0>
: public internal::Projection_traits_3<R,0>
{};
} //namespace CGAL

View File

@ -163,16 +163,16 @@ main()
typedef CGAL::Triangulation_euclidean_traits_xz_3<Test_rep_cartesian> Cls7;
typedef Cls7::Point_2 Pt7;
Pt7 p7[34] = {
Pt7(1,1,3), Pt7(3,3,5), Pt7(3,6,8),
Pt7(1,4,3), Pt7(3,8,5), Pt7(7,8,5),
Pt7(4,5,4), Pt7(4,1,4), Pt7(2,4,6),
Pt7(1,2,1), Pt7(2,6,2), Pt7(1,2,3),
Pt7(1,4,1), Pt7(2,3,3), Pt7(5,5,0),
Pt7(6,7,0), Pt7(0,2,6), Pt7(3,8,3),
Pt7(91,3,312), Pt7(125,3,300), Pt7(204,3,253), Pt7(324,42,0),
Pt7(91,3,312), Pt7(125,3,300), Pt7(204,3,253), Pt7(326,42,0),
Pt7(91,3,312), Pt7(125,3,300), Pt7(204,3,253), Pt7(325,42,0),
Pt7(91,3,312), Pt7(125,3,300), Pt7(204,3,253), Pt7(0,23,0)
Pt7(3,5,1),Pt7(5,4,3),Pt7(8,1,3),
Pt7(3,6,1),Pt7(5,3,3),Pt7(5,7,7),
Pt7(4,9,4),Pt7(4,4,4),Pt7(6,5,2),
Pt7(1,3,1),Pt7(2,7,2),Pt7(3,2,1),
Pt7(1,4,1),Pt7(3,2,2),Pt7(0,3,5),
Pt7(0,6,6),Pt7(6,1,0),Pt7(3,4,3),
Pt7(312,5,91),Pt7(300,5,125),Pt7(253,5,204),Pt7(0,5,324),
Pt7(312,5,91),Pt7(300,5,125),Pt7(253,5,204),Pt7(0,5,326),
Pt7(312,5,91),Pt7(300,5,125),Pt7(253,5,204),Pt7(0,5,325),
Pt7(312,5,91),Pt7(300,5,125),Pt7(253,5,204),Pt7(0,5,0)
};
_test_cls_geom_traits( p7, Cls7() );
@ -180,16 +180,16 @@ main()
typedef CGAL::Triangulation_euclidean_traits_xz_3<Test_rep_homogeneous> Cls8;
typedef Cls8::Point_2 Pt8;
Pt8 p8[34] = {
Pt8(1,7,3,1), Pt8(6,7,10,2), Pt8(3,7,8,1),
Pt8(1,7,3,1), Pt8(3,7,5,1), Pt8(14,7,10,2),
Pt8(4,7,4,1), Pt8(12,7,12,3), Pt8(2,7,6,1),
Pt8(1,7,1,1), Pt8(2,7,2,1), Pt8(1,7,3,1),
Pt8(1,7,1,1), Pt8(2,7,3,1), Pt8(5,7,0,1),
Pt8(6,7,0,1), Pt8(0,7,6,1), Pt8(6,7,6,2),
Pt8(91,653,312,325), Pt8(125,632,300,325), Pt8(204,632,253,325), Pt8(324,632,0,325),
Pt8(91,632,312,325), Pt8(125,632,300,325), Pt8(204,632,253,325), Pt8(326,632,0,325),
Pt8(91,632,312,325), Pt8(125,632,300,325), Pt8(204,632,253,325), Pt8(1,632,0,1),
Pt8(91,632,312,325), Pt8(125,632,300,325), Pt8(204,632,253,325), Pt8(0,632,0,43)
Pt8(3,6,1,1),Pt8(10,6,6,2),Pt8(8,6,3,1),
Pt8(3,6,1,1),Pt8(5,6,3,1),Pt8(10,6,14,2),
Pt8(4,6,4,1),Pt8(8,6,8,2),Pt8(6,6,2,1),
Pt8(1,6,1,1),Pt8(2,6,2,1),Pt8(3,6,1,1),
Pt8(1,6,1,1),Pt8(3,6,2,1),Pt8(0,6,5,1),
Pt8(0,6,6,1),Pt8(6,6,0,1),Pt8(6,6,6,2),
Pt8(312,234,91,325),Pt8(300,534,125,325),Pt8(253,241,204,325),Pt8(0,214,324,325),
Pt8(312,21,91,325),Pt8(300,534,125,325),Pt8(253,52,204,325),Pt8(0,421,326,325),
Pt8(312,42,91,325),Pt8(300,42,125,325),Pt8(253,542,204,325),Pt8(0,441,1,1),
Pt8(312,534,91,325),Pt8(300,21,125,325),Pt8(253,123,204,325),Pt8(423,0,0,43)
};
_test_cls_geom_traits( p8, Cls8() );