polyline.d.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { Line } from './line';
  2. import { Point } from './point';
  3. import { Rectangle } from './rectangle';
  4. import { Geometry } from './geometry';
  5. export declare class Polyline extends Geometry {
  6. points: Point[];
  7. get start(): Point;
  8. get end(): Point;
  9. constructor(points?: (Point.PointLike | Point.PointData)[] | string);
  10. scale(sx: number, sy: number, origin?: Point.PointLike | Point.PointData): this;
  11. rotate(angle: number, origin?: Point.PointLike | Point.PointData): this;
  12. translate(dx: number, dy: number): this;
  13. translate(p: Point.PointLike | Point.PointData): this;
  14. round(precision?: number): this;
  15. bbox(): Rectangle;
  16. closestPoint(p: Point.PointLike | Point.PointData): Point | null;
  17. closestPointLength(p: Point.PointLike | Point.PointData): number;
  18. closestPointNormalizedLength(p: Point.PointLike | Point.PointData): number;
  19. closestPointTangent(p: Point.PointLike | Point.PointData): Line | null;
  20. containsPoint(p: Point.PointLike | Point.PointData): boolean;
  21. intersectsWithLine(line: Line): Point[] | null;
  22. isDifferentiable(): boolean;
  23. length(): number;
  24. pointAt(ratio: number): Point | null;
  25. pointAtLength(length: number): Point | null;
  26. tangentAt(ratio: number): Line | null;
  27. tangentAtLength(length: number): Line | null;
  28. simplify(options?: {
  29. /**
  30. * The max distance of middle point from chord to be simplified.
  31. */
  32. threshold?: number;
  33. }): this;
  34. toHull(): Polyline;
  35. equals(p: Polyline): boolean;
  36. clone(): Polyline;
  37. toJSON(): {
  38. x: number;
  39. y: number;
  40. }[];
  41. serialize(): string;
  42. }
  43. export declare namespace Polyline {
  44. function isPolyline(instance: any): instance is Polyline;
  45. }
  46. export declare namespace Polyline {
  47. function parse(svgString: string): Polyline;
  48. }