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

Hierarchy

  • Base
    • Line3

Constructors

  • Create a new instance.

    Parameters

    • start: Vector3 = ...

      Start of the line segment. Default is (0, 0, 0).

    • end: Vector3 = ...

      End of the line segment. Default is (0, 0, 0).

    Returns Line3

Properties

end: Vector3
start: Vector3

Accessors

  • get isBox2(): boolean
  • Returns boolean

  • get isBox3(): boolean
  • Returns boolean

  • get isColor(): boolean
  • Returns boolean

  • get isCylindrical(): boolean
  • Returns boolean

  • get isEuler(): boolean
  • Returns boolean

  • get isLine3(): boolean
  • Returns boolean

  • get isMatrix3(): boolean
  • Returns boolean

  • get isMatrix4(): boolean
  • Returns boolean

  • get isPlane(): boolean
  • Returns boolean

  • get isQuaternion(): boolean
  • Returns boolean

  • get isRay(): boolean
  • Returns boolean

  • get isSphere(): boolean
  • Returns boolean

  • get isSpherical(): boolean
  • Returns boolean

  • get isTriangle(): boolean
  • Returns boolean

  • get isVector2(): boolean
  • Returns boolean

  • get isVector3(): boolean
  • Returns boolean

  • get isVector4(): boolean
  • Returns boolean

Methods

  • Applies a matrix transform to the line segment.

    Returns

    This instance.

    Parameters

    Returns Line3

  • Compute the scaled position along the line. When t = 0, it returns the start vector. When t = 1 it returns the end vector.

    Returns

    The position on the line.

    Parameters

    • t: number

      Use values 0-1 to return a position along the line segment.

    • target: Vector3 = ...

      — the result will be copied into this Vector3.

    Returns Vector3

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

    Returns

    The new instance.

    Returns Line3

  • Find the closest point on the line. If clampToLine is true, then the returned value will be clamped to the line segment.

    Returns

    The closest point.

    Parameters

    • point: Vector3

      return the closest point on the line to this point.

    • Optional clampToLine: boolean

      whether to clamp the returned value to the line segment.

    • target: Vector3 = ...

      The result will be copied into this Vector3.

    Returns Vector3

  • closestPointToPointParameter(point: Vector3, clampToLine?: boolean): number
  • Compute 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.

    Returns

    The scaled proportion.

    Parameters

    • point: Vector3

      the point for which to return a point parameter.

    • Optional clampToLine: boolean

      Whether to clamp the result to the range [0, 1].

    Returns number

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

    Returns

    This instance.

    Parameters

    Returns Line3

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

    Returns

    The resulting vector.

    Parameters

    • target: Vector3 = ...

      The result will be copied into this Vector3.

    Returns Vector3

  • distance(): number
  • Compute the Euclidean distance (straight-line distance) between the line's start and end points.

    Returns

    The Euclidean distance.

    Returns number

  • distanceSq(): number
  • Compute the square of the Euclidean distance (straight-line distance) between the line's start and end vectors.

    Returns

    The distance squared.

    Returns number

  • equals(line: Line3): boolean
  • Test for value equality.

    Returns

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

    Parameters

    • line: Line3

      Line3 to compare with this one.

    Returns boolean

  • Compute the center of the line segment.

    Returns

    The center point

    Parameters

    • target: Vector3 = ...

      The result will be copied into this Vector3.

    Returns Vector3

  • Update the start and end values by copying the provided vectors.

    Returns

    This instance.

    Parameters

    • start: Vector3

      set the start point of the line.

    • end: Vector3

      set the end point of the line.

    Returns Line3