linking unlinking

This commit is contained in:
Andreas Fabri 2012-10-30 13:04:40 +00:00
parent ad0fc8e1cf
commit bc1524f6ab
20 changed files with 128 additions and 128 deletions

View File

@ -24,6 +24,9 @@ actions. If a particular feature is not supported nothing is done.
Note that for example the creation of new halfedges is mandatory for
all halfedge data structures and will not appear here again.
\tparam HDS must be a model of `HalfedgeDS`
### Example ###
The following program fragment illustrates the implementation of a
@ -83,8 +86,8 @@ unequal to their respective default construction value. For all
halfedges `h`: The opposite halfedge is different from `h` and the
opposite of the opposite is equal to `h`. The next of the previous
halfedge is equal to `h`. For all vertices `v`: the incident vertex
of the incident halfedge of`v` is equal to`v`. The halfedges
around`v` starting with the incident halfedge of`v` form a cycle.
of the incident halfedge of `v` is equal to `v`. The halfedges
around `v` starting with the incident halfedge of `v` form a cycle.
For all faces `f`: the incident face of the incident halfedge of `f`
is equal to `f`. The halfedges around `f` starting with the incident
halfedge of `f` form a cycle. Redundancies among internal variables
@ -106,7 +109,7 @@ be reached through the faces must be equal to the number of all
halfedges, i.e., all halfedges surrounding a face must form a single
cycle (no holes in faces).
<DT><B>Level 4</B><DD>
All tests of level 3 and `normalized_border_is_valid`.
All tests of level 3 and `normalized_border_is_valid()`.
</DL>
*/
/// @{
@ -124,7 +127,7 @@ representation, which is when enumerating all halfedges with the
halfedge iterator the following holds: The non-border edges precede the
border edges. For border edges, the second halfedge is a border halfedge.
(The first halfedge may or may not be a border halfedge.) The halfedge
iterator `border_halfedges_begin()` denotes the first border
iterator `HalfedgeDS::border_halfedges_begin()` denotes the first border
edge. If `verbose` is `true`, statistics are written to `cerr`.
*/

View File

@ -178,7 +178,7 @@ face incident to `h` from `hds` and changes all halfedges
incident to the face into border edges or removes them from the
halfedge data structure if they were already border edges. If this
creates isolated vertices they get removed as well. See
`make_hole(h)` for a more specialized variant.
`make_hole()` for a more specialized variant.
\pre `h->is_border() == false`.
\requires If faces are supported, `Supports_removal` \f$ \equiv\f$ `CGAL::Tag_true`.

View File

@ -37,7 +37,7 @@ the implementation given here runs in time proportional to the size of the
incident face. For const-correctness a second implementation with signature
`Halfedge_const_handle prev() const;` is needed.
Note also the use of the static member function `halfedge_handle()`
Note also the use of the static member function `HalfedgeDS::halfedge_handle()`
of the halfedge data structure. It converts a pointer to the halfedge
into a halfedge handle. This conversion encapsulates possible
adjustments for hidden data members in the true halfedge type, such as
@ -229,42 +229,42 @@ Halfedge_handle get_face_halfedge( Face_handle f);
/// @{
/*!
makes `h->opposite()` the successor of `h`.
makes `h->%opposite()` the successor of `h`.
*/
void close_tip( Halfedge_handle h) const;
/*!
makes `h->opposite()` the successor of `h` and sets the
makes `h->%opposite()` the successor of `h` and sets the
incident vertex of `h` to `v`.
*/
void close_tip( Halfedge_handle h, Vertex_handle v) const;
/*!
inserts the tip of the edge `h` into the halfedges around the vertex
pointed to by `v`. Halfedge `h->opposite()` is the new successor of
`v` and `h->next()` will be set to `v->next()`. The vertex of `h`
pointed to by `v`. Halfedge `h->%opposite()` is the new successor of
`v` and `h->%next()` will be set to `v->next()`. The vertex of `h`
will be set to the vertex `v` refers to if vertices are supported.
*/
void insert_tip( Halfedge_handle h, Halfedge_handle v) const;
/*!
removes the edge `h->next()->opposite()` from the halfedge
removes the edge `h->%next()->%opposite()` from the halfedge
circle around the vertex referred to by `h`. The new successor
halfedge of `h` will be `h->next()->opposite()->next()`.
halfedge of `h` will be `h->%next()->%opposite()->%next()`.
*/
void remove_tip( Halfedge_handle h) const;
/*!
inserts the halfedge `h` between `f` and `f->next()`.
inserts the halfedge `h` between `f` and `f->%next()`.
The face of `h` will be the one `f` refers to if faces
are supported.
*/
void insert_halfedge( Halfedge_handle h, Halfedge_handle f) const;
/*!
removes edge `h->next()` from the halfedge circle around
removes edge `h->%next()` from the halfedge circle around
the face referred to by `h`. The new successor of `h` will be
`h->next()->next()`.
`h->%next()->%next()`.
*/
void remove_halfedge( Halfedge_handle h) const;

