import * as geom from './index'; import { Point } from './Point'; import { Shape } from './Shape'; /** * A segment is a finite line with start and end points */ export declare class Segment extends Shape { static EMPTY: Readonly; /** Start point */ start: Point; /** End Point */ end: Point; constructor(); constructor(other: Segment); constructor(start: Point, end: Point); constructor(coords: [number, number, number, number]); constructor(x1: number, y1: number, x2: number, y2: number); /** * Return new cloned instance of segment */ clone(): geom.Segment; get tag(): geom.ShapeTag; get name(): string; get box(): geom.Box; get center(): geom.Point; /** * Returns array of start and end point * @returns [Point,Point] */ get vertices(): geom.Point[]; /** * Length of a segment */ get length(): number; /** * Slope of the line - angle to axe x in radians from 0 to 2PI */ get slope(): number; get vector(): geom.Vector; /** * Returns true if equals to query segment, false otherwise */ equalTo(seg: Segment): boolean; /** * Returns true if segment contains point */ contains(pt: Point): boolean; /** * Returns array of intersection points between segment and other shape */ intersect(shape: Shape): geom.Point[]; /** * Calculate distance and shortest segment from segment to shape and return as array [distance, shortest segment] * @param shape Shape of the one of supported types Point, Line, Circle, Segment, Arc, Polygon or Planar Set * @returns {number} distance from segment to shape * @returns {[number, Segment]} shortest segment between segment and shape (started at segment, ended at shape) */ distanceTo(shape: Shape): [number, Segment]; /** * Returns unit vector in the direction from start to end */ tangentInStart(): geom.Vector; /** * Return unit vector in the direction from end to start */ tangentInEnd(): geom.Vector; /** * Returns new segment with swapped start and end points */ reverse(): geom.Segment; /** * When point belongs to segment, return array of two segments split by given point, * if point is inside segment. Returns clone of this segment if query point is incident * to start or end point of the segment. Returns empty array if point does not belong to segment * @param point Query point */ split(point: Point): geom.Segment[]; splitAtLength(length: number): geom.Segment[]; /** * Return middle point of the segment */ middle(): geom.Point; /** * Get point at given length */ pointAtLength(length: number): geom.Point; distanceToPoint(point: Point): number; definiteIntegral(ymin?: number): number; /** * Return new segment transformed using affine transformation matrix */ transform(matrix: geom.Matrix): Segment; /** * Returns true if segment start is equal to segment end up to DP_TOL */ isZeroLength(): boolean; /** * Sort given array of points from segment start to end, assuming all points lay on the segment */ sortPoints(pts: Point[]): Point[]; } /** * Shortcut method to create new segment */ export declare const segment: (x1: number, y1: number, x2: number, y2: number) => geom.Segment; //# sourceMappingURL=Segment.d.ts.map