Namespace: DuMath

DuMath

Math related methods

Members

static,readonlyDuMath.Locationint

Enum for locations.
Properties:
Name Type Default Description
TOP int 1
TOP_RIGHT int 2
RIGHT int 3
BOTTOM_RIGHT int 4
BOTTOM int 5
BOTTOM_LEFT int 6
LEFT int 7
TOP_LEFT int 8
CENTER int 0

Methods

staticDuMath.average(values){float}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5770
Calculates the average value in a list
Name Type Description
values Number | Array.<Number> values
Returns:
Type Description
float The average value

staticDuMath.bounds(values){Array.<float>}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6021
Gets the bounds of the values
Name Type Description
values Array.<Array.<Number>> A list of values
Returns:
Type Description
Array.<float> The bounds, for N dimensions: [min1, min2, ..., minN, max1, max2, ..., maxN]

staticDuMath.clamp(values, min, max){Number|Array.<Number>}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5796
Clamps the value
Name Type Default Description
values Number | Array.<Number> values
min Number 0 optional The minimum value
max Number 1 optional The maximum value
Returns:
Type Description
Number | Array.<Number> The clamped values

staticDuMath.equals(value1, value2, floatPrecision){boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5725
Compares two numbers
Name Type Default Description
value1 Number | Array.<Number> The first value
value2 Number | Array.<Number> The second value
floatPrecision int -1 optional The precision for (float) number comparison, number of decimals. Set to -1 to not use.
Returns:
Type Description
boolean true if the two values are equal

staticDuMath.gaussian(value, min, max, center, fwhm){Number}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5890
The gaussian function
Name Type Default Description
value Number The variable
min Number 0 optional The minimum return value
max Number 1 optional The maximum return value
center Number 0 optional The center of the peak
fwhm Number 1 optional The full width at half maximum of the curve
Returns:
Type Description
Number The result

staticDuMath.gaussRandom(min, max, bounded){int}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5681
Generates a random integer between minimum and maximum.
The results are distributed along a gaussian (bell) curve.
Note that a few (< 10%) values may be outside of the range. Set the bounded to true to avoid that.
Name Type Default Description
min int 0 optional The minimum value
max int 1 optional The maximum value
bounded Bool false optional When this is false, a few values may be outside the range. Set it to true to make sure all values are between min and max.
Returns:
Type Description
int The randomly generated integer

staticDuMath.inverseGaussian(v, min, max, center, fwhm){Array.<Number>}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5928
The inverse gaussian function
Name Type Default Description
v Number The variable
min Number 0 optional The minimum return value of the corresponding gaussian function
max Number 1 optional The maximum return value of the corresponding gaussian function
center Number 0 optional The center of the peak of the corresponding gaussian function
fwhm Number 1 optional The full width at half maximum of the curve of the corresponding gaussian function
Returns:
Type Description
Array.<Number> The two possible results, the lower is the first in the list. If both are the same, it is the maximum

staticDuMath.inverseLogistic(v, midValue, min, max, rate){Number}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5870
The inverse logistic function (inverse sigmoid)
Name Type Default Description
v Number The variable
midValue Number 0 optional The midpoint value, at which the function returns max/2 in the original logistic function
min Number 0 optional The minimum return value of the original logistic function
max Number 1 optional The maximum return value of the original logistic function
rate Number 1 optional The logistic growth rate or steepness of the original logistic function
Returns:
Type Description
Number The result

staticDuMath.inverseReversedGaussian(value, min, max, center, fwhm){Array.<Number>}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5953
The inverse of the reversed gaussian function
Name Type Default Description
value Number The variable
min Number 0 optional The minimum return value of the corresponding gaussian function
max Number 1 optional The maximum return value of the corresponding gaussian function
center Number 0 optional The center of the peak of the corresponding gaussian function
fwhm Number 1 optional The full width at half maximum of the curve of the corresponding gaussian function
Returns:
Type Description
Array.<Number> The two possible results, the lower is the first in the list. If both are the same, it is the maximum

staticDuMath.isExtremePoint(previousValue, point, nextValue, precision){Boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6047
Checks if the direction changes (if the point is at an extreme value). If the values have multiple dimensions, checks each axis individually.
Name Type Default Description
previousValue Number | Array.<Number> The value just before the point.
point Number | Array.<Number> The point to check.
nextValue Number | Array.<Number> The value just after the point.
precision int 1 optional The precision for floating point comparisons; number of decimals.
Returns:
Type Description
Boolean

staticDuMath.isInflexionPoint(previousVelocity, pointVelocity, nextVelocity){Boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6077
Checks if the point is an inflexion point.
Name Type Description
previousVelocity Number | Array.<Number> The derivative (speed) of a point just before the point.
pointVelocity Number | Array.<Number> The derivative (speed) at the point to check.
nextVelocity Number | Array.<Number> The derivative (speed) of a point just after the point.
Returns:
Type Description
Boolean

staticDuMath.isInside(point, bounds){Boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5993
Checks if a point is located inside given bounds
Name Type Description
point Array.<float> The point
bounds Array.<float> The bounds. The number of bounds must be at least twice the number of dimensions, in this order : [a1, a2, ..., x1,x2,y1,y2,z1,z2]
Returns:
Type Description
Boolean true if the point is inside the bounds

staticDuMath.isLocationBottom(location){boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5644
Checks if the given location is on the bottom side
Name Type Description
location DuMath.Location The location
Returns:
Type Description
boolean

staticDuMath.isLocationHCenter(location){boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5596
Checks if the given location is on the center on the horizontal axis
Name Type Description
location DuMath.Location The location
Returns:
Type Description
boolean

staticDuMath.isLocationLeft(location){boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5608
Checks if the given location is on the left side
Name Type Description
location DuMath.Location The location
Returns:
Type Description
boolean

staticDuMath.isLocationRight(location){boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5584
Checks if the given location is on the right side
Name Type Description
location DuMath.Location The location
Returns:
Type Description
boolean

staticDuMath.isLocationTop(location){boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5620
Checks if the given location is on the top side
Name Type Description
location DuMath.Location The location
Returns:
Type Description
boolean

staticDuMath.isLocationVCenter(location){boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5632
Checks if the given location is on the center on the vertical axis
Name Type Description
location DuMath.Location The location
Returns:
Type Description
boolean

staticDuMath.length(value1, value2){float}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5703
Measures the vector length between two points
Name Type Description
value1 Array.<int> The first value
value2 Array.<int> The second value
Returns:
Type Description
float The length

staticDuMath.linear(value, min, max, targetMin, targetMax, clamp){Number}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5968
The linear function
Name Type Default Description
value Number The variable
min Number 0 optional The minimum input value
max Number 1 optional The maximum input value
targetMin Number 0 optional The minimum output value
targetMax Number 1 optional The maximum output value
clamp Boolean false optional Whether to clamp the output value to the target or not.
Returns:
Type Description
Number

staticDuMath.log10(w){float}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5760
Calculates the log10 of a number
Name Type Description
w float The number
Returns:
Type Description
float The result of log10(x)
i.e. Math.log(x)/Math.LN10

staticDuMath.logistic(value, midValue, min, max, rate){Number}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5851
The logistic function (sigmoid)
Name Type Default Description
value Number The value
midValue Number 0 optional The midpoint value, at which the function returns max/2
min Number 0 optional The minimum return value
max Number 1 optional The maximum return value
rate Number 1 optional The logistic growth rate or steepness of the function
Returns:
Type Description
Number The result in the range [min, max] (excluding min and max)

staticDuMath.mean()

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5786
Alias for DuMath.average.

staticDuMath.random(min, max){int}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5658
Generates a random integer between minimum and maximum
Name Type Default Description
min int 0 optional The minimum value
max int 1 optional The maximum value
Returns:
Type Description
int The randomly generated integer

staticDuMath.reversedGaussian(value, min, max, center, fwhm){Number}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5914
A "reversed" gaussian function, growing faster with low value
Name Type Default Description
value Number The variable
min Number 0 optional The minimum return value
max Number 1 optional The maximum return value
center Number 0 optional The center of the peak
fwhm Number 1 optional The full width at half maximum of the curve
Returns:
Type Description
Number The result

staticDuMath.sign(num){int}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6010
Checks the sign of a number
Name Type Description
num Number The number to check
Returns:
Type Description
int 1 if num is positive, -1 if negative, 0 in other cases (0, NaN...)

staticDuMath.toDegrees(value){float}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5838
Converts the number from radians to degrees
Name Type Description
value number the value
Returns:
Type Description
float The value in degrees

staticDuMath.toRadians(value){float}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 5828
Converts the number from degrees to radians
Name Type Description
value number the value
Returns:
Type Description
float The value in radians