View File

@ -11,29 +11,27 @@ declaration is best explained with the two following declarations,
essentially hiding an implementation dependent default setting:
`template <class Refs, class T = CGAL::Tag_true>`
<span class="mbox"></span> `class HalfedgeDS_vertex_base;`
<BR>
`class HalfedgeDS_vertex_base;`
`template <class Refs, class T, class Point>`
<BR>
`class HalfedgeDS_vertex_base;`
<span class="mbox"></span> `class HalfedgeDS_vertex_base;`
`HalfedgeDS_vertex_base` defines a vertex including a reference to an incident halfedge.
`CGAL::HalfedgeDS_vertex_base<Refs,CGAL::Tag_false>` is a vertex
without a reference to an incident halfedge. It is empty besides the
required type definitions. It can be used for deriving own vertex
implementations. See also `CGAL::HalfedgeDS_vertex_min_base<Refs>`.
`CGAL::HalfedgeDS_vertex_base<Refs,CGAL::Tag_true,Point>` is a vertex
with a reference to an incident halfedge and it stores a point of type
`Point`. It can be used as a vertex for a model of the
`PolyhedronItems_3` concept.
`CGAL::HalfedgeDS_vertex_base<Refs,CGAL::Tag_false,Point>` is a vertex
without a reference to an incident halfedge and it stores a point of
type `Point`. It can be used as a vertex for a model of the
`PolyhedronItems_3` concept.
Let us look at some instantiations
- `HalfedgeDS_vertex_base` defines a vertex including a reference to an incident halfedge.
- `HalfedgeDS_vertex_base<Refs,CGAL::Tag_false>` is a vertex
without a reference to an incident halfedge. It is empty besides the
required type definitions. It can be used for deriving own vertex
implementations. See also `CGAL::HalfedgeDS_vertex_min_base<Refs>`.
- `HalfedgeDS_vertex_base<Refs,CGAL::Tag_true,Point>` is a vertex
with a reference to an incident halfedge and it stores a point of type
`Point`. It can be used as a vertex for a model of the
`PolyhedronItems_3` concept.
- `HalfedgeDS_vertex_base<Refs,CGAL::Tag_false,Point>` is a vertex
without a reference to an incident halfedge and it stores a point of
type `Point`. It can be used as a vertex for a model of the
`PolyhedronItems_3` concept.
\models ::HalfedgeDSVertex

View File

