bitbybit.dev v1.0.0-rc.1
    Preparing search index...

    Class Polyline

    Index

    Constructors

    convert

    • Converts polyline to line segments (each segment as line object with start/end). Closed polylines include closing segment. Example: 3 points → 2 or 3 lines (depending on isClosed)

      Parameters

      Returns Line3[]

      lines

      polyline to lines

      true

    • Converts polyline to segment arrays (each segment as [point1, point2]). Closed polylines include closing segment if endpoints differ. Example: 4 points, closed → 4 segments connecting all points in a loop

      Parameters

      Returns Segment3[]

      segments

      polyline to segments

      false

    create

    fillet

    • Calculates the maximum possible half-line fillet radius for each corner of a given polyline. For a closed polyline, it includes the corners connecting the last segment back to the first.

      The calculation uses the 'half-line' constraint, meaning the fillet's tangent points must lie within the first half of each segment connected to the corner.

      Parameters

      • inputs: PolylineToleranceDto

        Defines the polyline points, whether it's closed, and an optional tolerance.

      Returns number[]

      An array containing the maximum fillet radius calculated for each corner. The order corresponds to corners P[1]...P[n-2] for open polylines, and P[1]...P[n-2], P[0], P[n-1] for closed polylines. Returns an empty array if the polyline has fewer than 3 points.

      polyline max fillet radii

      false

    • Calculates the single safest maximum fillet radius that can be applied uniformly to all corners of a polyline, based on the 'half-line' constraint. This is determined by finding the minimum of the maximum possible fillet radii calculated for each individual corner.

      Parameters

      • inputs: PolylineToleranceDto

        Defines the polyline points, whether it's closed, and an optional tolerance.

      Returns number

      The smallest value from the results of calculatePolylineMaxFillets. Returns 0 if the polyline has fewer than 3 points or if any calculated maximum radius is 0.

      polyline safest fillet radius

      false

    get

    • Calculates total length of polyline by summing distances between consecutive points. Example: points=[[0,0,0], [3,0,0], [3,4,0]] → 3 + 4 = 7

      Parameters

      Returns number

      length

      polyline length

      false

    • Counts number of points in polyline. Example: polyline with points=[[0,0,0], [1,0,0], [1,1,0]] → 3

      Parameters

      Returns number

      nr of points

      nr polyline points

      false

    intersection

    • Finds intersection points between two polylines (all segment-segment crossings). Tests all segment pairs and deduplicates close points. Example: crossing polylines forming an X → returns center intersection point

      Parameters

      Returns Point3[]

      points

      two polyline intersection

      true

    intersections

    • Finds points where polyline crosses itself (self-intersection points). Skips adjacent segments and deduplicates close points. Example: figure-8 shaped polyline → returns center crossing point

      Parameters

      Returns Point3[]

      polyline

      polyline self intersections

      true

    sort

    • Sorts scrambled segments into connected polylines by matching endpoints. Uses spatial hashing for efficient connection finding. Example: 10 random segments that form 2 connected paths → 2 polylines

      Parameters

      Returns Polyline3[]

      polylines

      segments to polylines

      true

    transforms