Orxonox: src/util/Math.h File Reference

# Math.h File Reference

Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the orxonox namespace. More...

`#include "UtilPrereqs.h"`
`#include <string>`
`#include <cmath>`
`#include <OgreMath.h>`
`#include <OgreVector2.h>`
`#include <OgreVector3.h>`
`#include <OgreVector4.h>`
`#include <OgreQuaternion.h>`
`#include <OgreColourValue.h>`

## Namespaces

namespace | orxonox

## Classes

class | orxonox::IntVector2
class | orxonox::IntVector3
struct | orxonox::NilValue< T >
| Provides zero value symbols that can be returned as reference. More...

## Functions

template<typename T>
T | orxonox::clamp (T x, T min, T max)
| Keeps a value between a lower and an upper limit.
template<typename T>
T | orxonox::cube (T x)
| Returns the cube value (x^3).
orxonox::Vector2 | orxonox::get2DViewcoordinates (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &myorthonormal, const orxonox::Vector3 &otherposition)
orxonox::Vector2 | orxonox::get2DViewdirection (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &myorthonormal, const orxonox::Vector3 &otherposition)
float | orxonox::getAngle (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &otherposition)
orxonox::Vector3 | orxonox::getPredictedPosition (const orxonox::Vector3 &myposition, float projectilespeed, const orxonox::Vector3 &targetposition, const orxonox::Vector3 &targetvelocity)
| Returns the predicted position I have to aim at, if I want to hit a moving target with a moving projectile.
unsigned long | orxonox::getUniqueNumber ()
template<typename T>
T | orxonox::interpolate (float time, const T &start, const T &end)
| Interpolates between two values for a time between 0 and 1.
template<typename T>
T | orxonox::interpolateSmooth (float time, const T &start, const T &end)
| Interpolates smoothly between two values for a time between 0 and 1. The function starts slowly, increases faster and stops slowly again.
template<typename T>
int | orxonox::mod (T x, int max)
| The modulo operation, enhanced to work properly with negative values.
std::ostream & | orxonox::operator<< (std::ostream &out, const orxonox::Degree &degree)
| Function for writing a Degree to a stream.
std::ostream & | orxonox::operator<< (std::ostream &out, const orxonox::Radian &radian)
| Function for writing a Radian to a stream.
std::istream & | orxonox::operator>> (std::istream &in, orxonox::Degree &degree)
| Function for reading a Degree from a stream.
std::istream & | orxonox::operator>> (std::istream &in, orxonox::Radian &radian)
| Function for reading a Radian from a stream.
float | orxonox::rnd (float min, float max)
| Returns a random number between min and almost max: min <= rnd < max.
float | orxonox::rnd (float max)
| Returns a random number between 0 and almost max: 0 <= rnd < max.
float | orxonox::rnd ()
| Returns a random number between 0 and almost 1: 0 <= rnd < 1.
float | orxonox::rndsgn ()
| Returns randomly 1 or -1 with equal probability.
template<typename T>
int | orxonox::round (T x)
| Rounds the value.
template<typename T>
T | orxonox::sgn (T x)
| Returns the sign of the given value.
template<typename T>
T | orxonox::square (T x)
| Returns the square value (x^2).
template<typename T>
T | orxonox::zeroise ()
template<>
bool | orxonox::zeroise< bool > ()
template<>
char | orxonox::zeroise< char > ()
template<>
double | orxonox::zeroise< double > ()
template<>
float | orxonox::zeroise< float > ()
template<>
int | orxonox::zeroise< int > ()
template<>
long | orxonox::zeroise< long > ()
template<>
long double | orxonox::zeroise< long double > ()
template<>
long long | orxonox::zeroise< long long > ()
template<>
orxonox::ColourValue | orxonox::zeroise< orxonox::ColourValue > ()
template<>
orxonox::Degree | orxonox::zeroise< orxonox::Degree > ()
template<>
orxonox::Quaternion | orxonox::zeroise< orxonox::Quaternion > ()
template<>
orxonox::Radian | orxonox::zeroise< orxonox::Radian > ()
template<>
orxonox::Vector2 | orxonox::zeroise< orxonox::Vector2 > ()
template<>
orxonox::Vector3 | orxonox::zeroise< orxonox::Vector3 > ()
template<>
orxonox::Vector4 | orxonox::zeroise< orxonox::Vector4 > ()
template<>
short | orxonox::zeroise< short > ()
template<>
std::string | orxonox::zeroise< std::string > ()
template<>
unsigned char | orxonox::zeroise< unsigned char > ()
template<>
unsigned int | orxonox::zeroise< unsigned int > ()
template<>
unsigned long | orxonox::zeroise< unsigned long > ()
template<>
unsigned long long | orxonox::zeroise< unsigned long long > ()
template<>
unsigned short | orxonox::zeroise< unsigned short > ()
template<>
void * | orxonox::zeroise< void * > ()

## Detailed Description

Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the orxonox namespace.