@ -5,7 +5,7 @@ namespace CGAL {
The class `HalfedgeDS_vertex_min_base` is a model of the `HalfedgeDSVertex`
concept. `Refs` is an instantiation of a `HalfedgeDS`. It is
equivalent to `CGAL::HalfedgeDS_vertex_base< Refs, CGAL::Tag_false>`.
equivalent to `HalfedgeDS_vertex_base< Refs, CGAL::Tag_false>`.
It is empty besides the required type definitions. It can be used for deriving
own vertices.

View File

@ -33,7 +33,7 @@ for the incidences, the mandatory and optional member functions
possible for vertices, halfedges, and faces.
\anchor figureOptionalMethods
\image html hds_optional_small.gif "The three classes `Vertex`, `Halfedge`, and `Face` of the halfedge data structure. Member functions with shaded background are mandatory. The others are optionally supported."
\image html hds_optional_small.gif "The three classes Vertex, Halfedge, and Face of the halfedge data structure. Member functions with shaded background are mandatory. The others are optionally supported."
A `HalfedgeDS` organizes the internal storage of its items. Examples
are a list-based or a vector-based storage. The `HalfedgeDS` exhibits
@ -325,8 +325,10 @@ operator=( const HalfedgeDS<Traits,Items,Alloc>& hds2);
/*!
reserves storage for `v` vertices, `h` halfedges, and `f` faces.
If all capacities are already greater or equal than the requested sizes
nothing happens. Otherwise, `hds` will be resized and all handles,
iterators and circulators invalidate. \pre If resizing is necessary `hds` contains no dangling handles.
nothing happens. Otherwise, the halfedge data structure will be resized and all handles,
iterators and circulators are invalid.
\pre If resizing is necessary the halfedge data structure contains no dangling handles.
*/
void reserve( size_type v, size_type h, size_type f);
@ -366,12 +368,12 @@ space reserved for faces.
Size capacity_of_faces() const;
/*!
bytes used for `hds`.
bytes used for the halfedge data structure.
*/
size_t bytes() const;
/*!
bytes reserved for `hds`.
bytes reserved for the halfedge data structure.
*/
size_t bytes_reserved() const;
@ -420,26 +422,26 @@ faces respectively.
/// @{
/*!
appends a copy of `v` to `hds`. Returns a handle of the new vertex.
appends a copy of `v` to the halfedge data structure. Returns a handle of the new vertex.
*/
Vertex_handle vertices_push_back( const Vertex& v);
/*!
appends a copy of `h` and a copy of `g` to `hds` and makes them
appends a copy of `h` and a copy of `g` to the halfedge data structure and makes them
opposite to each other. Returns a handle of the copy of `h`.
*/
Halfedge_handle edges_push_back( const Halfedge& h,
const Halfedge& g);
/*!
appends a copy of `h` and a copy of `h->opposite()` to `hds` and
makes them opposite to each other. Returns a handle of the copy of `h`.
\pre `h->opposite()` denotes a halfedge.
appends a copy of `h` and a copy of \link HalfedgeDSHalfedge::opposite() `h->opposite()`\endlink
to the halfedge data structure and makes them opposite to each other. Returns a handle of the copy of `h`.
\pre \link HalfedgeDSHalfedge::opposite() `h->opposite()`\endlink denotes a halfedge.
*/
Halfedge_handle edges_push_back( const Halfedge& h);
/*!
appends a copy of `f` to `hds`. Returns a handle of the new face.
appends a copy of `f` to the halfedge data structure. Returns a handle of the new face.
*/
Face_handle faces_push_back( const Face& f);
@ -447,9 +449,9 @@ Face_handle faces_push_back( const Face& f);
/*! \name Removal
Erasing single elements is optional and indicated with the type tag
`Supports_removal`. The `pop_back` and the `clear` member
`Supports_removal`. The three `pop_back()` and the `clear()` member
functions are mandatory. If vertices or faces are not supported
for a `HalfedgeDS` the `pop_back` and the `clear` member
for a `HalfedgeDS` the three `pop_back()` and the `clear()` member
functions must be provided as null operations.
*/
/// @{
@ -496,7 +498,7 @@ void edges_pop_back();
/*!
removes the pair of halfedges `h` and `h->opposite()`
removes the pair of halfedges `h` and \link HalfedgeDSHalfedge::opposite() `h->opposite()`\endlink
if `Supports_removal` \f$ \equiv\f$ `CGAL::Tag_true`.
*/
void edges_erase( Halfedge_handle h);
@ -565,11 +567,11 @@ incident to an open region are called <I>border halfedges</I>. A
halfedge is a <I>border edge</I> if the halfedge itself or its
opposite halfedge is a border halfedge. The only requirement to work
with border halfedges is that the
`Halfedge` class provides a member function `is_border()`
`Halfedge` class provides a member function `HalfedgeDSHalfedge::is_border()`
returning a `bool`. Usually, the halfedge data structure
supports faces and the value of the default constructor of the face
handle will indicate a border halfedge, but this may not be the only
possibility. The `is_border()` predicate divides the edges into
possibility. The `HalfedgeDSHalfedge::is_border()` predicate divides the edges into
two classes, the border edges and the non-border edges. The
following normalization reorganizes the sequential storage of the
edges such that the non-border edges precede the border edges, and

View File

@ -115,7 +115,7 @@ Halfedge_handle halfedge();
/*!
incident halfedge that points to `f`.
incident halfedge that points to the face.
*/
Halfedge_const_handle halfedge() const;

View File

@ -21,7 +21,7 @@ depicts the relationship between a halfedge and its incident
halfedges, vertices, and faces.
\anchor figureHalfedgeDSOptionalMethods
\image html hds_optional.gif "The three classes `Vertex`, `Halfedge`, and `Face` of the halfedge data structure. Member functions with shaded background are mandatory. The others are optionally supported."
\image html hds_optional.gif "The three classes Vertex, Halfedge, and Face of the halfedge data structure. Member functions with shaded background are mandatory. The others are optionally supported."
For the protection of the integrity of the data structure classes such
as `CGAL::Polyhedron_3` are allowed to redefine the modifying member
@ -104,18 +104,17 @@ typedef Hidden_type Halfedge_const_handle;
typedef Hidden_type Face_const_handle;
/*!
`CGAL::Tag_true` or
`CGAL::Tag_false`.
\link CGAL::Tag_true `CGAL::Tag_true`\endlink or \link CGAL::Tag_false `CGAL::Tag_false`\endlink.
*/
typedef Hidden_type Supports_halfedge_prev;
/*!
~
\link CGAL::Tag_true `CGAL::Tag_true`\endlink or \link CGAL::Tag_false `CGAL::Tag_false`\endlink.
*/
typedef Hidden_type Supports_halfedge_vertex;
/*!
~
\link CGAL::Tag_true `CGAL::Tag_true`\endlink or \link CGAL::Tag_false `CGAL::Tag_false`\endlink.
*/
typedef Hidden_type Supports_halfedge_face;
@ -167,7 +166,7 @@ sets next halfedge to `h`.
void set_next( Halfedge_handle h);
/*!
is true if `h` is a border halfedge.
is true if the halfedge is a border halfedge.
*/
bool is_border() const;
@ -222,7 +221,7 @@ void set_vertex( Vertex_handle v);
Face_handle face();
/*!
the incident face of `h`. If `h` is a border halfedge
the incident face of the halfedge. If the halfedge is a border halfedge
the result is default construction of the handle.
*/
Face_const_handle face() const;

View File

@ -13,9 +13,8 @@ uses the halfedge data structure as internal representation. `Traits`
is not used by the halfedge data structure itself. These three member
class templates provide a local type named `Vertex`, `Halfedge`,
and `Face` respectively. The requirements on these
types are described on page \ref HalfedgeDSVertex,
page \ref HalfedgeDSHalfedge, and
page \ref HalfedgeDSFace respectively.
types are described on the manual pages of the concepts `HalfedgeDSVertex`,
`HalfedgeDSHalfedge`, and `HalfedgeDSFace` respectively.
\hasModel CGAL::HalfedgeDS_min_items
\hasModel CGAL::HalfedgeDS_items_2

View File

@ -114,7 +114,7 @@ Vertex();
Halfedge_handle halfedge();
/*!
incident halfedge that points to `v`.
incident halfedge that points to the vertex.
*/
Halfedge_const_handle halfedge() const;
/*!

View File

@ -29,7 +29,7 @@ geometric interpretation is added by classes built on top of the
halfedge data structure. These classes might be more convenient to
use than the halfedge data structure directly, since the halfedge data
structure is meant as an implementation layer. See for example the
`CGAL::Polyhedron_3` class in Chapter \ref chapterPolyhedron.
`Polyhedron_3` class in Chapter \ref chapterPolyhedron "Polyhedral Surface".
The data structure provided here is also known as the
FE-structure \cite w-ebdss-85, as
@ -50,7 +50,7 @@ releases. Files and identifier names are disjoint with the old design
which allows for both versions to co-exists. However, classes using a
halfedge data structure can only use one design. For example the
polyhedral surface `Polyhedron_3` uses by default the new
design. See Chapter \ref chapterPolyhedron for how to still select
design. See Chapter \ref chapterPolyhedron "Polyhedral Surface" for how to still select
the old implementation.
# Software Design # {#HalfedgeDSSoftware}
@ -61,7 +61,7 @@ the old implementation.
Figure \ref figureHalfedgeDSDesign
illustrates the responsibilities of the three layers of the software
design, with the `CGAL::Polyhedron_3` as an example for the top
design, with the `Polyhedron_3` as an example for the top
layer. The items provide the space for the information that is
actually stored, i.e., with member variables and access member
functions in `Vertex`, `Halfedge`, and `Face`
@ -85,7 +85,7 @@ also provided to serve as defaults; for polyhedra they provide all
optional incidences, a three-dimensional point in the vertex type and
a plane equation in the face type.
The `Halfedge_data_structure`, concept `HalfedgeDS`, is
The Halfedge data structure concept `HalfedgeDS`, is
responsible for the storage organization of the items. Currently,
implementations using internally a bidirectional list or a
vector are provided. The `HalfedgeDS` defines the handles and iterators
@ -109,11 +109,11 @@ example, the polyhedron. They add, for example, the Euler operations
and partial operations from which further Euler operations can be
built, such as inserting an edge into the ring of edges at a
vertex. Furthermore, the helper classes contain adaptive
functionality. For example, if the `prev()` member function is not
provided for halfedges, the `find_prev()` member function of a helper
functionality. For example, if the `HalfedgeDSHalfedge::prev()` member function is not
provided for halfedges, the `HalfedgeDS_items_decorator::find_prev()` member function of a helper
class searches in the positive direction along the face for the
previous halfedge. But if the `prev()` member function is provided,
the `find_prev()` member function simply calls it. This distinction is
previous halfedge. But if the `HalfedgeDSHalfedge::prev()` member function is provided,
the `HalfedgeDS_items_decorator::find_prev()` member function simply calls it. This distinction is
resolved at compile time with a technique called <I>compile-time
tags</I>, similar to iterator tags in \cite cgal:sl-stl-95.
@ -137,7 +137,7 @@ design.
\anchor sectionHdsExamples
## The Default Halfedge Data Structure ##
## The %Default Halfedge Data Structure ##
The following example program uses the default halfedge data structure
and the decorator class. The default halfedge data structure uses a
@ -153,7 +153,7 @@ of two halfedges, one vertex and two faces, and checks its validity.
## A Minimal Halfedge Data Structure ##
The following program defines a minimal halfedge data structure using
the minimal items class `CGAL::HalfedgeDS_min_items` and a
the minimal items class `HalfedgeDS_min_items` and a
list-based halfedge data structure. The result is a data structure
maintaining only halfedges with next and opposite pointers. No
vertices or faces are stored. The data structure represents an <I>undirected graph</I>.
@ -174,7 +174,7 @@ in a consistent, i.e., <I>valid</I>, state.
\cgalexample{HalfedgeDS/hds_prog_vector.cpp}
## Example Adding Color to Faces ##
## Example Adding %Color to Faces ##
This example re-uses the base class available for faces and adds a
member variable `color`.
@ -203,9 +203,9 @@ store this bit as the least significant bit in the next halfedge
handle. Furthermore, we do not implement a pointer to the previous
halfedge. What remains are three pointers per halfedge.
\advanced We use the static member function `halfedge_handle()` to convert
\advanced We use the static member function `HalfedgeDS::halfedge_handle()` to convert
from pointers to halfedge handles. The same solution can be applied to
the list-based halfedge data structure `CGAL::HalfedgeDS_list`,
the list-based halfedge data structure `HalfedgeDS_list`,
see <TT>examples/HalfedgeDS/hds_prog_compact2.cpp</TT>. Here is the
example for the vector-based data structure.

View File

@ -20,7 +20,7 @@ matrix search.
### Implementation ###
All operations take constant time except for
`extract_all_even_rows` which needs time linear in the number
`extract_all_even_rows()` which needs time linear in the number
of rows.
*/
@ -33,7 +33,7 @@ public:
/*!
initializes
`d` to `m`. `m` is <I>not</I> copied, we only
the dynamic matrix to `m`. `m` is <I>not</I> copied, we only
store a reference.
*/
Dynamic_matrix( const M& m);
@ -69,15 +69,15 @@ void replace_column( int old, int new);
/*!
returns
a new matrix consisting of all rows of `d` with even index,
(i.e.\ first row is row \f$ 0\f$ of `d`, second row is row \f$ 2\f$ of
`d` etc.). \pre `number_of_rows()` \f$ > 0\f$.
a new matrix consisting of all rows of the dynmic matrix with even index,
(i.e.\ first row is row \f$ 0\f$ of the dynamic matrix, second row is row \f$ 2\f$ of
the dynamic matrix, etc.). \pre `number_of_rows()` \f$ > 0\f$.
*/
Matrix* extract_all_even_rows() const;
/*!
deletes the
rightmost columns, such that `d` becomes quadratic.
rightmost columns, such that the dynamic matrix becomes quadratic.
\pre `number_of_columns()` \f$ \ge\f$ `number_of_rows()`. \post `number_of_rows()` \f$ ==\f$ `number_of_columns()`.
*/
void shrink_to_quadratic_size();

View File

@ -10,8 +10,8 @@ arbitrary feasibility test and matrix classes `F` resp.\ `M`.
\models ::SortedMatrixSearchTraits
\tparam `M` must be a model for `BasicMatrix`
\tparam `F` must define a copy constructor and a monotone `bool operator()( const Value&)`.
\tparam M must be a model for `BasicMatrix`
\tparam F must define a copy constructor and a monotone `bool operator()( const Value&)`.
*/
template< typename F, typename M >
@ -36,24 +36,24 @@ m);
/*!
typedef to `M`.
*/
typedef Hidden_type Matrix;
typedef M Matrix;
/*!
typedef to `Matrix::Value`.
*/
typedef Hidden_type Value;
typedef Matrix::Value Value;
/*!
typedef to
`std::less<Value>`.
*/
typedef Hidden_type Compare_strictly;
typedef std::less<Value> Compare_strictly;
/*!
typedef to
`std::less_equal<Value>`.
*/
typedef Hidden_type Compare_non_strictly;
typedef std::less_equal<Value> Compare_non_strictly;
/// @}

