VR-Link C# API Documentation
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros Pages
List of all members | Static Public Member Functions | Public Attributes
makVrl.MathHelper Class Reference

Contains common mathematical functions and constants. More...

+ Collaboration diagram for makVrl.MathHelper:

Static Public Member Functions

static long NextPowerOfTwo (long n)
 Returns the next power of two that is larger than the specified number.
static int NextPowerOfTwo (int n)
 Returns the next power of two that is larger than the specified number.
static float NextPowerOfTwo (float n)
 Returns the next power of two that is larger than the specified number.
static double NextPowerOfTwo (double n)
 Returns the next power of two that is larger than the specified number.
static long Factorial (int n)
 Calculates the factorial of a given natural number.
static long BinomialCoefficient (int n, int k)
 Calculates the binomial coefficient n above k .
static float InverseSqrtFast (float x)
 Returns an approximation of the inverse square root of left number.
static double InverseSqrtFast (double x)
 Returns an approximation of the inverse square root of left number.
static float DegreesToRadians (float degrees)
 Convert degrees to radians
static float RadiansToDegrees (float radians)
 Convert radians to degrees
static double DegreesToRadians (double degrees)
 Convert degrees to radians
static double RadiansToDegrees (double radians)
 Convert radians to degrees
static void Swap (ref double a, ref double b)
 Swaps two double values.
static void Swap (ref float a, ref float b)
 Swaps two float values.
static double ModPerZero (double x, double per)
static double ModPerLo (double x, double min, double max)
static double ModPerHi (double x, double min, double max)
static Vector3f directedRotRateFromVec (Vector3f pqr, double theta)

Public Attributes

const float Pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930382f
 Defines the value of Pi as a System.Single.
const float PiOver2 = Pi / 2
 Defines the value of Pi divided by two as a System.Single.
const float PiOver3 = Pi / 3
 Defines the value of Pi divided by three as a System.Single.
const float PiOver4 = Pi / 4
 Definesthe value of Pi divided by four as a System.Single.
const float PiOver6 = Pi / 6
 Defines the value of Pi divided by six as a System.Single.
const float TwoPi = 2 * Pi
 Defines the value of Pi multiplied by two as a System.Single.
const float ThreePiOver2 = 3 * Pi / 2
 Defines the value of Pi multiplied by 3 and divided by two as a System.Single.
const float E = 2.71828182845904523536f
 Defines the value of E as a System.Single.
const float Log10E = 0.434294482f
 Defines the base-10 logarithm of E.
const float Log2E = 1.442695041f
 Defines the base-2 logarithm of E.

Detailed Description

Contains common mathematical functions and constants.

Member Function Documentation

static long makVrl.MathHelper.BinomialCoefficient ( int  n,
int  k 
)
inlinestatic

Calculates the binomial coefficient n above k .

Parameters
nThe n.
kThe k.
Returns
n! / (k! * (n - k)!)

References makVrl.MathHelper.Factorial().

static float makVrl.MathHelper.DegreesToRadians ( float  degrees)
inlinestatic

Convert degrees to radians

Parameters
degreesAn angle in degrees
Returns
The angle expressed in radians

Referenced by makVrl.UtmReferencePoint.geod2utm(), makVrl.TopographicCoord.getTaitBryan(), f18.VehicleSim.init(), talk_Sharp.talk.Main(), f18.f18.Main(), f18.VehicleSim.simTick(), and makVrl.UtmReferencePoint.utm2geod().

static double makVrl.MathHelper.DegreesToRadians ( double  degrees)
inlinestatic

Convert degrees to radians

Parameters
degreesAn angle in degrees
Returns
The angle expressed in radians
static Vector3f makVrl.MathHelper.directedRotRateFromVec ( Vector3f  pqr,
double  theta 
)
inlinestatic
static long makVrl.MathHelper.Factorial ( int  n)
inlinestatic

Calculates the factorial of a given natural number.

Parameters
nThe number.
Returns
n!

Referenced by makVrl.MathHelper.BinomialCoefficient().

static float makVrl.MathHelper.InverseSqrtFast ( float  x)
inlinestatic

Returns an approximation of the inverse square root of left number.

Parameters
xA number.
Returns
An approximation of the inverse square root of the specified number, with an upper error bound of 0.001

This is an improved implementation of the the method known as Carmack's inverse square root which is found in the Quake III source code. This implementation comes from http://www.codemaestro.com/reviews/review00000105.html. For the history of this method, see http://www.beyond3d.com/content/articles/8/

