Namespace

DuMath

DuMath

Members

int

# static readonly Location

Enum for locations.
Properties:
Name Type Description
TOP int
TOP_RIGHT int
RIGHT int
BOTTOM_RIGHT int
BOTTOM int
BOTTOM_LEFT int
LEFT int
TOP_LEFT int
CENTER int

View Source DuAEF_DuGR_api.jsxinc, line 6314

Methods

# static average(values) → {float}

Calculates the average value in a list
Parameters:
Name Type Description
values Number | Array.<Number> values

View Source DuAEF_DuGR_api.jsxinc, line 6517

The average value
float

# static bounds(values) → {Array.<float>}

Gets the bounds of the values
Parameters:
Name Type Description
values Array.<Array.<Number>> A list of values

View Source DuAEF_DuGR_api.jsxinc, line 6768

The bounds, for N dimensions: [min1, min2, ..., minN, max1, max2, ..., maxN]
Array.<float>

# static clamp(values, minopt, maxopt) → {Number|Array.<Number>}

Clamps the value
Parameters:
Name Type Attributes Default Description
values Number | Array.<Number> values
min Number <optional>
0 The minimum value
max Number <optional>
1 The maximum value

View Source DuAEF_DuGR_api.jsxinc, line 6543

The clamped values
Number | Array.<Number>

# static equals(value1, value2, floatPrecisionopt) → {boolean}

Compares two numbers
Parameters:
Name Type Attributes Default Description
value1 Number | Array.<Number> The first value
value2 Number | Array.<Number> The second value
floatPrecision int <optional>
-1 The precision for (float) number comparison, number of decimals. Set to -1 to not use.

View Source DuAEF_DuGR_api.jsxinc, line 6472

true if the two values are equal
boolean

# static gaussian(value, minopt, maxopt, centeropt, fwhmopt) → {Number}

The gaussian function
Parameters:
Name Type Attributes Default Description
value Number The variable
min Number <optional>
0 The minimum return value
max Number <optional>
1 The maximum return value
center Number <optional>
0 The center of the peak
fwhm Number <optional>
1 The full width at half maximum of the curve

View Source DuAEF_DuGR_api.jsxinc, line 6637

The result
Number

# static gaussRandom(minopt, maxopt, boundedopt) → {int}

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.
Parameters:
Name Type Attributes Default Description
min int <optional>
0 The minimum value
max int <optional>
1 The maximum value
bounded Bool <optional>
false 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.

View Source DuAEF_DuGR_api.jsxinc, line 6428

The randomly generated integer
int

# static inverseGaussian(v, minopt, maxopt, centeropt, fwhmopt) → {Array.<Number>}

The inverse gaussian function
Parameters:
Name Type Attributes Default Description
v Number The variable
min Number <optional>
0 The minimum return value of the corresponding gaussian function
max Number <optional>
1 The maximum return value of the corresponding gaussian function
center Number <optional>
0 The center of the peak of the corresponding gaussian function
fwhm Number <optional>
1 The full width at half maximum of the curve of the corresponding gaussian function

View Source DuAEF_DuGR_api.jsxinc, line 6675

The two possible results, the lower is the first in the list. If both are the same, it is the maximum
Array.<Number>

# static inverseLogistic(v, midValueopt, minopt, maxopt, rateopt) → {Number}

The inverse logistic function (inverse sigmoid)
Parameters:
Name Type Attributes Default Description
v Number The variable
midValue Number <optional>
0 The midpoint value, at which the function returns max/2 in the original logistic function
min Number <optional>
0 The minimum return value of the original logistic function
max Number <optional>
1 The maximum return value of the original logistic function
rate Number <optional>
1 The logistic growth rate or steepness of the original logistic function

View Source DuAEF_DuGR_api.jsxinc, line 6617

The result
Number

# static inverseReversedGaussian(value, minopt, maxopt, centeropt, fwhmopt) → {Array.<Number>}

The inverse of the reversed gaussian function
Parameters:
Name Type Attributes Default Description
value Number The variable
min Number <optional>
0 The minimum return value of the corresponding gaussian function
max Number <optional>
1 The maximum return value of the corresponding gaussian function
center Number <optional>
0 The center of the peak of the corresponding gaussian function
fwhm Number <optional>
1 The full width at half maximum of the curve of the corresponding gaussian function

View Source DuAEF_DuGR_api.jsxinc, line 6700

The two possible results, the lower is the first in the list. If both are the same, it is the maximum
Array.<Number>

# static isExtremePoint(previousValue, point, nextValue, precisionopt) → {Boolean}

Checks if the direction changes (if the point is at an extreme value). If the values have multiple dimensions, checks each axis individually.
Parameters:
Name Type Attributes 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 <optional>
1 The precision for floating point comparisons; number of decimals.

View Source DuAEF_DuGR_api.jsxinc, line 6794

