Class Polyline

Represents an ordered set of points connected by linear segments.

Remarks

The polyline is using the Array class as its base class. So you can use all Array methods on a polyline. Polylines are closed if start and end points coincide.

Hierarchy

  • Point3dList
    • Polyline

Constructors

  • Init a new polyline from a list of points.

    Parameters

    • points: Point3d[]

      The points that define the polyline.

    Returns Polyline

Properties

items: Point3d[]

The internal array of items.

Accessors

  • get BoundingBox(): BoundingBox
  • Even though this is a property, it is not a "fast" calculation. Every point is evaluated in order to get the bounding box of the list.

    Returns BoundingBox

  • get CenterPoint(): Point3d
  • Compute the center point of the polyline as the weighted average of all segments.

    Returns Point3d

  • get Count(): number
  • Gets the number of elements actually contained in the List.

    Returns number

  • get First(): T
  • Gets or sets the first item in the list. This is synonymous to calling List[0].

    Returns T

  • set First(value: T): void
  • Gets or sets the first item in the list. This is synonymous to calling List[0].

    Parameters

    • value: T

    Returns void

  • get IsClosed(): boolean
  • Gets a value that indicates whether this polyline is closed.

    Remarks

    The polyline is considered to be closed if its start is identical to its endpoint. Polylines less than 3 points long are not considered closed.

    Returns boolean

  • get IsValid(): boolean
  • Gets a value that indicates whether this polyline is valid.

    Remarks

    Valid polylines have at least one segment, no Invalid points and no zero length segments. Closed polylines with only two segments are also not considered valid.

    Returns boolean

  • get Last(): T
  • Gets or sets the last item in the list. This is synonymous to calling List[Count-1].

    Returns T

  • set Last(value: T): void
  • Gets or sets the last item in the list. This is synonymous to calling List[Count-1].

    Parameters

    • value: T

    Returns void

  • get Length(): number
  • Gets the total length of the polyline.

    Returns number

  • get NullOrUndefinedCount(): number
  • Gets the number of null or undefined in this list.

    Returns number

  • get SegmentCount(): number
  • Gets the number of segments for this polyline.

    Returns number

