Module: math

Math functions.
Source:

Summary

Methods

Type Definitions

Detailed Description

Methods

calc_pline_point(pline, t) → (nullable) {Vec3}

Calculate parametric line point.
Parameters:
Name Type Description
pline ParametricLine Parametric line.
t Number Parameter (distance from initial point).
Returns:
Destination point.
Type
Vec3
Source:

create_pline() → {ParametricLine}

Init the parametric line.
Returns:
pline Parametric line.
Type
ParametricLine
Source:

create_pline_from_point_vec(point, vec) → {ParametricLine}

Get the parametric line.
Parameters:
Name Type Description
point Vec3 First point.
vec Vec3 Directional vecor.
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:

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

point_plane_dist(point, plane) → {Number}

Calculate distance from point to plane.
Parameters:
Name Type Description
point Vec3 Point.
plane Plane module:math~Plane.
Returns:
Distance.
Type
Number
Source:

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: