Methods
-
(static) capValue(min, value, max) → {number}
-
Get a capped value from a source value.
Parameters:
Name Type Description minnumber the minimum
valuenumber the value to cap
maxnumber the maximum
Returns:
a number in the inclusive range [min, max]
- Type
- number
-
(static) getCapperFunction(min, max) → {function}
-
Get a custom capper function which caps values from a source value or returns a capped default value.
Parameters:
Name Type Description minnumber the minimum
maxnumber the maximum
Returns:
the custom capper function which takes parameters(value, defaultValue) and caps to [min,max]
- Type
- function
-
(static) p2DinRect(p2D, rect) → {boolean}
-
Determine whether a given point in 2D cartesian space is in the area of a given rectangle in 2D cartesian space.
Parameters:
Name Type Description p2DrlMath.point2D the point to check
rectrlMath.rectangle2D the rectangle to check
Returns:
true if the point is within the rectangle area, false otherwise
- Type
- boolean
-
(static) p2DinRectA(p2D, rect) → {boolean}
-
Same as
rlMath.p2DinRectexcept the parameters are given as arrays whose indices implicitly define the point and rectangle properties.Parameters:
Name Type Description p2DArray.<number> the point to check as an array [x,y]
rectArray.<number> the rectangle to check as an array [left,top,right,bottom]
Returns:
- Type
- boolean
Type Definitions
-
point2D
-
(not an actual type, use object literals with these properties)
Defines a point in 2D cartesian space where +x is to the right of and +y is below the origin.Properties:
Name Type Description xnumber value describing the position on the horizontal axis
ynumber value describing the position on the vertical axis
-
rectangle2D
-
(not an actual type, use object literals with these properties)
Defines a rectangle in 2D cartesian space (bottom >= top).Properties:
Name Type Description leftnumber value describing the position of the left vertical side on the horizontal axis
topnumber value describing the position of the top horizontal side on the vertical axis
rightnumber value describing the position of the right vertical side on the horizontal axis
bottomnumber value describing the position of the bottom horizontal side on the vertical axis