Referenced by makVrl.MathHelper.InverseSqrtFast(), makVrl.Vector3f.NormalizeFast(), makVrl.Vector3d.NormalizeFast(), makVrl.Vector2.NormalizeFast(), makVrl.Vector4d.NormalizeFast(), makVrl.Vector4.NormalizeFast(), and makVrl.Vector2d.NormalizeFast().

static double makVrl.MathHelper.InverseSqrtFast ( double  x)
inlinestatic

Returns an approximation of the inverse square root of left number.

Parameters
xA number.
Returns
An approximation of the inverse square root of the specified number, with an upper error bound of 0.001

This is an improved implementation of the the method known as Carmack's inverse square root which is found in the Quake III source code. This implementation comes from http://www.codemaestro.com/reviews/review00000105.html. For the history of this method, see http://www.beyond3d.com/content/articles/8/

References makVrl.MathHelper.InverseSqrtFast().

static double makVrl.MathHelper.ModPerHi ( double  x,
double  min,
double  max 
)
inlinestatic
static double makVrl.MathHelper.ModPerLo ( double  x,
double  min,
double  max 
)
inlinestatic
static double makVrl.MathHelper.ModPerZero ( double  x,
double  per 
)
inlinestatic

Referenced by f18.VehicleSim.simTick().

static long makVrl.MathHelper.NextPowerOfTwo ( long  n)
inlinestatic

Returns the next power of two that is larger than the specified number.

Parameters
nThe specified number.
Returns
The next power of two.
static int makVrl.MathHelper.NextPowerOfTwo ( int  n)
inlinestatic

Returns the next power of two that is larger than the specified number.

Parameters
nThe specified number.
Returns
The next power of two.
static float makVrl.MathHelper.NextPowerOfTwo ( float  n)
inlinestatic

Returns the next power of two that is larger than the specified number.

Parameters
nThe specified number.
Returns
The next power of two.
static double makVrl.MathHelper.NextPowerOfTwo ( double  n)
inlinestatic

Returns the next power of two that is larger than the specified number.

Parameters
nThe specified number.
Returns
The next power of two.
static float makVrl.MathHelper.RadiansToDegrees ( float  radians)
inlinestatic

Convert radians to degrees

Parameters
radiansAn angle in radians
Returns
The angle expressed in degrees

Referenced by makVrl.UtmReferencePoint.geod2utm(), and makVrl.UtmReferencePoint.utm2geod().

static double makVrl.MathHelper.RadiansToDegrees ( double  radians)
inlinestatic

Convert radians to degrees

Parameters
radiansAn angle in radians
Returns
The angle expressed in degrees
static void makVrl.MathHelper.Swap ( ref double  a,
ref double  b 
)
inlinestatic

Swaps two double values.

Parameters
aThe first value.
bThe second value.
static void makVrl.MathHelper.Swap ( ref float  a,
ref float  b 
)
inlinestatic

Swaps two float values.

Parameters
aThe first value.
bThe second value.

Member Data Documentation

const float makVrl.MathHelper.E = 2.71828182845904523536f

Defines the value of E as a System.Single.

const float makVrl.MathHelper.Log10E = 0.434294482f

Defines the base-10 logarithm of E.

const float makVrl.MathHelper.Log2E = 1.442695041f

Defines the base-2 logarithm of E.

const float makVrl.MathHelper.Pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930382f

Defines the value of Pi as a System.Single.

const float makVrl.MathHelper.PiOver2 = Pi / 2

Defines the value of Pi divided by two as a System.Single.

Referenced by makVrl.ReferenceEllipsoid.rad_to_geo().

const float makVrl.MathHelper.PiOver3 = Pi / 3

Defines the value of Pi divided by three as a System.Single.

const float makVrl.MathHelper.PiOver4 = Pi / 4

Definesthe value of Pi divided by four as a System.Single.

const float makVrl.MathHelper.PiOver6 = Pi / 6

Defines the value of Pi divided by six as a System.Single.

const float makVrl.MathHelper.ThreePiOver2 = 3 * Pi / 2

Defines the value of Pi multiplied by 3 and divided by two as a System.Single.

const float makVrl.MathHelper.TwoPi = 2 * Pi

Defines the value of Pi multiplied by two as a System.Single.


The documentation for this class was generated from the following file:

Document ID: Generated on Fri Dec 2 02:42:08 EST 2016 from SVN revision 171416
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)