geom

Methods

static closestPointBetweenLines(a0, a1, b0, b1, p_a, p_b) → number

Calculate the closest point between lines.

Parameters
a0 Vector3

line1 start

a1 Vector3

line1 end

b0 Vector3

line2 start

b1 Vector3

line2 end

p_a Vector3
p_b Vector3
Returns
number

Closest distance

static intersectCircle(ray, axis, center, radius, result, tolerance)

Test if a ray intersects a circle.

Parameters
ray Ray
axis Vector3
center Vector3
radius number
result Vector3
tolerance number

static intersectCylinder(origin, direction, center, height, radius, result) → bool

Test if a ray intersects a cylinder.

Parameters
origin Vector3
direction Vector3
center Vector3
height number
radius number
result Vector3

Optional storage for the point of intersection

Returns
bool

static intersectPlane(start, direction, P, N, result) → bool

Test if a ray intersects a plane.

Parameters
start Vector3

Origin of the ray

direction Vector3

Direction of the ray

P Vector3

Center of the plane

N Vector3

Normal of the plane

result Vector3

Optional storage for the point of intersection.

Returns
bool

static intersectSphere(origin, direction, center, radius, result, maxDistance) → bool

Test if a ray intersects a sphere.

Parameters
origin Vector3

Origin of the ray

direction Vector3

Direction of the ray

center Vector3

Center of the sphere

radius number

Radius of the sphere

result Vector3

Optional storage for the point of intersection

maxDistance number

Optional maximum distance to test for an interesction.

Returns
bool

static projectPointOnPlane(point, P, N, result)Vector3

Project a point onto a plane.

Parameters
point Vector3

The point to project.

P Vector3

The center of the plane.

N Vector3

The normal of the plane.

result Vector3

Optional storage for the resulting projected point.

Returns
Vector3