\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)

CGAL 4.8 - dD Geometry Kernel

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members | Related Functions
CGAL::Sphere_d< Kernel > Class Template Reference
Kernel Objects

`#include <CGAL/Kernel_d/Sphere_d.h>`

## Definition

An instance \( S\) of the data type `Sphere_d` is an oriented sphere in some \( d\)-dimensional space.

A sphere is defined by \( d+1\) points (class `Point_d<Kernel>`). We use \( A\) to denote the array of the defining points. A set \( A\) of defining points is legal if either the points are affinely independent or if the points are all equal. Only a legal set of points defines a sphere in the geometric sense and hence many operations on spheres require the set of defining points to be legal. The orientation of \( S\) is equal to the orientation of the defining points, i.e., `orientation(A)`.

Implementation

Spheres are implemented by a vector of points as a handle type. All operations like creation, initialization, tests, input and output of a sphere \( s\) take time \( O(s.dimension()) \). `dimension()`, point access take constant time. The `center()`-operation takes time \( O(d^3)\) on its first call and constant time thereafter. The sidedness and orientation tests take time \( O(d^3)\). The space requirement for spheres is \( O(s.dimension())\) neglecting the storage room of the points.

## Related Functions
(Note that these are not member functions.)
bool | weak_equality (const Sphere_d< Kernel > &S1, const Sphere_d< Kernel > &S2)
| Test for equality as unoriented spheres. More...

## Types
typedef unspecified_type | LA
| the linear algebra layer.
typedef unspecified_type | point_iterator
| a read-only iterator for points defining the sphere.

## Creation
| Sphere_d ()
| introduces a variable `S` of type `Sphere_d<Kernel>`.
template<class ForwardIterator >
| Sphere_d (int d, ForwardIterator first, ForwardIterator last)
| introduces a variable `S` of type `Sphere_d<Kernel>`. More...

## Operations
int | dimension ()
| returns the dimension of the ambient space.
Point_d< Kernel > | point (int i)
| returns the \( i\)th defining point. More...
point_iterator | points_begin ()
| returns an iterator pointing to the first defining point.
point_iterator | points_end ()
| returns an iterator pointing beyond the last defining point.
bool | is_degenerate ()
| returns true iff the defining points are not full dimensional.
bool | is_legal ()
| returns true iff the set of defining points is legal. More...
Point_d< Kernel > | center ()
| returns the center of `S`. More...
FT | squared_radius ()
| returns the squared radius of the sphere. More...
Orientation | orientation ()
| returns the orientation of `S`.
Oriented_side | oriented_side (const Point_d< Kernel > &p)
| returns either the constant `ON_ORIENTED_BOUNDARY`, `ON_POSITIVE_SIDE`, or `ON_NEGATIVE_SIDE`, iff p lies on the boundary, properly on the positive side, or properly on the negative side of sphere, resp. More...
Bounded_side | bounded_side (const Point_d< Kernel > &p)
| returns `ON_BOUNDED_SIDE`, `ON_BOUNDARY`, or `ON_UNBOUNDED_SIDE` iff p lies properly inside, on the boundary, or properly outside of sphere, resp. More...
bool | has_on_positive_side (const Point_d< Kernel > &p)
| returns `S.oriented_side(p)==ON_POSITIVE_SIDE`. More...
bool | has_on_negative_side (const Point_d< Kernel > &p)
| returns `S.oriented_side(p)==ON_NEGATIVE_SIDE`. More...
bool | has_on_boundary (const Point_d< Kernel > &p)
| returns `S.oriented_side(p)==ON_ORIENTED_BOUNDARY`, which is the same as `S.bounded_side(p)==ON_BOUNDARY`. More...
bool | has_on_bounded_side (const Point_d< Kernel > &p)
| returns `S.bounded_side(p)==ON_BOUNDED_SIDE`. More...
bool | has_on_unbounded_side (const Point_d< Kernel > &p)
| returns `S.bounded_side(p)==ON_UNBOUNDED_SIDE`. More...
Sphere_d< Kernel > | opposite ()
| returns the sphere with the same center and squared radius as `S` but with opposite orientation.
Sphere_d< Kernel > | operator+ (const Vector_d< Kernel > &v)
| returns the sphere translated by `v`. More...

## Constructor & Destructor Documentation

template<typename Kernel >
template<class ForwardIterator >

