Namespaces | Classes | Functions | Variables
Math

Mathematical functionality, such as random number generator or trigonometric wrappers. More...

Namespaces

 thor::Distributions
 Namespace for some predefined distribution functions.
 

Classes

class  thor::Distribution< T >
 Class holding a rule to create values with predefined properties. More...
 
class  thor::Edge< V >
 Edge that contains two vertices (its endpoints or corners) More...
 
class  thor::Triangle< V >
 Triangle class consisting of 3 vertices (its corners). More...
 
struct  thor::TriangulationTraits< V >
 Traits template to implement the Vertex concept. More...
 
struct  thor::TrigonometricTraits< T >
 Trigonometric traits template. More...
 

Functions

int thor::random (int min, int max)
 Returns an int random number in the interval [min, max]. More...
 
unsigned int thor::random (unsigned int min, unsigned int max)
 Returns an unsigned int random number in the interval [min, max]. More...
 
float thor::random (float min, float max)
 Returns a float random number in the interval [min, max]. More...
 
float thor::randomDev (float middle, float deviation)
 Returns a float random number in the interval [middle-deviation, middle+deviation]. More...
 
void thor::setRandomSeed (unsigned long seed)
 Sets the seed of the random number generator. More...
 
template<typename InputIterator , typename OutputIterator >
OutputIterator thor::triangulate (InputIterator verticesBegin, InputIterator verticesEnd, OutputIterator trianglesOut)
 Delaunay Triangulation. More...
 
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator thor::triangulateConstrained (InputIterator1 verticesBegin, InputIterator1 verticesEnd, InputIterator2 constrainedEdgesBegin, InputIterator2 constrainedEdgesEnd, OutputIterator trianglesOut)
 Constrained Delaunay Triangulation. More...
 
template<typename InputIterator , typename OutputIterator >
OutputIterator thor::triangulatePolygon (InputIterator verticesBegin, InputIterator verticesEnd, OutputIterator trianglesOut)
 Polygon Delaunay Triangulation. More...
 
template<typename InputIterator , typename OutputIterator1 , typename OutputIterator2 >
OutputIterator1 thor::triangulatePolygon (InputIterator verticesBegin, InputIterator verticesEnd, OutputIterator1 trianglesOut, OutputIterator2 edgesOut)
 Polygon Delaunay Triangulation. More...
 
template<typename T >
thor::toDegree (T radian)
 Converts radians to degrees.
 
template<typename T >
thor::toRadian (T degree)
 Converts degrees to radians.
 

Variables

const float thor::Pi
 The number Pi (3.1415...) More...
 

Detailed Description

Mathematical functionality, such as random number generator or trigonometric wrappers.

Function Documentation

int thor::random ( int  min,
int  max 
)

Returns an int random number in the interval [min, max].

Precondition
min <= max
unsigned int thor::random ( unsigned int  min,
unsigned int  max 
)

Returns an unsigned int random number in the interval [min, max].

Precondition
min <= max
float thor::random ( float  min,
float  max 
)

Returns a float random number in the interval [min, max].

Precondition
min <= max
float thor::randomDev ( float  middle,
float  deviation 
)

Returns a float random number in the interval [middle-deviation, middle+deviation].

Precondition
deviation >= 0
void thor::setRandomSeed ( unsigned long  seed)

Sets the seed of the random number generator.

Setting the seed manually is useful when you want to reproduce a given sequence of random numbers. Without calling this function, the seed is different at each program startup.

template<typename InputIterator , typename OutputIterator >
OutputIterator thor::triangulate ( InputIterator  verticesBegin,
InputIterator  verticesEnd,
OutputIterator  trianglesOut 
)

Delaunay Triangulation.

Triangulates a set of points in a way such that every resulting triangle's circumcircle contains no other than the own three points. This condition leads to a "beautiful" result, the triangles appear balanced.

