Bromeon
Classes | Functions | Variables
Math

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

Classes

class  thor::Vertex
 Class that represents a point with X and Y coordinates. More...
class  thor::Edge< VertexType >
 Edge that contains two vertices (its endpoints) More...
class  thor::Triangle< VertexType >
 Triangle class consisting of 3 vertices. More...
struct  thor::TrigonometricTraits< float >
 Trigonometric traits: Specialization for float. More...
struct  thor::TrigonometricTraits< double >
 Trigonometric traits: Specialization for double. More...
struct  thor::TrigonometricTraits< long double >
 Trigonometric traits: Specialization for long double. More...
struct  thor::TrigonometricTraits
 Trigonometric traits template. More...

Functions

int thor::Random (int begin, int end)
 Returns an int random number in the interval [begin, end].
int thor::RandomDev (int middle, int deviation)
 Returns an int random number in the interval [middle-deviation, middle+deviation].
float thor::Random (float begin, float end)
 Returns a float random number in the interval [begin, end].
float thor::RandomDev (float middle, float deviation)
 Returns a float random number in the interval [middle-deviation, middle+deviation].
void thor::SetRandomSeed (unsigned long seed)
 Sets the seed of the random number generator.
template<typename InputIterator , typename OutputIterator >
OutputIterator thor::Triangulate (InputIterator verticesBegin, InputIterator verticesEnd, OutputIterator trianglesOut)
 Delaunay Triangulation.
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator thor::TriangulateConstrained (InputIterator1 verticesBegin, InputIterator1 verticesEnd, InputIterator2 constrainedEdgesBegin, InputIterator2 constrainedEdgesEnd, OutputIterator trianglesOut)
 Constrained Delaunay Triangulation.
template<typename InputIterator , typename OutputIterator >
OutputIterator thor::TriangulatePolygon (InputIterator verticesBegin, InputIterator verticesEnd, OutputIterator trianglesOut)
 Polygon Delaunay Triangulation.
template<typename InputIterator , typename OutputIterator1 , typename OutputIterator2 >
OutputIterator1 thor::TriangulatePolygon (InputIterator verticesBegin, InputIterator verticesEnd, OutputIterator1 trianglesOut, OutputIterator2 edgesOut)
 Polygon Delaunay Triangulation.
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...)

Detailed Description

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


Function Documentation

int thor::Random ( int  begin,
int  end 
)

Returns an int random number in the interval [begin, end].

Precondition:
begin <= end
float thor::Random ( float  begin,
float  end 
)

Returns a float random number in the interval [begin, end].

Precondition:
begin <= end
int thor::RandomDev ( int  middle,
int  deviation 
)

Returns an int random number in the interval [middle-deviation, middle+deviation].

Precondition:
deviation >= 0
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 shall be thor::Vertex or a class derived from it, their order doesn't matter.
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<T>, where T is your 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.
template<typename InputIterator1 , typename InputIterator2 , typename OutputIterator >
OutputIterator thor::TriangulateConstrained ( InputIterator1  verticesBegin,
InputIterator1  verticesEnd,
InputIterator2  constrainedEdgesBegin,
InputIterator2  constrainedEdgesEnd,
OutputIterator  trianglesOut 
)

Constrained Delaunay Triangulation.

Performes 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 shall be thor::Vertex or a class derived from it, their order doesn't matter.
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<T>, 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<T>, where T 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.
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 vertices representing the corners of the polygon. The element type shall be thor::Vertex or a class derived from it. 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<T>, where T 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.
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 vertices representing the corners of the polygon. The element type shall be thor::Vertex or a class derived from it. 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<T>, where T 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.

Variable Documentation

const float thor::Pi

The number Pi (3.1415...)

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