import { Rect } from 'geome'; import { mat2d, vec2 } from 'linearly'; import { SegmentLocation } from './Location.js'; import { type Path, Vertex, VertexA, VertexC, VertexL } from './Path.js'; /** * A segment of a path, which consists of a starting point, end point, and an interpolation command. * @category Types */ export type Segment = V extends VertexL ? SegmentL : V extends VertexC ? SegmentC : V extends VertexA ? SegmentA : SegmentL | SegmentC | SegmentA; /** @category Types */ export type SegmentL = VertexL & { start: vec2; }; /** @category Types */ export type SegmentC = VertexC & { start: vec2; }; /** @category Types */ export type SegmentA = VertexA & { start: vec2; }; /** * A collection of functions to handle {@link Segment}. * @category Modules */ export declare namespace Segment { /** * Returns the length of the segment. */ const length: (seg: Segment) => number; /** * Returns the bounding box of the segment. */ const bounds: (seg: Segment) => Rect; /** * Returns the point of the segment at the given location. */ function point(seg: Segment, loc: SegmentLocation): vec2; /** * Returns the derivative of the segment at the given location. */ function derivative(seg: Segment, loc: SegmentLocation): vec2; /** * Returns the tangent vector of the segment at the given location. */ function tangent(seg: Segment, loc: SegmentLocation): vec2; /** * Returns the normal vector of the segment at the given location., which is normally rotated 90 degrees clockwise in Y-down coordinate. */ function normal(seg: Segment, loc: SegmentLocation): vec2; /** * Returns the orientation matrix of the segment at the given location. */ function orientation(seg: Segment, loc: SegmentLocation): mat2d; /** * Returns a new segment that is the result of trimming the given segment from the start to the end. */ function trim(seg: Segment, from: SegmentLocation, to: SegmentLocation): Segment; /** * Returns true if the segment is a zero-length segment. */ function isZero(seg: Segment): boolean; /** * Returns true if the segment is a straight line. Also returns true for zero-length segments. */ function isStraight(seg: Segment): boolean; /** * Returns a new path with the segment offset by the given distance. */ function offset(seg: Segment, distance: number, unarcAngle?: number): Path; /** * Returns a new vertex array with the segment divided at the given times. */ function divideAtTimes(seg: Segment, times: Iterable): Vertex[]; /** * Returns the time of the segment at the given location. */ function toTime(seg: Segment, loc: SegmentLocation): number; } //# sourceMappingURL=Segment.d.ts.map