CGAL::Sphere_d< Kernel >::Sphere_d | ( | int | d,
|  | ForwardIterator | first,
|  | ForwardIterator | last
| ) |  |

introduces a variable `S` of type `Sphere_d<Kernel>`.

`S` is initialized to the sphere through the points in `A = tuple [first,last)`.

Precondition
  \(A\) consists of \(d+1\) \(d\)-dimensional points.

Template Parameters

  ForwardIterator | has `Point_d<Kernel>` as value type.

## Member Function Documentation

template<typename Kernel >

Bounded_side CGAL::Sphere_d< Kernel >::bounded_side | ( | const Point_d< Kernel > & | p) |  |

returns `ON_BOUNDED_SIDE`, `ON_BOUNDARY`, or `ON_UNBOUNDED_SIDE` iff p lies properly inside, on the boundary, or properly outside of sphere, resp.

Precondition
  `S.dimension()==p.dimension()`.

template<typename Kernel >

Point_d<Kernel> CGAL::Sphere_d< Kernel >::center | ( | ) |  |

returns the center of `S`.

Precondition
  `S` is legal.

template<typename Kernel >

bool CGAL::Sphere_d< Kernel >::has_on_boundary | ( | const Point_d< Kernel > & | p) |  |

returns `S.oriented_side(p)==ON_ORIENTED_BOUNDARY`, which is the same as `S.bounded_side(p)==ON_BOUNDARY`.

Precondition
  `S.dimension()==p.dimension()`.

template<typename Kernel >

bool CGAL::Sphere_d< Kernel >::has_on_bounded_side | ( | const Point_d< Kernel > & | p) |  |

returns `S.bounded_side(p)==ON_BOUNDED_SIDE`.

Precondition
  `S.dimension()==p.dimension()`.

template<typename Kernel >

bool CGAL::Sphere_d< Kernel >::has_on_negative_side | ( | const Point_d< Kernel > & | p) |  |

returns `S.oriented_side(p)==ON_NEGATIVE_SIDE`.

Precondition
  `S.dimension()==p.dimension()`.

template<typename Kernel >

bool CGAL::Sphere_d< Kernel >::has_on_positive_side | ( | const Point_d< Kernel > & | p) |  |

returns `S.oriented_side(p)==ON_POSITIVE_SIDE`.

Precondition
  `S.dimension()==p.dimension()`.

template<typename Kernel >

bool CGAL::Sphere_d< Kernel >::has_on_unbounded_side | ( | const Point_d< Kernel > & | p) |  |

returns `S.bounded_side(p)==ON_UNBOUNDED_SIDE`.

Precondition
  `S.dimension()==p.dimension()`.

template<typename Kernel >

bool CGAL::Sphere_d< Kernel >::is_legal | ( | ) |  |

returns true iff the set of defining points is legal.

A set of defining points is legal iff their orientation is non-zero or if they are all equal.

template<typename Kernel >

Sphere_d<Kernel> CGAL::Sphere_d< Kernel >::operator+ | ( | const Vector_d< Kernel > & | v) |  |

returns the sphere translated by `v`.

Precondition
  `S.dimension()==v.dimension()`.

template<typename Kernel >

Oriented_side CGAL::Sphere_d< Kernel >::oriented_side | ( | const Point_d< Kernel > & | p) |  |

returns either the constant `ON_ORIENTED_BOUNDARY`, `ON_POSITIVE_SIDE`, or `ON_NEGATIVE_SIDE`, iff p lies on the boundary, properly on the positive side, or properly on the negative side of sphere, resp.

Precondition
  `S.dimension()==p.dimension()`.

template<typename Kernel >

Point_d<Kernel> CGAL::Sphere_d< Kernel >::point | ( | int | i) |  |

returns the \( i\)th defining point.

Precondition
  \( 0 \le i \le dim \)

template<typename Kernel >

FT CGAL::Sphere_d< Kernel >::squared_radius | ( | ) |  |

returns the squared radius of the sphere.

Precondition
  `S` is legal.

## Friends And Related Function Documentation

template<typename Kernel >

bool weak_equality | ( | const Sphere_d< Kernel > & | S1,
|  | const Sphere_d< Kernel > & | S2
| ) |  |
| related

Test for equality as unoriented spheres.

Precondition
  `S1.dimension()==S2.dimension()`.