TC::Math Namespace Reference

TC::Math is intended to provide methods to perform common math operations. More...


Namespaces

namespace  Factory
 Factory for creating TC::Math objects.

Classes

class  Box
 Class defining a box with two coordinates The minimum and maximum pos in all components and the. More...
class  Checksum
 Class defining the interface for calculating checksums With the method Append data can be added to the checksum calculation. More...
class  Coord2D
 Class for handling 2D values with implementation of all common operators needed. More...
class  Coord3D
 Class for handling 3D values With implementation of all common coordinate or vector operators needed. More...
class  Coord4D
 Class for handling 3D values With implementation of all common coordinate or vector operators needed. More...

Typedefs

typedef SharedPtr< ChecksumChecksumPtr
 Shared pointer of an checksum object.

Functions

template<class T >
const Coord2D< T > operator* (const Coord2D< T > &v, const T &vIn)
template<class T >
const Coord2D< T > operator* (const T &vIn, const Coord2D< T > &v)
template<class T >
const T operator* (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
const Coord2D< T > operator/ (const Coord2D< T > &v, const T &vIn)
template<class T >
const Coord2D< T > operator/ (const T &vIn, const Coord2D< T > &v)
template<class T >
const Coord2D< T > operator+ (const Coord2D< T > &v, const Coord2D< T > &b)
template<class T >
const Coord2D< T > operator+ (const Coord2D< T > &v, const T &b)
template<class T >
const Coord2D< T > operator- (const Coord2D< T > &v, const Coord2D< T > &b)
template<class T >
const Coord2D< T > operator- (const Coord2D< T > &v, const T &b)
template<class T >
const Coord2D< T > operator- (const Coord2D< T > &v)
template<class T >
bool operator> (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
bool operator< (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
bool operator== (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
bool operator!= (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
bool operator>= (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
bool operator<= (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
StreamPtr operator>> (StreamPtr stream, Coord2D< T > &coord)
 read operator for reading the data from a Stream
template<class T >
StreamPtr operator<< (StreamPtr stream, const Coord2D< T > &coord)
 write operator for writing the data to a Stream
template<class T >
const Coord3D< T > operator^ (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
const T operator* (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
const Coord3D< T > operator* (const Coord3D< T > &v, const T &vIn)
template<class T >
const Coord3D< T > operator* (const T &vIn, const Coord3D< T > &v)
template<class T >
const Coord3D< T > operator/ (const Coord3D< T > &v, const T &vIn)
template<class T >
const Coord3D< T > operator/ (const T &vIn, const Coord3D< T > &v)
template<class T >
const Coord3D< T > operator/ (const Coord3D< T > &in, const Coord3D< T > &in2)
template<class T >
const Coord3D< T > operator+ (const Coord3D< T > &v, const Coord3D< T > &b)
template<class T >
const Coord3D< T > operator+ (const Coord3D< T > &v, const T &b)
template<class T >
const Coord3D< T > operator- (const Coord3D< T > &v, const Coord3D< T > &b)
template<class T >
const Coord3D< T > operator- (const Coord3D< T > &v, const T &b)
template<class T >
const Coord3D< T > operator- (const Coord3D< T > &v)
template<class T >
bool operator> (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
bool operator< (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
bool operator== (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
bool operator!= (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
bool operator>= (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
bool operator<= (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
StreamPtr operator>> (StreamPtr stream, Coord3D< T > &coord)
 Read operator for reading the data from a TCStream.
template<class T >
StreamPtr operator<< (StreamPtr stream, const Coord3D< T > &coord)
 Write operator for writing the data to a TCStream.
template<class T >
Coord4D< T > operator* (const Coord4D< T > &v, const T &vIn)
template<class T >
Coord4D< T > operator* (const T &vIn, const Coord4D< T > &v)
template<class T >
Coord4D< T > operator/ (const Coord4D< T > &v, const T &vIn)
template<class T >
Coord4D< T > operator/ (const T &vIn, const Coord4D< T > &v)
template<class T >
Coord4D< T > operator+ (const Coord4D< T > &v, const Coord4D< T > &b)
template<class T >
Coord4D< T > operator- (const Coord4D< T > &v, const Coord4D< T > &b)
template<class T >
Coord4D< T > operator- (const Coord4D< T > &v)
template<class T >
bool operator> (const Coord4D< T > &a, const Coord4D< T > &b)
template<class T >
bool operator< (const Coord4D< T > &a, const Coord4D< T > &b)
template<class T >
bool operator== (const Coord4D< T > &a, const Coord4D< T > &b)
template<class T >
bool operator!= (const Coord4D< T > &a, const Coord4D< T > &b)
template<class T >
bool operator>= (const Coord4D< T > &a, const Coord4D< T > &b)
template<class T >
bool operator<= (const Coord4D< T > &a, const Coord4D< T > &b)
template<class T >
StreamPtr operator>> (StreamPtr stream, Coord4D< T > &coord)
 Read operator for reading the data from a TCStream.
template<class T >
StreamPtr operator<< (StreamPtr stream, const Coord4D< T > &coord)
 Write operator for writing the data to a TCStream.
template<class COORD_TYPE >
double Distance (const COORD_TYPE &a, const COORD_TYPE &b)
 Computes the distance of two 3-coordinates.
template<class COORD_TYPE >
double Distance2 (const COORD_TYPE &a, const COORD_TYPE &b)
 Computes the square distance of two 3-coordinates.
template<class COORD_TYPE >
COORD_TYPE::DataType DotProduct (const COORD_TYPE &a, const COORD_TYPE &b)
 Computes the dot product of two 3-coordinates (float-precision version).
template<class COORD_TYPE >
COORD_TYPE::DataType DotProduct2 (const COORD_TYPE &a, const COORD_TYPE &b)
 Computes the square dot product of two 3-coordinates.
template<class COORD_TYPE >
COORD_TYPE Normalize (const COORD_TYPE &coord)
 Computes the the normalized vector of the coord and returns it.
template<class COORD_TYPE >
COORD_TYPE CrossProduct (const COORD_TYPE &a, const COORD_TYPE &b)
 Computes the cross product of two 3-coordinates.
template<class T >
Coord3D< T > Max (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
Coord2D< T > Max (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
Coord3D< T > Min (const Coord3D< T > &a, const Coord3D< T > &b)
template<class T >
Coord2D< T > Min (const Coord2D< T > &a, const Coord2D< T > &b)
template<class T >
Coord3D< T > Normalvector (sint32 numPoints, const Coord3D< T > *coords)
 Calculates the normal vector of the plane defined by the points.
template<class COORD_TYPE >
double Angle (const COORD_TYPE &a, const COORD_TYPE &b)
 Computes the angle between two 3d vectors.
template<class T >
bool IsPointInCircle (const Coord2D< T > &Point, const Coord2D< T > &center, double radius)
template<class T >
bool CheckInsidePolygon (const Coord2D< T > &point, sint32 num_points, const Coord2D< T > *polygon)
template<class T >
Abs (const T &x)
template<class T >
Pow (T x, uint32 y)
 integer version of pow(.
uint32 Align32 (uint32 size)
 aligns a given number to 32
bool Compare (double val1, double val2)
 Compare two double values if equal by checking their difference.
uint32 Align16 (uint32 size)
 aligns a given number to 16
template<class T >
double Deg2Rad (T val)
 Function converts angle in degrees to angle in radians.
template<class T >
double Rad2Deg (T val)
 Function converts angle in radians to angle in degrees.
template<class T >
Normalize (T minValue, T maxValue, T value)
 Function converts a value in the range between minValue and maxValue to a value between 0 and one.
template<class T >
double SinXOverX (T x)
 This function calculates sin(x)/x in a safe way, i.e.
template<class T >
RoundToFirstSignificantValue (T val)
 Round any kind of value to the first significant value.
template<class T >
bool Compare (const T &val1, const T &val2)
 compare double or float value with its specified system epsilon
bool IsNaN (double val)
 function returns a true value if value is "not-a-number" (NaN), and false otherwise.
bool IsFinite (double val)
bool IsInf (double val)

Variables

const double PI = 3.1415926535897932385E0
 The constant value of PI.
const double MEGA_BYTES = 1024. * 1024.
 The constant value one Megabyte in bytes.


Detailed Description

TC::Math is intended to provide methods to perform common math operations.

These include providing constants such as Pi; conversion from degrees to radians; vector operations such as dot and cross products matrix determinant for 2x2 and 3x3 matrices; and random number generation. Note that these are not all implemented yet.


Copyright (c) Thomas Goessler 2003 - 2008