Class Line

Represents the value of start and end points in a single line segment.

Hierarchy

  • Line

Constructors

  • Constructs a new line segment between two points.

    Parameters

    Returns Line

Properties

From: Point3d

Start point of line segment.

End point of line segment.

Accessors

  • get BoundingBox(): BoundingBox
  • Gets the line's 3d axis aligned bounding box.

    Returns BoundingBox

  • get Direction(): Vector3d
  • Gets the direction of this line segment. The length of the direction vector equals the length of the line segment.

    Returns Vector3d

  • get IsValid(): boolean
  • Determines whether this line is valid. A line is not valid when the start and end points are the same point.

    Returns boolean

  • get Length(): number
  • Gets the length of this line segment.

    Returns number

  • set Length(l: number): void
  • Sets the length of this line segment. Note that a negative length will invert the line segment without making the actual length negative. The line From point will remain fixed when a new Length is set.

    Parameters

    • l: number

    Returns void

  • get UnitDirection(): Vector3d
  • Gets the direction of this line segment. The length of the direction vector is 1.

    Returns Vector3d

Methods

  • Make a copy of this line.

    Returns Line

  • Finds the parameter on the (in)finite line segment that is closest to a test point.

    Returns

    The parameter on the line that is closest to testPoint.

    Parameters

    • testPoint: Point3d

      Point to project onto the line.

    • limitToFiniteSegment: boolean = false

      If true, the projection is limited to the finite line segment. default: false

    Returns number

  • Finds the point on the (in)finite line segment that is closest to a test point.

    Returns

    The point on the (in)finite line that is closest to testPoint.

    Parameters

    • testPoint: Point3d

      Point to project onto the line.

    • limitToFiniteSegment: boolean = false

      If true, the projection is limited to the finite line segment. default: false

    Returns Point3d

  • Compute the shortest distance between this line segment and a test point.

    Returns

    The shortest distance between this line segment and testPoint.

    Parameters

    • other: Point3d | Plane | Line

      Other geometry to calculate the distance to.

    • limitToFiniteSegment: boolean = false

      If true, the distance is limited to the finite line segment. default: false

    Returns number

  • Determines whether a line has the same value as this line.

    Returns

    true if other has the same coordinates as this; otherwise false.

    Parameters

    • other: Line

      A line.

    Returns boolean

  • Extend the line by custom distances on both sides.

    Returns

    The extended line.

    Parameters

    • startLength: number

      Distance to extend the line at the start point. Positive distance result in longer lines.

    • endLength: number

      Distance to extend the line at the end point. Positive distance result in longer lines.

    Returns Line

  • Flip the endpoints of the line and return a new line.

    Returns

    A new flipped line.

    Returns Line

  • Checks if a point is on the line.

    Returns

    Parameters

    • point: Point3d

      Point to check.

    • limitToFiniteSegment: boolean = false

      If true, the check is limited on the finite line. default: false

    • tolerance: number = Open3d.EPSILON

    Returns boolean

  • Evaluates the line at the specified parameter.

    Returns

    The point at the specified parameter.

    Parameters

    • param: number

      Parameter to evaluate line segment at. Line parameters are normalized parameters.

    Returns Point3d

  • Computes a point located at a specific metric distance from the line origin (From). If line start and end coincide, then the start point is always returned.

    Returns

    The newly found point.

    Parameters

    • distance: number

      A positive, 0, or a negative value that will be the distance from From.

    Returns Point3d

  • Transform the line using a Transformation matrix.

    Returns

    A new transformed line.

    Parameters

    • transformation: Transform

      Transformation matrix to apply.

    Returns Line

  • Creates a line from start point and span vector

    Returns

    A line.

    Parameters

    • origin: Point3d

      A point on the line.

    • direction: Vector3d

      A direction vector.

    • Optional length: number

      (optional) the length of the line. If not provided, the length will be the length of the direction vector.

    Returns Line

  • Static method to find the points closest to two lines given (crossing or intersecting) lines

    Returns

    [point1, point2] | null if the lines are parallel

    Parameters

    • line1: Line
    • line2: Line
    • limitToFiniteSegments: boolean

      whether the points need to be part of the line segments

    Returns null | [Point3d, Point3d]

  • Static method for computing the closest distance of two lines

    Returns

    Parameters

    • line1: Line
    • line2: Line
    • limitToFiniteSegments: boolean

    Returns number

  • Static method to calculate the distance between a line and a plane

    Returns

    Parameters

    • line: Line
    • plane: Plane
    • Optional limitToFiniteSegment: boolean

      only applies to the line

    Returns number

  • Private static method to compute the parameter value t of the closest point on a line segment to a given point.

    Returns

    number (t Parameter)

    Parameters

    Returns number

  • Static method for computing the closest point on a line to a given point

    Returns

    Point3d

    Parameters

    • line: Line

      given line

    • point: Point3d

      given point

    • Optional limitToFiniteSegment: boolean

      whether the line is considered infinite or not

    Returns Point3d

  • Static method for computing the closest distance of a point to a line

    Returns

    number

    Parameters

    • line: Line

      given line

    • point: Point3d

      testPoint

    • Optional limitToFiniteSegment: boolean

      whether the line is considered infinite or not

    Returns number

Generated using TypeDoc