Methods

  • Adds an object to the end of the List. Equivalent to the javascript Array.push method.

    Parameters

    • item: Point3d

      The object to be added to the end of the List.

    Returns void

  • Adds an array of items to the end of the List.

    Parameters

    • items: Point3d[]

      The array of items to be added to the end of the List.

    Returns void

  • Removes all elements from the List.

    Returns void

  • Gets the parameter along the polyline which is closest to a test-point.

    Returns

    The parameter along the polyline closest to testPoint.

    Parameters

    • testPoint: Point3d

      Point to approximate.

    Returns number

  • Gets the point on the polyline which is closest to a test-point.

    Returns

    The point on the polyline closest to testPoint.

    Parameters

    • testPoint: Point3d

      Point to approximate.

    Returns Point3d

  • Equivalent to the javascript Array.includes method.

    Parameters

    • item: Point3d
    • Optional fromIndex: number

    Returns boolean

  • Retuens a new polyline which removed all points that are closer than tolerance to the previous point.

    Remarks

    Start and end points are left intact.

    Returns

    The new polyline

    Parameters

    • tolerance: number = Open3d.EPSILON

      Vertices closer together than tolerance will be removed.

    Returns Polyline

  • Equivalent to the javascript Array.some method.

    Parameters

    Returns boolean

  • Equivalent to the javascript Array.filter method.

    Parameters

    Returns Point3d[]

  • Equivalent to the javascript Array.find method.

    Parameters

    Returns undefined | Point3d

  • Equivalent to the javascript Array.filter method.

    Parameters

    Returns Point3d[]

  • Equivalent to the javascript Array.findIndex method.

    Parameters

    Returns number

  • Equivalent to the javascript Array.forEach method.

    Parameters

    Returns void

  • Gets the element at the specified index.

    Parameters

    • index: number

    Returns Point3d

  • Constructs an array of line segments that make up the entire polyline.

    Returns

    An array of line segments or empty if the polyline contains fewer than 2 points.

    Returns Line[]

  • Adds a item to a specific index in the list.

    Parameters

    • index: number

      The zero-based index at which item should be inserted.

    • item: Point3d

      The item to insert.

    Returns void

  • Adds an array of items to a specific index in the list.

    Parameters

    • index: number

      The zero-based index at which items should be inserted.

    • items: Point3d[]

      The items to insert.

    Returns void

  • Determines whether the polyline is closed, provided a tolerance value.

    Returns

    true if the polyline is closed to within tolerance, false otherwise.

    Parameters

    • tolerance: number

      If the distance between the start and end point of the polyline is less than tolerance, the polyline is considered to be closed.

    Returns boolean

  • Check if the polyline is planar within the given tolerance.

    Remarks

    The polyline must have at least 3 points. Or it is considered nonplanar.

    Returns

    true if the polyline is planar.

    Parameters

    • tolerance: number = Open3d.EPSILON

    Returns boolean

  • It checks if a point is inside a Closed Planar polyline.

    Remarks

    The polyline must be closed and planar. If not, it throws an exception. if the point is on the polyline, it returns false. If the point is not on the polyline plane, it returns false. It performs the even-odd-rule Algorithm (a raycasting algorithm) see https://en.wikipedia.org/wiki/Point_in_polygon

    Returns

    true if the point is inside the polyline.

    Parameters

    • point: Point3d

      the point to check.

    • tolerance: number = Open3d.EPSILON

    Returns boolean

  • It assumes the polyline is planar on the XY plane and checks if a point is inside the polyline.

    Parameters

    Returns boolean

  • Checks if a point is on the polyline.

    Returns

    true if the point is on the polyline.

    Parameters

    • point: Point3d

      the point to check.

    • tolerance: number = Open3d.EPSILON

    Returns boolean

  • A wrapper around the javascript Array.map method.

    Type Parameters

    • S

    Parameters

    Returns S[]

  • Gets the point on the polyline at the given parameter.

    Returns

    Polyline parameter.

    Parameters

    • t: number

      The integer part of the parameter indicates the index of the segment. like 1.4

    Returns Point3d

  • Equivalent to the javascript Array.pop method.

    Returns undefined | Point3d

  • Removes the first occurrence of a specific object from the List.

    Parameters

    Returns void

  • Removes all items that match the given predicate.

    Parameters

    Returns void

  • Removes the first item that matches the given predicate.

    Parameters

    Returns void

  • Reverse the order of the items in the list.

    Remarks

    This method mutates the list and returns a reference.

    Returns

    The reversed list.

    Returns Point3d[]

  • Gets the line segment at the given index.

    Returns

    Line segment at index or null on failure.

    Parameters

    • index: number

      Index of segment to retrieve, if it is not integer, it will be floored.

    Returns null | Line

  • Sets the element at the specified index.

    Parameters

    Returns void

  • Equivalent to the javascript Array.shift method.

    Returns undefined | Point3d

  • Smoothens the polyline segments by averaging adjacent vertices. Smoothing requires a polyline with exclusively valid vertices.

    Parameters

    • amount: number

      Amount to smooth. Zero equals no smoothing, one equals complete smoothing.

    Returns null | Polyline

  • Equivalent to the javascript Array.sort method.

    Parameters

    Returns void

  • Gets the unit tangent vector along the polyline at the given parameter. The integer part of the parameter indicates the index of the segment.

    Returns

    The tangent along the polyline at t.

    Parameters

    • t: number

      Polyline parameter.

    Returns Vector3d

  • Transform the polyline using a Transformation matrix.

    Returns

    A new transformed polyline.

    Parameters

    • transformation: Transform

      Transformation matrix to apply.

    Returns Polyline

  • Constructs a polyline out of a parameter subdomain in this curve.

    Remarks

    The integer part of the domain parameters indicate the index of the segment.

    Returns

    The polyline as defined by the subdomain.

    Parameters

    • t0: number

      The subdomain start of the polyline.

    • t1: number

      The subdomain end of the polyline.

    Returns Polyline

  • Try get the area of the polyline if it is planar and closed.

    Returns

    the area or null if the polyline is not planar.

    Parameters

    • tolerance: number = Open3d.EPSILON

    Returns null | number

  • Try get the plane of the polyline if it is planar.

    Returns

    the plane or null if the polyline is not planar.

    Parameters

    • tolerance: number = Open3d.EPSILON

    Returns null | Plane

  • Initializes a new polyline from a collection of points.

    Returns

    A new polyline.

    Parameters

    Returns Polyline

  • This assumes the polyline is planar on the XY plane.

    Parameters

    Returns number

Generated using TypeDoc