Drag[en]gine Script Module DragonScript  1.23
Dragengine.DEMath Class Reference

Extended math support. More...

Inheritance diagram for Dragengine.DEMath:

Static Public Member Functions

Degrees based replacements for methods from Math.
static float acos (float n)
 Arc cosine of n using degrees. More...
 
static float asin (float n)
 Arc sine of n using degrees. More...
 
static float atan (float n)
 Arc tangense of n using degrees. More...
 
static float atan2 (float y, float x)
 Tangense of y/x using degrees. More...
 
static float cos (float x)
 Cosine of value x using degrees. More...
 
static float cosh (float x)
 Hyperbolic cosine of value x using degrees. More...
 
static float sin (float x)
 Sinus using degrees. More...
 
static float sinh (float x)
 Hyperbolic sinus using degrees. More...
 
static float tan (float x)
 Tangense using degrees. More...
 
static float tanh (float x)
 Hhyperbolic tangense using degrees. More...
 
Helper methods.
static float degToRad (float degrees)
 Convert degrees to radians. More...
 
static float radToDeg (float radians)
 Converst radians to degrees. More...
 
static float linearStep (float x, float lower, float upper)
 Linear step function clamping normalized x linearly to the range from 0 to 1. More...
 
static float linearStep (float x, float lower, float upper, float mapLower, float mapUpper)
 Linear step function clamping normalized x linearly to a new range. More...
 
static float smoothStep (float x, float lower, float upper)
 GLSL type smooth step into the range from 0 to 1. More...
 
static float smoothStep (float x, float lower, float upper, float mapLower, float mapUpper)
 GLSL type smooth step into a new rage. More...
 
static float normalize (float x, float lower, float upper)
 Normalize value into a range using wrapping around at the limits. More...
 
static float normalize (float x, float upper)
 Normalize value into a range starting at 0 using wrapping around at the limits. More...
 
static float mix (float a, float b, float blend)
 GLSL type mix. More...
 
static float random ()
 Random float between 0 and 1 inclusive. More...
 
static int random (int lower, int upper)
 Random integer from range. More...
 
static float random (float lower, float upper)
 Random float from range. More...
 
static bool probability (float threshold)
 Random value in the range from 0 to 1 inclusive is less than or equal threshold. More...
 

Detailed Description

Extended math support.

Extends Math from Math package from base DragonScript.

Overwrites trigonometric methods to operate on degrees instead of radians. To use radians version use Math directly.

Furthermore adds some additional methods useful for game development.

This is a native class. This class is for static use only and can not instantiated but subclassed.

Member Function Documentation

◆ acos()

static float Dragengine.DEMath.acos ( float  n)
static

Arc cosine of n using degrees.

◆ asin()

static float Dragengine.DEMath.asin ( float  n)
static

Arc sine of n using degrees.

◆ atan()

static float Dragengine.DEMath.atan ( float  n)
static

Arc tangense of n using degrees.

◆ atan2()

static float Dragengine.DEMath.atan2 ( float  y,
float  x 
)
static

Tangense of y/x using degrees.

◆ cos()

static float Dragengine.DEMath.cos ( float  x)
static

Cosine of value x using degrees.

◆ cosh()

static float Dragengine.DEMath.cosh ( float  x)
static

Hyperbolic cosine of value x using degrees.

◆ degToRad()

static float Dragengine.DEMath.degToRad ( float  degrees)
static

Convert degrees to radians.

◆ linearStep() [1/2]

static float Dragengine.DEMath.linearStep ( float  x,
float  lower,
float  upper 
)
static

Linear step function clamping normalized x linearly to the range from 0 to 1.

◆ linearStep() [2/2]

static float Dragengine.DEMath.linearStep ( float  x,
float  lower,
float  upper,
float  mapLower,
float  mapUpper 
)
static

Linear step function clamping normalized x linearly to a new range.

◆ mix()

static float Dragengine.DEMath.mix ( float  a,
float  b,
float  blend 
)
static

GLSL type mix.

◆ normalize() [1/2]

static float Dragengine.DEMath.normalize ( float  x,
float  lower,
float  upper 
)
static

Normalize value into a range using wrapping around at the limits.

◆ normalize() [2/2]

static float Dragengine.DEMath.normalize ( float  x,
float  upper 
)
static

Normalize value into a range starting at 0 using wrapping around at the limits.

Same as normalize(x, 0.0, upper).

◆ probability()

static bool Dragengine.DEMath.probability ( float  threshold)
static

Random value in the range from 0 to 1 inclusive is less than or equal threshold.

◆ radToDeg()

static float Dragengine.DEMath.radToDeg ( float  radians)
static

Converst radians to degrees.

◆ random() [1/3]

static float Dragengine.DEMath.random ( )
static

Random float between 0 and 1 inclusive.

◆ random() [2/3]

static float Dragengine.DEMath.random ( float  lower,
float  upper 
)
static

Random float from range.

◆ random() [3/3]

static int Dragengine.DEMath.random ( int  lower,
int  upper 
)
static

Random integer from range.

◆ sin()

static float Dragengine.DEMath.sin ( float  x)
static

Sinus using degrees.

◆ sinh()

static float Dragengine.DEMath.sinh ( float  x)
static

Hyperbolic sinus using degrees.

◆ smoothStep() [1/2]

static float Dragengine.DEMath.smoothStep ( float  x,
float  lower,
float  upper 
)
static

GLSL type smooth step into the range from 0 to 1.

◆ smoothStep() [2/2]

static float Dragengine.DEMath.smoothStep ( float  x,
float  lower,
float  upper,
float  mapLower,
float  mapUpper 
)
static

GLSL type smooth step into a new rage.

◆ tan()

static float Dragengine.DEMath.tan ( float  x)
static

Tangense using degrees.

◆ tanh()

static float Dragengine.DEMath.tanh ( float  x)
static

Hhyperbolic tangense using degrees.


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