Namespaces | Functions | Variables

D:/SoftwareEntwicklung/C++/HLC/Tools/SoftPixelEngine/repository/sources/Base/spMathCore.hpp File Reference

#include "Base/spStandard.hpp"
#include <cmath>

Go to the source code of this file.

Namespaces

namespace  sp
 

!!


namespace  sp::math
 

This namespace contains all mathematical basic functions such as sine, cosine, distance calculations etc.


Functions

template<typename T >
sp::math::Abs (const T &Value)
 Returns the absolute value of the given parameter (5 -> 5 and -5 -> 5).
template<typename T >
sp::math::Max (const T &A, const T &B)
 Returns the largest value of the specified variables.
template<typename T >
sp::math::Min (const T &A, const T &B)
 Returns the smallest value of the specified variables.
template<typename T >
sp::math::Max (const T &A, const T &B, const T &C)
 Returns the largest value of the specified variables.
template<typename T >
sp::math::Min (const T &A, const T &B, const T &C)
 Returns the smallest value of the specified variables.
template<typename T >
void sp::math::Increase (T &Value, const T &PotNewValue)
 Increase the given value if the potentially new value is greater.
template<typename T >
void sp::math::Decrease (T &Value, const T &PotNewValue)
 Decrease the given value if the potentially new value is smaller.
template<typename T >
sp::math::MinMax (const T &Value, const T &Min, const T &Max)
 Returns the input value if it is inside the range "Min" and "Max. Otherwise the clamped range.
template<typename T >
void sp::math::Clamp (T &Value, const T &Min, const T &Max)
 Clamps the variable "Value" to the range "Min" and "Max".
template<typename T >
void sp::math::Swap (T &A, T &B)
 Exchanges (or rather swaps) the content of the specified variables A and B.
template<typename T >
sp::math::Sgn (const T &Value)
 Returns the signed value. Resulting values can only be 1, -1 or 0.
template<typename T >
sp::math::Round (const T &Value, s32 Precision)
 Returns the rounded value to the specified precision.
template<typename T >
sp::math::Pow2 (const T &Value)
 Returns the square of the specified value (Value * Value).
template<typename T >
sp::math::Sin (const T &Value)
 Returns the sine of the specified value as degree.
template<typename T >
sp::math::Cos (const T &Value)
 Returns the cosine of the specified value as degree.
template<typename T >
sp::math::Tan (const T &Value)
 Returns the tangent of the specified value as degree.
template<typename T >
sp::math::ASin (const T &Value)
 Returns the arcus sine of the specified value as degree.
template<typename T >
sp::math::ACos (const T &Value)
 Returns arcus cosine of the specified value as degree.
template<typename T >
sp::math::ATan (const T &Value)
 Returns arcus tangent of the specified value as degree.
template<typename T >
sp::math::Log (const T &Value, const T &Base=T(10))
 Returns the logarithm with the specified base.
template<typename T , typename I >
void sp::math::Lerp (T &Result, const T &From, const T &To, const I &Factor)
template<typename T , typename I >
sp::math::Lerp (const T &From, const T &To, const I &Factor)
 Overloaded function. For more information read the documentation of the first variant of this function.
template<typename T , typename I >
sp::math::LerpParabolic (const T &From, const T &To, const I &Factor)
 Parabolic interpolation. This is equivalent to "Lerp(From, To, Factor*Factor)".
template<typename T , typename I >
sp::math::LerpSin (const T &From, const T &To, const I &Factor)
 Sine interpolation. This is equivalent to "Lerp(From, To, Sin(Factor*90))".
s32 sp::math::Round (f32 Value)
 Rounds the float value to the nearest integer value (e.g. 3.4 to 3 and 3.5 to 4).
s32 sp::math::RoundPow2 (s32 Value)
 Rounds the given value to the nearest power of two value (e.g. 34 to 32 and 120 to 128).
bool sp::math::Equal (f32 A, f32 B, f32 Tolerance=ROUNDING_ERROR)
 Returns true if A and B are equal with the specified tolerance.
bool sp::math::Equal (s32 A, s32 B, s32 Tolerance=0)
bool sp::math::getBitR2L (u32 Integer, s32 Pos)
 Returns the bit inside the specified integer at the specified position (right to left).
void sp::math::setBitR2L (u32 &Integer, s32 Pos, bool Enable)
 Sets the bit inside the specified integer at the specified position (right to left).
bool sp::math::getBitL2R (u32 Integer, s32 Pos)
 Returns the bit inside the specified integer at the specified position (left to right).
void sp::math::setBitL2R (u32 &Integer, s32 Pos, bool Enable)
 Sets the bit inside the specified integer at the specified position (left to right).
bool sp::math::getBitR2L (u8 Integer, s32 Pos)
 Returns the bit inside the specified integer at the specified position (right to left).
void sp::math::setBitR2L (u8 &Integer, s32 Pos, bool Enable)
 Sets the bit inside the specified integer at the specified position (right to left).
bool sp::math::getBitL2R (u8 Integer, s32 Pos)
 Returns the bit inside the specified integer at the specified position (left to right).
void sp::math::setBitL2R (u8 &Integer, s32 Pos, bool Enable)
 Sets the bit inside the specified integer at the specified position (left to right).
template<typename T >
sp::math::getTriangleArea2D (const T &x1, const T &y1, const T &x2, const T &y2, const T &x3, const T &y3)
template<typename T >
sp::math::getBezierValue (const f32 t, const T &Pos1, const T &Pos2, const T &Radial1, const T &Radial2)
 Returns a bezier value used for bezier curves.
template<typename T >
sp::math::getBernsteinValue (const f32 t, const T Points[4])
 Returns a bernstein value used for bezier patch generation.
template<typename T >
sp::math::getGaussianValue (const T &X, const T &Mean, const T &StdDeviation)
 Returns a gaussian value used for gaussian blur.
template<typename T >
sp::math::getHaltonSequence (s32 Index, s32 Base)
template<typename T >
sp::math::ModularPow (T Base, T Exp, const T &Modulus)

Variables

const f32 sp::math::DEG = PI / 180.0f
const f32 sp::math::RAD = 180.0f / PI
const f64 sp::math::DEG64 = PI64 / 180.0
const f64 sp::math::RAD64 = 180.0 / PI64
const f64 sp::math::SQRT2 = sqrt(2.0)
const f32 sp::math::SQRT2F = sqrtf(2.0f)
const f64 sp::math::STDASPECT = 4.0 / 3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines