gcode-preview - v3.0.0-alpha.5
    Preparing search index...

    Class ArcTessellator

    Tessellates G2/G3 arc moves into straight line segments

    Downstream geometry only handles straight segments, so arcs are approximated by a polyline. The segment count is chosen so the chords stay within chordTolerance of the true arc: for an angular step t on a circle of radius r the worst-case gap (sagitta) is r * (1 - cos(t / 2)), so the step scales with the square root of the radius instead of linearly -- large arcs get far fewer points than fixed-length segments would, at equal visual quality. Supports both I/J center-offset mode and R radius mode, including helical arcs that change Z along the way. All arc math lives here; the interpreter routes the resulting points into paths and job state.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Converts an arc move into the points to draw, ending on the arc's endpoint

      Parameters

      • start: ArcPoint

        Absolute position at the start of the arc

      • move: ArcMove

        Arc parameters from the G2/G3 command

      • emit: EmitPoint

        Called once per point, in order, endpoint last. A callback instead of a returned array so arc-heavy files do not allocate a throwaway point object per segment.

      • units: Units = 'mm'

        Current units; the chord tolerance is defined in millimeters, so inch-based arcs are tessellated proportionally finer

      Returns ArcPoint

      The arc's exact endpoint (also the last point emitted). Emits at least the endpoint, even for degenerate arcs.