Methods
-
(static) capValue(min, value, max) → {number}
-
Get a capped value from a source value.
Parameters:
Name Type Description min
number the minimum
value
number the value to cap
max
number 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 min
number the minimum
max
number 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 p2D
rlMath.point2D the point to check
rect
rlMath.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.p2DinRect
except the parameters are given as arrays whose indices implicitly define the point and rectangle properties.Parameters:
Name Type Description p2D
Array.<number> the point to check as an array [x,y]
rect
Array.<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 x
number value describing the position on the horizontal axis
y
number 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 left
number value describing the position of the left vertical side on the horizontal axis
top
number value describing the position of the top horizontal side on the vertical axis
right
number value describing the position of the right vertical side on the horizontal axis
bottom
number value describing the position of the bottom horizontal side on the vertical axis