View File

@ -7,7 +7,7 @@ namespace CGAL {
\author Michael Hoffmann
`CGAL::monotone_matrix_search` and `CGAL::sorted_matrix_search`
`monotone_matrix_search()` and `sorted_matrix_search()`
are techniques that deal with the problem of efficiently finding
largest entries in matrices with certain structural properties. Many
concrete problems can be modelled as matrix search problems, and for
@ -21,10 +21,10 @@ computing rectangular \f$ p\f$-centers.
In the following program we build a random vector \f$ a =
(a_i)_{i = 1,\,\ldots,\,5}\f$ (elements drawn uniformly from \f$ \{
0,\,\ldots,\,99 \}\f$) and construct a Cartesian matrix \f$ M\f$
0,\,\ldots,\,99 \}\f$) and construct a %Cartesian matrix \f$ M\f$
containing as elements all sums \f$ a_i + a_j,\: i,\,j \in
\{1,\,\ldots,\,5\}\f$. If \f$ a\f$ is sorted, \f$ M\f$ is sorted as well. So
we can apply `sorted_matrix_search` to compute the upper bound
we can apply `sorted_matrix_search()` to compute the upper bound
for the maximal entry of \f$ a\f$ in \f$ M\f$.
\cgalexample{Matrix_search/sorted_matrix_search.cpp}

