Auxiliary math methods. For math methods operating on vectors, matrices or quaternions see the
corresponding modules.
- Source:
Summary
Methods
- calc_pline_point(pline, t, destopt, nullable) → (nullable) {Vec3}
- create_pline() → {ParametricLine}
- create_pline_from_point_vec(point, vec) → {ParametricLine}
- create_pline_from_points(point1, point2) → {ParametricLine}
- ease_in_back(t, b, c, d) → {number}
- ease_in_bounce(t, b, c, d) → {number}
- ease_in_circ(t, b, c, d) → {number}
- ease_in_cubic(t, b, c, d) → {number}
- ease_in_elastic(t, b, c, d) → {number}
- ease_in_expo(t, b, c, d) → {number}
- ease_in_out_back(t, b, c, d) → {number}
- ease_in_out_bounce(t, b, c, d) → {number}
- ease_in_out_circ(t, b, c, d) → {number}
- ease_in_out_cubic(t, b, c, d) → {number}
- ease_in_out_elastic(t, b, c, d) → {number}
- ease_in_out_expo(t, b, c, d) → {number}
- ease_in_out_quad(t, b, c, d) → {number}
- ease_in_out_quart(t, b, c, d) → {number}
- ease_in_out_quint(t, b, c, d) → {number}
- ease_in_out_sine(t, b, c, d) → {number}
- ease_in_quad(t, b, c, d) → {number}
- ease_in_quart(t, b, c, d) → {number}
- ease_in_quint(t, b, c, d) → {number}
- ease_in_sine(t, b, c, d) → {number}
- ease_out_back(t, b, c, d) → {number}
- ease_out_bounce(t, b, c, d) → {number}
- ease_out_circ(t, b, c, d) → {number}
- ease_out_cubic(t, b, c, d) → {number}
- ease_out_elastic(t, b, c, d) → {number}
- ease_out_expo(t, b, c, d) → {number}
- ease_out_quad(t, b, c, d) → {number}
- ease_out_quart(t, b, c, d) → {number}
- ease_out_quint(t, b, c, d) → {number}
- ease_out_sine(t, b, c, d) → {number}
- get_pline_directional_vec(pline, destopt, nullable) → (nullable) {Vec3}
- get_pline_initial_point(pline, destopt, nullable) → (nullable) {Vec3}
- line_plane_intersect(pn, p_dist, pline, dest) → (nullable) {Vec3}
- linear_tween(t, b, c, d) → {number}
- point_plane_dist(point, plane) → {number}
- set_pline_directional_vec(pline, vec3)
- set_pline_initial_point(pline, vec3)
Type Definitions
Detailed Description
Methods
calc_pline_point(pline, t, destopt, nullable) → (nullable) {Vec3}
Get the coordinates of a certain point on the given parametric line.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pline |
ParametricLine | Parametric line. | ||
t |
number | Parameter - distance from the line initial point to a certain point. | ||
dest |
Vec3 |
<optional> <nullable> |
new Float32Array(3); | Destination point. |
Returns:
Destination point.
- Type
- Vec3
- Source:
create_pline() → {ParametricLine}
create_pline_from_point_vec(point, vec) → {ParametricLine}
Get the parametric line.
Parameters:
Name | Type | Description |
---|---|---|
point |
Vec3 | First point. |
vec |
Vec3 | Directional vector. |
Returns:
Parametric line.
- Type
- ParametricLine
- Source:
create_pline_from_points(point1, point2) → {ParametricLine}
Get the parametric line.
Parameters:
Name | Type | Description |
---|---|---|
point1 |
Vec3 | First point. |
point2 |
Vec3 | Second point. |
Returns:
Parametric line.
- Type
- ParametricLine
- Source:
ease_in_back(t, b, c, d) → {number}
Interpolate value with decelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_bounce(t, b, c, d) → {number}
Interpolate value with decelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_circ(t, b, c, d) → {number}
Interpolate value with decelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_cubic(t, b, c, d) → {number}
Interpolate value with accelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_elastic(t, b, c, d) → {number}
Interpolate value with decelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_expo(t, b, c, d) → {number}
Interpolate value with decelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_back(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then deceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_bounce(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then deceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_circ(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then deceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_cubic(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then deceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_elastic(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then deceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_expo(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then decelerating.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_quad(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then deceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_quart(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then deceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_quint(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then deceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_out_sine(t, b, c, d) → {number}
Interpolate value with acceleration until halfway, then decelerating.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_quad(t, b, c, d) → {number}
Interpolate value with accelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_quart(t, b, c, d) → {number}
Interpolate value with accelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_quint(t, b, c, d) → {number}
Interpolate value with decelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_in_sine(t, b, c, d) → {number}
Interpolate value with decelerating from zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_back(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_bounce(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_circ(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_cubic(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_elastic(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_expo(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_quad(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_quart(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_quint(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
ease_out_sine(t, b, c, d) → {number}
Interpolate value with decelerating to zero velocity.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
get_pline_directional_vec(pline, destopt, nullable) → (nullable) {Vec3}
Get the parametric line directional vector.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pline |
ParametricLine | Parametric line. | ||
dest |
Vec3 |
<optional> <nullable> |
new Float32Array(3); | Destination vector. |
Returns:
Destination vector.
- Type
- Vec3
- Source:
get_pline_initial_point(pline, destopt, nullable) → (nullable) {Vec3}
Get the parametric line initial point.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pline |
ParametricLine | Parametric line. | ||
dest |
Vec3 |
<optional> <nullable> |
new Float32Array(3); | Destination point. |
Returns:
Destination point.
- Type
- Vec3
- Source:
line_plane_intersect(pn, p_dist, pline, dest) → (nullable) {Vec3}
Calculate intersection point of a line and a plane.
Parameters:
Name | Type | Description |
---|---|---|
pn |
Vec3 | module:math~Plane normal. |
p_dist |
number | module:math~Plane signed distance from the origin. |
pline |
ParametricLine | Parametric line. |
dest |
Vec3 | Destination vector. |
Returns:
Intersection point or null if the line is parallel to the plane.
- Type
- Vec3
- Source:
- See:
-
- Lengyel E. - Mathematics for 3D Game Programming and Computer Graphics, Third Edition. Chapter 5.2.1 Intersection of a Line and a module:math~Plane
linear_tween(t, b, c, d) → {number}
Interpolate value with no easing, no acceleration.
Parameters:
Name | Type | Description |
---|---|---|
t |
number | Current time. |
b |
number | Start value. |
c |
number | Change in value. |
d |
number | Duration. |
Returns:
Interpolated value.
- Type
- number
- Source:
point_plane_dist(point, plane) → {number}
set_pline_directional_vec(pline, vec3)
Set the parametric line directional vector.
Parameters:
Name | Type | Description |
---|---|---|
pline |
ParametricLine | Parametric line. |
vec3 |
Vec3 | Vector. |
- Source:
set_pline_initial_point(pline, vec3)
Set the parametric line initial point.
Parameters:
Name | Type | Description |
---|---|---|
pline |
ParametricLine | Parametric line. |
vec3 |
Vec3 | Point. |
- Source:
Type Definitions
Plane
module:math~Plane represented as vec3 normal and distance to the origin.
Type:
- Float32Array(4)
- Source: