curve.d.ts 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { Line } from './line';
  2. import { Point } from './point';
  3. import { Polyline } from './polyline';
  4. import { Rectangle } from './rectangle';
  5. import { Geometry } from './geometry';
  6. export declare class Curve extends Geometry {
  7. start: Point;
  8. end: Point;
  9. controlPoint1: Point;
  10. controlPoint2: Point;
  11. PRECISION: number;
  12. constructor(start: Point.PointLike | Point.PointData, controlPoint1: Point.PointLike | Point.PointData, controlPoint2: Point.PointLike | Point.PointData, end: Point.PointLike | Point.PointData);
  13. bbox(): Rectangle;
  14. closestPoint(p: Point.PointLike | Point.PointData, options?: Curve.Options): Point;
  15. closestPointLength(p: Point.PointLike | Point.PointData, options?: Curve.Options): number;
  16. closestPointNormalizedLength(p: Point.PointLike | Point.PointData, options?: Curve.Options): number;
  17. closestPointT(p: Point.PointLike | Point.PointData, options?: Curve.Options): number;
  18. closestPointTangent(p: Point.PointLike | Point.PointData, options?: Curve.Options): Line | null;
  19. containsPoint(p: Point.PointLike | Point.PointData, options?: Curve.Options): boolean;
  20. divideAt(ratio: number, options?: Curve.Options): [Curve, Curve];
  21. divideAtLength(length: number, options?: Curve.Options): [Curve, Curve];
  22. divide(t: number): [Curve, Curve];
  23. divideAtT(t: number): [Curve, Curve];
  24. endpointDistance(): number;
  25. getSkeletonPoints(t: number): {
  26. startControlPoint1: Point;
  27. startControlPoint2: Point;
  28. divider: Point;
  29. dividerControlPoint1: Point;
  30. dividerControlPoint2: Point;
  31. };
  32. getSubdivisions(options?: Curve.Options): Curve[];
  33. length(options?: Curve.Options): number;
  34. lengthAtT(t: number, options?: Curve.Options): number;
  35. pointAt(ratio: number, options?: Curve.Options): Point;
  36. pointAtLength(length: number, options?: Curve.Options): Point;
  37. pointAtT(t: number): Point;
  38. isDifferentiable(): boolean;
  39. tangentAt(ratio: number, options?: Curve.Options): Line | null;
  40. tangentAtLength(length: number, options?: Curve.Options): Line | null;
  41. tangentAtT(t: number): Line | null;
  42. protected getPrecision(options?: Curve.Options): number;
  43. protected getDivisions(options?: Curve.Options): Curve[];
  44. protected getOptions(options?: Curve.Options): Curve.Options;
  45. protected tAt(ratio: number, options?: Curve.Options): number;
  46. protected tAtLength(length: number, options?: Curve.Options): number;
  47. toPoints(options?: Curve.Options): Point[];
  48. toPolyline(options?: Curve.Options): Polyline;
  49. scale(sx: number, sy: number, origin?: Point.PointLike | Point.PointData): this;
  50. rotate(angle: number, origin?: Point.PointLike | Point.PointData): this;
  51. translate(tx: number, ty: number): this;
  52. translate(p: Point.PointLike | Point.PointData): this;
  53. equals(c: Curve): boolean;
  54. clone(): Curve;
  55. toJSON(): {
  56. start: {
  57. x: number;
  58. y: number;
  59. };
  60. controlPoint1: {
  61. x: number;
  62. y: number;
  63. };
  64. controlPoint2: {
  65. x: number;
  66. y: number;
  67. };
  68. end: {
  69. x: number;
  70. y: number;
  71. };
  72. };
  73. serialize(): string;
  74. }
  75. export declare namespace Curve {
  76. function isCurve(instance: any): instance is Curve;
  77. }
  78. export declare namespace Curve {
  79. interface Options {
  80. precision?: number;
  81. subdivisions?: Curve[];
  82. }
  83. }
  84. export declare namespace Curve {
  85. function throughPoints(points: (Point.PointLike | Point.PointData)[]): Curve[];
  86. }