Line3

A geometric line segment represented by a start and end point.

Constructor

Line3(start : Vector3, end : Vector3)

start — Start of the line segment. Default is (0, 0, 0).
end — End of the line segment. Default is (0, 0, 0).

Creates a new Line3.

Properties

.start : Vector3

Vector3 representing the start point of the line.

.end : Vector3

Vector3 representing the end point of the line.

Methods

.applyMatrix4(matrix : Matrix4) → this

Applies a matrix transform to the line segment.

.at(t : Float, target : Vector3) → Vector3

t — Use values 0-1 to return a position along the line segment.
target — the result will be copied into this Vector3.

Returns a vector at a certain position along the line. When t = 0, it returns the start vector, and when t = 1 it returns the end vector.

.clone() → Line3

Returns a new Line3 with the same start and end vectors as this one.

.closestPointToPoint(point : Vector3, clampToLine : Boolean, target : Vector3) → Vector3

point — return the closest point on the line to this point.
clampToLine — whether to clamp the returned value to the line segment.
target — the result will be copied into this Vector3.

Returns the closets point on the line. If clampToLine is true, then the returned value will be clamped to the line segment.

.closestPointToPointParameter(point : Vector3, clampToLine : Boolean) → Float

point — the point for which to return a point parameter.
clampToLine — Whether to clamp the result to the range [0, 1].

Returns a point parameter based on the closest point as projected on the line segment. If clampToLine is true, then the returned value will be between 0 and 1.

.copy(line : Line3) → this

Copies the passed line's start and end vectors to this line.

.delta(target : Vector3) → Vector3

target — the result will be copied into this Vector3.

Returns the delta vector of the line segment (end vector minus the start vector).

.distance() → Float

Returns the Euclidean distance (straight-line distance) between the line's start and end points.

.distanceSq() → Float

Returns the square of the Euclidean distance (straight-line distance) between the line's start and end vectors.

.equals(line : Line3) → Boolean

lineLine3 to compare with this one.

Returns true if both line's start and end points are equal.

.getCenter(target : Vector3) → Vector3

target — the result will be copied into this Vector3.

Returns the center of the line segment.

.set(start : Vector3, end : Vector3) → this

start — set the start point of the line.
end — set the end point of the line.

Sets the start and end values by copying the provided vectors.

Source

For more info on how to obtain the source code of this module see this page.