Documentation / @ripl/terminal / flattenEllipse
Function: flattenEllipse() ​
flattenEllipse(
cx,cy,rx,ry,rotation?,startAngle?,endAngle?,counterclockwise?,steps?):Vertex[]
Defined in: terminal/src/algorithms.ts:436
Samples an ellipse outline into a polyline of points.
Parameters ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
cx | number | undefined | X coordinate of the ellipse center. |
cy | number | undefined | Y coordinate of the ellipse center. |
rx | number | undefined | Radius along the ellipse's own x axis. |
ry | number | undefined | Radius along the ellipse's own y axis. |
rotation | number | 0 | Rotation of the ellipse about its center, in radians. |
startAngle | number | 0 | Angle the sweep starts at, in radians. |
endAngle | number | TAU | Angle the sweep ends at, in radians. |
counterclockwise | boolean | false | Whether the sweep runs counterclockwise. |
steps? | number | undefined | Segment count to sample with. Pass it when the sampled points are about to be transformed into a larger space, which the radius-derived default would under-segment for. |
Returns ​
Vertex[]
The sampled points. A full sweep omits the duplicate closing point (the curve is closed implicitly); a partial sweep includes both endpoints, so filling it closes the segment with a chord exactly as canvas does.