Orxonox  0.0.5 Codename: Arcturus
Classes | Namespaces | Functions | Variables
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 <cstdlib>
#include <random>
#include <type_traits>
#include <OgreMath.h>
#include <OgreVector2.h>
#include <OgreVector3.h>
#include <OgreVector4.h>
#include <OgreQuaternion.h>
#include <OgreColourValue.h>

Go to the source code of this file.

Classes

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

Namespaces

 orxonox
 Die Wagnis Klasse hat die folgenden Aufgaben:
 
 orxonox::math
 Often used numerical constants because C++ doesn't define any.
 

Functions

template<typename T >
constexpr T orxonox::clamp (T x, T min, T max)
 Keeps a value between a lower and an upper limit. More...
 
template<typename T >
constexpr T orxonox::cube (T x)
 Returns the cubed value (x^3). More...
 
int orxonox::determineMap3DZOrder (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &myorthonormal, const orxonox::Vector3 &otherposition, const float detectionlimit)
 A value between 0 and 10, in order how other object is in front or in back. More...
 
orxonox::Vector2 orxonox::get2DViewCoordinates (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &myorthonormal, const orxonox::Vector3 &otherposition)
 Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1). More...
 
orxonox::Vector2 orxonox::get2DViewdirection (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &myorthonormal, const orxonox::Vector3 &otherposition)
 Gets the 2D viewing direction (up/down, left/right) to the position of the other object. More...
 
orxonox::Vector2 orxonox::get3DProjection (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &myorthonormal, const orxonox::Vector3 &otherposition, const float mapangle, const float detectionlimit)
 Gets the 2D project vector for the 3D Radar . More...
 
float orxonox::getAngle (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &otherposition)
 Gets the angle between my viewing direction and the direction to the position of the other object. More...
 
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. More...
 
orxonox::Vector3 orxonox::getTransformedVector (const orxonox::Vector3 &totransform, const orxonox::Vector3 &newx, const orxonox::Vector3 &newy, const orxonox::Vector3 &newz)
 Gets the new vector after a coordinate transformation. More...
 
unsigned long orxonox::getUniqueNumber ()
 Returns a unique number. More...
 
template<typename T >
orxonox::interpolate (float time, const T &start, const T &end)
 Interpolates between two values for a time between 0 and 1. More...
 
template<typename T >
orxonox::interpolateSmooth (float time, const T &start, const T &end)
 Interpolates smoothly between two values for a time between 0 and 1. More...
 
bool orxonox::isObjectHigherThanShipOnMap (const orxonox::Vector3 &myposition, const orxonox::Vector3 &mydirection, const orxonox::Vector3 &myorthonormal, const orxonox::Vector3 &otherposition, const float mapangle)
 Gets if a object is over the x/z - plain on map. More...
 
template<typename T >
int orxonox::mod (T x, int max)
 The modulo operation, enhanced to work properly with negative values. More...
 
std::ostream & orxonox::operator<< (std::ostream &out, const orxonox::Radian &radian)
 Function for writing a Radian to a stream. More...
 
std::ostream & orxonox::operator<< (std::ostream &out, const orxonox::Degree &degree)
 Function for writing a Degree to a stream. More...
 
std::istream & orxonox::operator>> (std::istream &in, orxonox::Radian &radian)
 Function for reading a Radian from a stream. More...
 
std::istream & orxonox::operator>> (std::istream &in, orxonox::Degree &degree)
 Function for reading a Degree from a stream. More...
 
float orxonox::rnd (float min, float max)
 Returns a random number between min and almost max: min <= rnd < max. More...
 
float orxonox::rnd ()
 Returns a random number between 0 and almost 1: 0 <= rnd < 1. More...
 
float orxonox::rnd (float max)
 Returns a random number between 0 and almost max: 0 <= rnd < max. More...
 
void orxonox::rndseed (unsigned int seed)
 Seeds the random number generator used for the functions below. More...
 
float orxonox::rndsgn ()
 Returns randomly 1 or -1 with equal probability. More...
 
template<typename T >
constexpr T orxonox::sgn (T x)
 Returns the sign of the given value. More...
 
template<typename T >
constexpr T orxonox::square (T x)
 Returns the squared value (x^2). More...
 
template<typename T >
std::enable_if<!std::is_enum< T >::value, T >::type orxonox::zeroise ()
 Returns a "zero" value for the given type. More...
 
template<typename T >
std::enable_if< std::is_enum< T >::value, T >::type orxonox::zeroise ()
 Implementation for enum classes: uses the underlying type to create a zero value. More...
 
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<>
voidorxonox::zeroise< void * > ()
 

Variables

constexpr float orxonox::math::e = 2.718281269073486328125f
 e More...
 
constexpr float orxonox::math::pi = 3.1415927410125732421875f
 PI. More...
 
constexpr float orxonox::math::pi_2 = 1.57079637050628662109375f
 PI / 2. More...
 
constexpr float orxonox::math::pi_4 = 0.785398185253143310546875f
 PI / 4. More...
 
constexpr float orxonox::math::sqrt2 = 1.41421353816986083984375f
 sqrt(2) More...
 
constexpr float orxonox::math::sqrt2_2 = 0.707106769084930419921875f
 sqrt(2) / 2 More...
 
constexpr float orxonox::math::twoPi = 6.283185482025146484375f
 PI * 2. More...
 

Detailed Description

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