Parameters
verticesBegin,verticesEndIterator range to the points being triangulated. The element type V can be any type as long as thor::TriangulationTraits<V> is specialized.
Note that the triangulation may meet problems at 4 co-circular points or at 3 or more collinear points.
trianglesOutOutput iterator which is used to store the computed triangles. The elements shall be of type thor::Triangle<V>, where V is your (maybe const-qualified) vertex type. The resulting triangles reference the original vertices in [verticesBegin, verticesEnd[, so they must not be destroyed as long as you access the triangles.
Returns
Output iterator after the last element written.

Const-correctness is propagated through the algorithm. That is, if InputIterator is a const_iterator, the triangle's template argument shall be const.

template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator thor::triangulateConstrained ( InputIterator1  verticesBegin,
InputIterator1  verticesEnd,
InputIterator2  constrainedEdgesBegin,
InputIterator2  constrainedEdgesEnd,
OutputIterator  trianglesOut 
)

Constrained Delaunay Triangulation.

Performs a Delaunay triangulation while taking constraining edges into account. "Constrained" means edges which are supposed to be part of the triangulation, locally ignoring the Delaunay condition.

Parameters
verticesBegin,verticesEndIterator range to the points being triangulated. The element type V can be any type as long as thor::TriangulationTraits<V> is specialized.
Note that the triangulation may meet problems at 4 co-circular points or at 3 or more collinear points.
constrainedEdgesBegin,constrainedEdgesEndIterator range to the constrained edges. The element type shall be thor::Edge<V>, where T specifies your vertex type. The edges must refer to vertices inside the range [verticesBegin, verticesEnd[. To get expected results, edges may not intersect (except at the end points; containing the same vertex is allowed).
trianglesOutOutput iterator which is used to store the computed triangles. The elements shall be of type thor::Triangle<V>, where V is your vertex type. The resulting triangles reference the original vertices in [verticesBegin, verticesEnd[, so the vertices may not be destroyed as long as you access the triangles.
Returns
Output iterator after the last element written.

Const-correctness is propagated through the algorithm. That is, if InputIterator is a const_iterator, the triangle's template argument shall be const.

template<typename InputIterator , typename OutputIterator >
OutputIterator thor::triangulatePolygon ( InputIterator  verticesBegin,
InputIterator  verticesEnd,
OutputIterator  trianglesOut 
)

Polygon Delaunay Triangulation.

Computes a Delaunay triangulation of the inside of a polygon.

Parameters
verticesBegin,verticesEndIterator range to the points being triangulated. The element type V can be any type as long as thor::TriangulationTraits<V> is specialized. The order of the vertices is important, as the constrained edges are formed between consecutive points (and between the last and first point). If the vertices lead to crossing edges, the result is undefined.
trianglesOutOutput iterator which is used to store the computed triangles. The elements shall be of type thor::Triangle<V>, where V is your vertex type. The resulting triangles reference the original vertices in [verticesBegin, verticesEnd[, so the vertices may not be destroyed as long as you access the triangles.
Returns
Output iterator after the last element written.

Const-correctness is propagated through the algorithm. That is, if InputIterator is a const_iterator, the triangle's template argument shall be const.

template<typename InputIterator , typename OutputIterator1 , typename OutputIterator2 >
OutputIterator1 thor::triangulatePolygon ( InputIterator  verticesBegin,
InputIterator  verticesEnd,
OutputIterator1  trianglesOut,
OutputIterator2  edgesOut 
)

Polygon Delaunay Triangulation.

Computes a Delaunay triangulation of the inside of a polygon.

Parameters
verticesBegin,verticesEndIterator range to the points being triangulated. The element type V can be any type as long as thor::TriangulationTraits<V> is specialized. The order of the vertices is important, as the constrained edges are formed between consecutive points (and between the last and first point). If the vertices lead to crossing edges, the result is undefined.
trianglesOutOutput iterator which is used to store the computed triangles. The elements shall be of type thor::Triangle<V>, where V is your vertex type. The resulting triangles reference the original vertices in [verticesBegin, verticesEnd[, so the vertices may not be destroyed as long as you access the triangles.
edgesOutOutput iterator which can be used to store the outline of the polygon. Beginning at the edge between verticesBegin and verticesBegin+1, every edge is sequentially written to edgesOut (the edge between the last and first point included).
Returns
Output iterator after the last element written.

Const-correctness is propagated through the algorithm. That is, if InputIterator is a const_iterator, the triangle's and edge's template arguments shall be const.

Variable Documentation

const float thor::Pi

The number Pi (3.1415...)

Pi has the same value as TrigonometricTraits<float>::pi().