Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
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.
static float asin (float n)
 Arc sine of n using degrees.
static float atan (float n)
 Arc tangense of n using degrees.
static float atan2 (float y, float x)
 Tangense of y/x using degrees.
static float cos (float x)
 Cosine of value x using degrees.
static float cosh (float x)
 Hyperbolic cosine of value x using degrees.
static float sin (float x)
 Sinus using degrees.
static float sinh (float x)
 Hyperbolic sinus using degrees.
static float tan (float x)
 Tangense using degrees.
static float tanh (float x)
 Hhyperbolic tangense using degrees.
Helper methods.
static float degToRad (float degrees)
 Convert degrees to radians.
static float radToDeg (float radians)
 Converst radians to degrees.
static float linearStep (float x, float lower, float upper)
 Linear step function clamping normalized x linearly to the range from 0 to 1.
static float linearStep (float x, float lower, float upper, float mapLower, float mapUpper)
 Linear step function clamping normalized x linearly to a new range.
static float smoothStep (float x, float lower, float upper)
 GLSL type smooth step into the range from 0 to 1.
static float smoothStep (float x, float lower, float upper, float mapLower, float mapUpper)
 GLSL type smooth step into a new rage.
static float normalize (float x, float lower, float upper)
 Normalize value into a range using wrapping around at the limits.
static float normalize (float x, float upper)
 Normalize value into a range starting at 0 using wrapping around at the limits.
static float mix (float a, float b, float blend)
 GLSL type mix.
static float random ()
 Random float between 0 and 1 inclusive.
static int random (int lower, int upper)
 Random integer from range.
static float random (float lower, float upper)
 Random float from range.
static bool probability (float threshold)
 Random value in the range from 0 to 1 inclusive is less than or equal threshold.

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()

float Dragengine.DEMath.acos ( float n)
static

Arc cosine of n using degrees.

References acos().

Referenced by acos().

◆ asin()

float Dragengine.DEMath.asin ( float n)
static

Arc sine of n using degrees.

References asin().

Referenced by asin().

◆ atan()

float Dragengine.DEMath.atan ( float n)
static

Arc tangense of n using degrees.

Referenced by atan2().

◆ atan2()

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

Tangense of y/x using degrees.

References atan().

Referenced by cosh().

◆ cos()

float Dragengine.DEMath.cos ( float x)
static

Cosine of value x using degrees.

Referenced by sin().

◆ cosh()

float Dragengine.DEMath.cosh ( float x)
static

Hyperbolic cosine of value x using degrees.

References atan2().

Referenced by tan().

◆ degToRad()

float Dragengine.DEMath.degToRad ( float degrees)
static

Convert degrees to radians.

References sinh().

Referenced by normalize().

◆ linearStep() [1/2]

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.

Referenced by random(), and random().

◆ linearStep() [2/2]

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.

References tanh().

◆ mix()

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

GLSL type mix.

Referenced by probability().

◆ normalize() [1/2]

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

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

References degToRad().

Referenced by probability().

◆ normalize() [2/2]

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).

References radToDeg().

◆ probability()

bool Dragengine.DEMath.probability ( float threshold)
static

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

References mix(), normalize(), probability(), random(), and smoothStep().

Referenced by probability().

◆ radToDeg()

float Dragengine.DEMath.radToDeg ( float radians)
static

Converst radians to degrees.

References tan().

Referenced by normalize().

◆ random() [1/3]

float Dragengine.DEMath.random ( )
static

Random float between 0 and 1 inclusive.

References linearStep().

Referenced by probability().

◆ random() [2/3]

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

Random float from range.

◆ random() [3/3]

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

Random integer from range.

References linearStep().

◆ sin()

float Dragengine.DEMath.sin ( float x)
static

Sinus using degrees.

References cos().

Referenced by tanh().

◆ sinh()

float Dragengine.DEMath.sinh ( float x)
static

Hyperbolic sinus using degrees.

Referenced by degToRad().

◆ smoothStep() [1/2]

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

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

Referenced by probability().

◆ smoothStep() [2/2]

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

GLSL type smooth step into a new rage.

◆ tan()

float Dragengine.DEMath.tan ( float x)
static

Tangense using degrees.

References cosh().

Referenced by radToDeg().

◆ tanh()

float Dragengine.DEMath.tanh ( float x)
static

Hhyperbolic tangense using degrees.

References sin().

Referenced by linearStep().


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