forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
poly2tri.d.ts
113 lines (60 loc) · 2.41 KB
/
poly2tri.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Type definitions for poly2tri v0.9.10
// Project: http://github.com/r3mi/poly2tri.js/
// Definitions by: Elemar Junior <https://github.com/elemarjr/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module poly2tri {
interface IPointLike {
x: number;
y: number;
}
class Point implements IPointLike {
x: number;
y: number;
constructor(x: number, y: number);
toString(): string;
toJSON(): JSON;
clone(): Point;
set_zero(): Point;
set(x: number, y: number): Point;
negate(): Point;
add(n: IPointLike): Point;
sub(n: IPointLike): Point;
mul(s: number): Point;
length(): number;
normalize(): number;
equals(p: IPointLike): boolean;
static negate(p: IPointLike): Point;
static add(a: IPointLike, b: IPointLike): Point;
static sub(a: IPointLike, b: IPointLike): Point;
static mul(s: number, p: IPointLike): Point;
static cross(a: number, b: number): number;
static cross(a: IPointLike, b: number): number;
static cross(a: IPointLike, b: IPointLike): number;
static cross(a: number, b: IPointLike): number;
static toStringBase(p: IPointLike): string;
static toString(p: IPointLike): string;
static compare(a: IPointLike, b: IPointLike): number;
static equals(a: IPointLike, b: IPointLike): boolean;
static dot(a: IPointLike, b: IPointLike): number;
}
class SweepContext {
constructor(contour: Array<IPointLike>);
constructor(contour: Array<IPointLike>, options: JSON);
addHole(polyline: Array<IPointLike>): SweepContext;
addHoles(holes: Array<Array<IPointLike>>): SweepContext;
addPoint(point: IPointLike): SweepContext;
addPoints(point: Array<IPointLike>): SweepContext;
triangulate(): SweepContext;
getBoundingBox(): { min: IPointLike; max: IPointLike; };
getTriangles(): Array<Triangle>;
}
class Triangle {
constructor(a: IPointLike, b: IPointLike, c: IPointLike);
toString(): string;
getPoint(index: number): IPointLike;
getPoints(): Array<IPointLike>;
containsPoint(point: IPointLike): boolean;
containsPoints(p1: IPointLike, p2: IPointLike): boolean;
isInterior(): boolean;
}
}