modeling/maths/line3

Represents a unbounded line in 3D space, positioned at a point of origin.

Source:
See:
  • line3 for data structure information.

Methods

(static) clone(line) → {line3}

Source:

Create a clone of the given line.

Parameters:
Name Type Description
line line3

line to clone

Returns:

a new unbounded line

Type
line3

(static) closestPoint(line, point) → {vec3}

Source:

Determine the closest point on the given line to the given point.

Parameters:
Name Type Description
line line3

line of reference

point vec3

point of reference

Returns:

a point

Type
vec3

(static) copy(out, line) → {line3}

Source:

Copy the given line into the receiving line.

Parameters:
Name Type Description
out line3

receiving line

line line3

line to copy

Returns:

out

Type
line3

(static) create() → {line3}

Source:

Create a line, positioned at 0,0,0 and lying on the X axis.

Returns:

a new unbounded line

Type
line3

(static) direction(line) → {vec3}

Source:

Return the direction of the given line.

Parameters:
Name Type Description
line line3

line for reference

Returns:

the relative vector in the direction of the line

Type
vec3

(static) distanceToPoint(line, point) → {Number}

Source:

Calculate the distance (positive) between the given point and line.

Parameters:
Name Type Description
line line3

line of reference

point vec3

point of reference

Returns:

distance between line and point

Type
Number

(static) equals(line1, line2) → {Boolean}

Source:

Compare the given lines for equality.

Parameters:
Name Type Description
line1 line3

first line to compare

line2 line3

second line to compare

Returns:

true if lines are equal

Type
Boolean

(static) fromPlanes(out, plane1, plane2) → {line3}

Source:

Create a line the intersection of the given planes.

Parameters:
Name Type Description
out line3

receiving line

plane1 plane

first plane of reference

plane2 plane

second plane of reference

Returns:

out

Type
line3

(static) fromPointAndDirection(out, point, direction) → {line3}

Source:

Create a line from the given point (origin) and direction.

The point can be any random point on the line. The direction must be a vector with positive or negative distance from the point.

See the logic of fromPoints() for appropriate values.

Parameters:
Name Type Description
out line3

receiving line

point vec3

start point of the line segment

direction vec3

direction of the line segment

Returns:

out

Type
line3

(static) fromPoints(out, point1, point2) → {line3}

Source:

Create a line that passes through the given points.

Parameters:
Name Type Description
out line3

receiving line

point1 vec3

start point of the line segment

point2 vec3

end point of the line segment

Returns:

out

Type
line3

(static) intersectPointOfLineAndPlane(line, plane) → {vec3}

Source:

Determine the closest point on the given plane to the given line.

NOTES: The point of intersection will be invalid if the line is parallel to the plane, e.g. NaN.

Parameters:
Name Type Description
line line3

line of reference

plane plane

plane of reference

Returns:

a point on the line

Type
vec3

(static) origin(line) → {vec3}

Source:

Return the origin of the given line.

Parameters:
Name Type Description
line line3

line of reference

Returns:

the origin of the line

Type
vec3

(static) reverse(out, line) → {line3}

Source:

Create a line in the opposite direction as the given.

Parameters:
Name Type Description
out line3

receiving line

line line3

line to reverse

Returns:

out

Type
line3

(static) toString(line) → {String}

Source:

Return a string representing the given line.

Parameters:
Name Type Description
line line3

line of reference

Returns:

string representation

Type
String

(static) transform(out, line, matrix) → {line3}

Source:

Transforms the given line using the given matrix.

Parameters:
Name Type Description
out line3

line to update

line line3

line to transform

matrix mat4

matrix to transform with

Returns:

a new unbounded line

Type
line3