View File

@ -12,8 +12,8 @@ namespace CGAL {
# Timers # {#MiscellanyTimers}
\cgal provides classes for measuring the user process time and the real time.
The class `CGAL::Timer` is the version for the user process time and
the class `CGAL::Real_timer` is the version for the real time.
The class `Timer` is the version for the user process time and
the class `Real_timer` is the version for the real time.
Instantiations of both classes are objects with a state. The state is
either <I>running</I> or it is <I>stopped</I>. The state of an object
@ -29,7 +29,7 @@ first interval.
# Memory Size # {#MiscellanyMemory}
\cgal provides access to the memory size used by the program with the
`CGAL::Memory_sizer` class. Both the virtual memory size and the
`Memory_sizer` class. Both the virtual memory size and the
resident size are available (the resident size does not account for
swapped out memory nor for the memory which is not yet paged-in).
@ -37,7 +37,7 @@ swapped out memory nor for the memory which is not yet paged-in).
\cgal provides a way to count the number of times a given line of code
is executed during the execution of a program. Such
`CGAL::Profile_counter` counters can be added at critical place in the
`Profile_counter` counters can be added at critical place in the
code, and at the end of the execution of a program, the count is printed on
`std::cerr`. A macro `CGAL_PROFILER` can be used to conveniently place
these counters anywhere. They are disabled by default and activated by the