Boolean

# static isInflexionPoint(previousVelocity, pointVelocity, nextVelocity) → {Boolean}

Checks if the point is an inflexion point.
Parameters:
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.

View Source DuAEF_DuGR_api.jsxinc, line 6824

Boolean

# static isInside(point, bounds) → {Boolean}

Checks if a point is located inside given bounds
Parameters:
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]

View Source DuAEF_DuGR_api.jsxinc, line 6740

true if the point is inside the bounds
Boolean

# static isLocationBottom(location) → {boolean}

Checks if the given location is on the bottom side
Parameters:
Name Type Description
location DuMath.Location The location

View Source DuAEF_DuGR_api.jsxinc, line 6391

boolean

# static isLocationHCenter(location) → {boolean}

Checks if the given location is on the center on the horizontal axis
Parameters:
Name Type Description
location DuMath.Location The location

View Source DuAEF_DuGR_api.jsxinc, line 6343

boolean

# static isLocationLeft(location) → {boolean}

Checks if the given location is on the left side
Parameters:
Name Type Description
location DuMath.Location The location

View Source DuAEF_DuGR_api.jsxinc, line 6355

boolean

# static isLocationRight(location) → {boolean}

Checks if the given location is on the right side
Parameters:
Name Type Description
location DuMath.Location The location

View Source DuAEF_DuGR_api.jsxinc, line 6331

boolean

# static isLocationTop(location) → {boolean}

Checks if the given location is on the top side
Parameters:
Name Type Description
location DuMath.Location The location

View Source DuAEF_DuGR_api.jsxinc, line 6367

boolean

# static isLocationVCenter(location) → {boolean}

Checks if the given location is on the center on the vertical axis
Parameters:
Name Type Description
location DuMath.Location The location

View Source DuAEF_DuGR_api.jsxinc, line 6379

boolean

# static length(value1, value2) → {float}

Measures the vector length between two points
Parameters:
Name Type Description
value1 Array.<int> The first value
value2 Array.<int> The second value

View Source DuAEF_DuGR_api.jsxinc, line 6450

The length
float

# static linear(value, minopt, maxopt, targetMinopt, targetMaxopt, clampopt) → {Number}

The linear function
Parameters:
Name Type Attributes Default Description
value Number The variable
min Number <optional>
0 The minimum input value
max Number <optional>
1 The maximum input value
targetMin Number <optional>
0 The minimum output value
targetMax Number <optional>
1 The maximum output value
clamp Boolean <optional>
false Whether to clamp the output value to the target or not.

View Source DuAEF_DuGR_api.jsxinc, line 6715

Number

# static log10(w) → {float}

Calculates the log10 of a number
Parameters:
Name Type Description
w float The number

View Source DuAEF_DuGR_api.jsxinc, line 6507

The result of log10(x)
i.e. Math.log(x)/Math.LN10
float

# static logistic(value, midValueopt, minopt, maxopt, rateopt) → {Number}

The logistic function (sigmoid)
Parameters:
Name Type Attributes Default Description
value Number The value
midValue Number <optional>
0 The midpoint value, at which the function returns max/2
min Number <optional>
0 The minimum return value
max Number <optional>
1 The maximum return value
rate Number <optional>
1 The logistic growth rate or steepness of the function

View Source DuAEF_DuGR_api.jsxinc, line 6598

The result in the range [min, max] (excluding min and max)
Number

# static random(minopt, maxopt) → {int}

Generates a random integer between minimum and maximum
Parameters:
Name Type Attributes Default Description
min int <optional>
0 The minimum value
max int <optional>
1 The maximum value

View Source DuAEF_DuGR_api.jsxinc, line 6405

The randomly generated integer
int

# static reversedGaussian(value, minopt, maxopt, centeropt, fwhmopt) → {Number}

A "reversed" gaussian function, growing faster with low value
Parameters:
Name Type Attributes Default Description
value Number The variable
min Number <optional>
0 The minimum return value
max Number <optional>
1 The maximum return value
center Number <optional>
0 The center of the peak
fwhm Number <optional>
1 The full width at half maximum of the curve

View Source DuAEF_DuGR_api.jsxinc, line 6661

The result
Number

# static sign(num) → {int}

Checks the sign of a number
Parameters:
Name Type Description
num Number The number to check

View Source DuAEF_DuGR_api.jsxinc, line 6757

1 if num is positive, -1 if negative, 0 in other cases (0, NaN...)
int

# static toDegrees(value) → {float}

Converts the number from radians to degrees
Parameters:
Name Type Description
value number the value

View Source DuAEF_DuGR_api.jsxinc, line 6585

The value in degrees
float

# static toRadians(value) → {float}

Converts the number from degrees to radians
Parameters:
Name Type Description
value number the value

View Source DuAEF_DuGR_api.jsxinc, line 6575

The value in radians
float