import { Rect } from 'geome'; import { mat2d, vec2 } from 'linearly'; import { SegmentLocation } from './Location.js'; import { Path, VertexA, VertexC } from './Path.js'; import { SegmentA } from './Segment.js'; import { PartialBy } from './utils.js'; /** * The angle range to check. `startAngle` is always in the range of [-π, π], and the `endAngle` is relative angle considering the rotation direction, with start angle as a reference. */ type AngleRange = readonly [startAngle: number, endAngle: number]; type SimpleSegmentA = PartialBy; /** * A collection of functions to handle arcs represented with {@link SegmentA}. * @category Modules */ export declare namespace Arc { /** * Converts the Arc command to a center parameterization that can be used in Context2D.ellipse(). * https://observablehq.com/@awhitty/svg-2-elliptical-arc-to-canvas-path2d * @category Utilities * */ const toCenterParameterization: (arg: SimpleSegmentA) => { center: vec2; radii: vec2; angles: AngleRange; xAxisRotation: number; sweep: boolean; }; function approximateByCubicBeziers(arc: SimpleSegmentA, angle: number): VertexC[]; /** * Calculates the bound of given arc. * @param arc The arc segment to calculate * @returns The bound of the arc * @example * ```js:pave * const center = [50, 50] * const startAngle = -120 * const endAngle = 30 * const radius = 40 * const start = vec2.add(center, vec2.direction(startAngle, 40)) * const point = vec2.add(center, vec2.direction(endAngle, 40)) * * const arc = Path.arc([50, 50], 40, startAngle, endAngle) * stroke(arc, 'skyblue') * * const bound = Arc.bounds({ * start, * point, * command: [[radius, radius], 0, false, true] * }) * * stroke(Path.rect(...bound), 'tomato') * ``` */ const bounds: (arg: SimpleSegmentA) => Rect; /** * Transforms the given arc segment with the given matrix. * @see https://gist.github.com/timo22345/9413158#file-flatten-js-L443-L547 */ function transform(arc: SimpleSegmentA, matrix: mat2d): SegmentA; const length: (arg: SimpleSegmentA) => number; function toTime(arc: SimpleSegmentA, loc: SegmentLocation): number; function point(arc: SimpleSegmentA, loc: SegmentLocation): vec2; function derivative(arc: SimpleSegmentA, loc: SegmentLocation): vec2; function tangent(arc: SimpleSegmentA, loc: SegmentLocation): vec2; function normal(arc: SimpleSegmentA, loc: SegmentLocation): vec2; function trim(arc: SimpleSegmentA, start: SegmentLocation, end: SegmentLocation): SegmentA; function divideAtTimes(arc: SimpleSegmentA, times: Iterable): VertexA[]; /** * Returns true if the length of arc segment is zero. */ const isZero: (arg: SimpleSegmentA) => boolean; function isStraight(arc: SimpleSegmentA): boolean; function ellipticArcLength(radii: vec2, angles: AngleRange): number; function offset(arc: SimpleSegmentA, distance: number, unarcAngle?: number): Path; } export {}; //# sourceMappingURL=Arc.d.ts.map