Skip to content

flattenArcTo

flattenArcTo(x0, y0, x1, y1, x2, y2, radius, tolerance, out): void

Defined in: core/flatten.ts:173

Tangent arc, matching CanvasRenderingContext2D.arcTo(x1, y1, x2, y2, radius) — the rounded-corner primitive (rounded rects/bars, CSS-style shapes). (x0, y0) is the current point; (x1, y1) the corner; (x2, y2) the point the outgoing segment heads towards. The arc is tangent to BOTH half-infinite lines (x1,y1)→(x0,y0) and (x1,y1)→(x2,y2), so the tangent points may lie beyond (x0,y0)/(x2,y2) — that is the spec, not a bug.

Appends, like the flatteners above, EXCLUDING the start point and INCLUDING the end: first the start tangent point (the straight join from the current point), then the flattened arc. Degenerate inputs — zero radius, coincident points, collinear points — collapse to a single point at the corner, exactly as Canvas does.

This is the ONE source of truth for the seam: PathRecorder (WebGL/Canvas/SVG all render the Scene it records) and SvgPathContext both call it, so the same arcTo produces the same polyline everywhere. Flattened rather than kept as an analytic arc for the same reason flattenArc is — see #284 for the symbolic-curve alternative.

number

number

number

number

number

number

number

number

number[]

void