Skip to content

Commit 9bcfa34

Browse files
committed
Add types declaration file
1 parent 7d12dd3 commit 9bcfa34

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

index.d.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
declare module 'polybooljs' {
2+
type Polygon = {
3+
regions: number[][][];
4+
inverted: boolean;
5+
}
6+
7+
type Segment = {
8+
segments: Segment[],
9+
inverted: boolean;
10+
}
11+
12+
type GeoJSON = {
13+
type: string;
14+
geopolys: Polygon[];
15+
}
16+
17+
export default interface PolyBool {
18+
/**
19+
* Getter/setter for buildLog
20+
*/
21+
buildLog: (bl: boolean) => object[] | boolean,
22+
/**
23+
* Getter/setter for epsilon
24+
*/
25+
epsilon: (value: number) => number,
26+
segments: (poly: Polygon) => Segment,
27+
combine: (segment1: Segment, segment2: Segment) => {
28+
combined: object;
29+
inverted1: boolean;
30+
inverted2: boolean;
31+
},
32+
selectUnion: (combined: object) => Segment,
33+
selectIntersect: (combined: object) => Segment,
34+
selectDifference: (combined: object) => Segment,
35+
selectDifferenceRev: (combined: object) => Segment,
36+
selectXor: (combined: object) => Segment,
37+
polygon: (segments: Segment) => Polygon,
38+
polygonFromGeoJSON: (geojson: GeoJSON) => Polygon,
39+
polygonToGeoJSON: (poly: Polygon) => GeoJSON,
40+
union: (poly1: Polygon, poly2: Polygon) => Polygon,
41+
intersect: (poly1: Polygon, poly2: Polygon) => Polygon,
42+
difference: (poly1: Polygon, poly2: Polygon) => Polygon,
43+
differenceRev: (poly1: Polygon, poly2: Polygon) => Polygon,
44+
xor: (poly1: Polygon, poly2: Polygon) => Polygon
45+
}
46+
}

0 commit comments

Comments
 (0)