-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbezier.d.ts
51 lines (48 loc) · 1.42 KB
/
bezier.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// TODO figure out how to distinguish 2d and 3d?
interface BezierPoint {
x: number,
y: number,
z?: number
}
interface BezierBBoxDim {
min: number,
mid: number,
max: number,
size: number
}
interface BezierBBox {
x: BezierBBoxDim,
y: BezierBBoxDim,
z?: BezierBBoxDim
}
declare class Bezier {
constructor(coords: BezierPoint[]);
getLUT(steps: number): BezierPoint[];
length(): number;
get(t: number): BezierPoint;
compute(t: number): BezierPoint;
derivative(t: number): BezierPoint;
normal(t: number): BezierPoint;
split(t: number): {left: Bezier, right: Bezier};
split(t1: number, t2: number): Bezier;
inflections(): { x: number[], y: number[], z: number[], values: number[] };
bbox(): BezierBBox;
offset(d: number): Bezier;
offset(t: number, d: number): BezierPoint;
reduce(): Bezier[];
arcs(threshold?: number): {x: number, y: number, s: number, e: number, r: number}[]; // what do those mean?
scale(d: number): Bezier;
outline(d: number): PolyBezier;
outline(d1: number, d2: number): PolyBezier;
outline(d1: number, d2: number, d3: number, d4: number): PolyBezier;
intersects(): string[]; // "x/y" strings
intersects(line: {p1: BezierPoint; p2: BezierPoint}): number[];
intersects(curve: Bezier): string[]; // "t1/t2" strings
}
declare class PolyBezier {
constructor(curves: Bezier[]);
curves: Bezier[];
length(): number;
bbox(): BezierBBox;
offset(d: number): PolyBezier;
}