new LineSegment(from, to)
Constructs a new line segment with the given values.
Parameters:
| Name | Type | Description |
|---|---|---|
from |
Vector3 | The start point of the line segment. |
to |
Vector3 | The end point of the line segment. |
Members
Methods
-
at(t, result) → {Vector3}
-
Computes a position on the line segment according to the given t value and stores the result in the given 3D vector. The t value has usually a range of [0, 1] where 0 means start position and 1 the end position.
Parameters:
Name Type Description tNumber A scalar value representing a position on the line segment.
resultVector3 The result vector.
-
clone() → {LineSegment}
-
Creates a new line segment and copies all values from this line segment.
-
closestPointToPoint(point, clampToLine, result) → {Vector3}
-
Computes the closest point on an infinite line defined by the line segment. It's possible to clamp the closest point so it does not exceed the start and end position of the line segment.
Parameters:
Name Type Description pointVector3 A point in 3D space.
clampToLineBoolean Indicates if the results should be clamped.
resultVector3 The result vector.
-
closestPointToPointParameter(point, clampToLine) → {Number}
-
Computes a scalar value which represents the closest point on an infinite line defined by the line segment. It's possible to clamp this value so it does not exceed the start and end position of the line segment.
Parameters:
Name Type Default Description pointVector3 A point in 3D space.
clampToLineBoolean true Indicates if the results should be clamped.
Returns:
Number -A scalar representing the closest point.
-
copy(lineSegment) → {LineSegment}
-
Copies all values from the given line segment to this line segment.
Parameters:
Name Type Description lineSegmentLineSegment The line segment to copy.
-
delta(result) → {Vector3}
-
Computes the difference vector between the end and start point of this line segment and stores the result in the given vector.
Parameters:
Name Type Description resultVector3 The result vector.
-
equals(lineSegment) → {Boolean}
-
Returns true if the given line segment is deep equal with this line segment.
Parameters:
Name Type Description lineSegmentLineSegment The line segment to test.
Returns:
Boolean -The result of the equality test.
-
set(from, to) → {LineSegment}
-
Sets the given values to this line segment.
Parameters:
Name Type Description fromVector3 The start point of the line segment.
toVector3 The end point of the line segment.