View File

@ -3,28 +3,28 @@ namespace CGAL {
/*!
\ingroup PkgModularArithmetic
\anchor Residue
The class `Residue` represents a finite field \f$ \Z{/p\Z}\f$,
\brief The class `Residue` represents a finite field \f$ \Z{/p\Z}\f$,
for some prime number \f$ p\f$.
The prime number \f$ p\f$ is stored in a static member variable.
The class provides static member functions to change this value.
<B>Note that changing the prime invalidates already existing objects
of this type.</B>
However, already existing objects do not lose their value with respect to the
old prime and can be reused after restoring the old prime.
Since the type is based on double
arithmetic the prime is restricted to values less than \f$ 2^{26}\f$.
The initial value of \f$ p\f$ is 67111067.
Please note that the implementation of class `CGAL::Residue` requires a mantissa
\attention Note that changing the prime invalidates already existing objects
of this type.
Please note that the implementation of class `Residue` requires a mantissa
precision according to the IEEE Standard for Floating-Point Arithmetic (IEEE 754).
However, on some processors the traditional FPU uses an extended precision. Hence, it
is indispensable that the proper mantissa length is enforced before performing
any arithmetic operations. Moreover, it is required that numbers are rounded to the
next nearest value. This can be ensured using `CGAL::Protect_FPU_rounding` with
next nearest value. This can be ensured using `Protect_FPU_rounding` with
`CGAL_FE_TONEAREST`, which also enforces the required precision as a side effect.
In case the flag `CGAL_HAS_THREADS`
@ -33,8 +33,9 @@ of the class, that is, `Residue` is not thread-safe in this case.
In case `CGAL_HAS_THREADS`
the implementation of the class is thread safe using
`boost::thread_specific_ptr`. However, this may cause some performance
penalty. Hence, it may be advisable to configure `CGAL` with
`CGAL_HAS_NO_THREADS`.
penalty. Hence, it may be advisable to configure %CGAL with
`CGAL_HAS_NO_THREADS`. See Section \ref Preliminaries_thread_safety "Thread Safety"
in the preliminaries.
\models ::Field
@ -47,22 +48,22 @@ public:
/// @{
/*!
introduces a variable `x`, which is initialized with zero;
introduces a variable `x`, which is initialized with zero.
*/
Residue();
/*!
copy constructor;
copy constructor.
*/
Residue(const Residue& m);
/*!
introduces a variable `x`, which is initialized with \f$ i \% p\f$;
introduces a variable `x`, which is initialized with \f$ i \mod p\f$.
*/
Residue(int i);
/*!
introduces a variable `x`, which is initialized with \f$ i \% p\f$;
introduces a variable `x`, which is initialized with \f$ i \mod p\f$.
*/
Residue(long i);
@ -73,9 +74,7 @@ Residue(long i);
/*!
Static member function;
sets current prime to the given value and returns the old prime.
Static member function which sets the current prime to the given value and returns the old prime.
*/
static int set_current_prime(int p);
@ -90,7 +89,7 @@ static int get_current_prime();
/*!
Returns the unique representative of `x`within the range
Returns the unique representative of `x` within the range
\f$ [-p/2,p/2]\f$, where \f$ p\f$ is the current prime.
*/

View File

@ -8,7 +8,7 @@ with respect to a homomorphism \f$ \varphi\f$ from the
`ModularTraits::Type` into the `ModularTraits::Residue_type`.
The homomorphism preserves the mapping of `int` into both types
, i.e., \f$ \varphi(Type(i)) == Residue\_type(i)\f$.
, i.e., \f$ \varphi(\mathrm{Type}(i)) == \mathrm{Residue\_type}(i)\f$.
\refines `AdaptableUnaryFunction`

View File

@ -20,9 +20,9 @@ which can not be represented.
\hasModel `int`
\hasModel `long`
\hasModel `CORE::BigInt`
\hasModel `CGAL::CORE::BigInt`
\hasModel `CGAL::Gmpz`
\hasModel `leda::integer`
\hasModel `leda_integer`
\hasModel `mpz_class`
The following types are `Modularizable` iff their template arguments are.

View File

@ -19,7 +19,7 @@ correspondent with respect to one prime only.
# Residue and Modularizable # {#Modular_arithmetic_residue}
First of all, this package introduces a type `CGAL::Residue`.
First of all, this package introduces a type `Residue`.
It represents \f$ \Z_{/p\Z}\f$ for some prime \f$ p\f$.
The prime number \f$ p\f$ is stored in a static member variable.
The class provides static member functions to change this value.
@ -36,15 +36,15 @@ The initial value of \f$ p\f$ is 67111067.
Moreover, the package introduces the concept `Modularizable`.
An algebraic structure `T` is considered as `Modularizable` if there
is a mapping from `T` into an algebraic structure that is based on
the type `CGAL::Residue`.
the type `Residue`.
For scalar types, e.g. Integers, this mapping is just the canonical
homomorphism into \f$ \Z_{/p\Z}\f$ represented by `CGAL::Residue`.
homomorphism into \f$ \Z_{/p\Z}\f$ represented by `Residue`.
For compound types, e.g. Polynomials, the mapping is applied to the
coefficients of the compound type.
The mapping is provided by the class `CGAL::Modular_traits<T>`.
The class `CGAL::Modular_traits<T>` is designed such that the concept
The mapping is provided by the class `Modular_traits<T>`.
The class `Modular_traits<T>` is designed such that the concept
`Modularizable` can be considered as optional, i.e.,
`CGAL::Modular_traits<T>` provides a tag that can be used for dispatching.
`Modular_traits<T>` provides a tag that can be used for dispatching.
## Example ## {#Modular_arithmetic_example}
@ -63,12 +63,12 @@ that the coefficient type is `Modularizable` and that it is not.
If the type is not `Modularizable` the filter is just not applied and the
function returns true.
Further note that the implementation of class `CGAL::Residue` requires a mantissa
Further note that the implementation of class `Residue` requires a mantissa
precision according to the IEEE Standard for Floating-Point Arithmetic (IEEE 754).
However, on some processors the traditional FPU uses an extended precision. Hence, it
is indispensable that the proper mantissa length is enforced before performing
any arithmetic operations. Moreover, it is required that numbers are rounded to the
next nearest value. This can be ensured using `CGAL::Protect_FPU_rounding` with
next nearest value. This can be ensured using `Protect_FPU_rounding` with
`CGAL_FE_TONEAREST`, which also enforces the required precision as a side effect.
@ -76,7 +76,7 @@ next nearest value. This can be ensured using `CGAL::Protect_FPU_rounding` with
# Design and Implementation History # {#Modular_arithmeticDesign}
The class `CGAL::Residue` is based on the C-code of Sylvain Pion et. al.
The class `Residue` is based on the C-code of Sylvain Pion et. al.
as it was presented in \cite bepp-sdrns-99.
The remaining part of the package is the result of the integration process

View File

@ -5,7 +5,7 @@
The concept `SnapRoundingTraits_2` lists the set of requirements that must be fulfilled by
an instance of the `Traits` template-parameter of
the function \ref CGAL::snap_rounding_2 "CGAL::snap_rounding_2<Traits,InputIterator,OutputContainer>()".
the function \ref CGAL::snap_rounding_2() "CGAL::snap_rounding_2<Traits,InputIterator,OutputContainer>()".
This concept provides the types of the geometric primitives used in
this class and some function object types for the required
predicates on those primitives.
@ -14,9 +14,9 @@ predicates on those primitives.
\refines `Assignable`
\refines `CopyConstructible`
\refines `SweepLineTraits_2`
\refines An instance of this concept is used as the traits class for the `CGAL::Sweep_line_2::get_intersection_points()` operation. The requirements listed below are induced by components of the `CGAL::snap_rounding_2` function other than the call to `CGAL::Sweep_line_2::get_intersection_points()`. Naturally, some of them may already be listed in `SweepLineTraits_2`.
\refines An instance of this concept is used as the traits class for the `CGAL::Sweep_line_2::get_intersection_points()` operation. The requirements listed below are induced by components of the `CGAL::snap_rounding_2()` function other than the call to `Sweep_line_2::get_intersection_points()`. Naturally, some of them may already be listed in `SweepLineTraits_2`.
\hasModel `CGAL::Snap_rounding_traits<Kernel>`
\hasModel `CGAL::Snap_rounding_traits_2<Kernel>`
\sa `CGAL::Snap_rounding_2<Kernel>`