Skip to content

Commit 24ebe41

Browse files
committed
Add types declaration file
1 parent 7d12dd3 commit 24ebe41

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+
/**
18+
* Getter/setter for buildLog
19+
*/
20+
export function buildLog(bl: boolean): object[] | boolean;
21+
22+
/**
23+
* Getter/setter for epsilon
24+
*/
25+
export function epsilon(value: number): number;
26+
27+
export function segments(poly: Polygon): Segment;
28+
export function combine(segment1: Segment, segment2: Segment): {
29+
combined: object;
30+
inverted1: boolean;
31+
inverted2: boolean;
32+
};
33+
export function selectUnion(combined: object): Segment;
34+
export function selectIntersect(combined: object): Segment;
35+
export function selectDifference(combined: object): Segment;
36+
export function selectDifferenceRev(combined: object): Segment;
37+
export function selectXor(combined: object): Segment;
38+
export function polygon(segments: Segment): Polygon;
39+
export function polygonFromGeoJSON(geojson: GeoJSON): Polygon;
40+
export function polygonToGeoJSON(poly: Polygon): GeoJSON;
41+
export function union(poly1: Polygon, poly2: Polygon): Polygon;
42+
export function intersect(poly1: Polygon, poly2: Polygon): Polygon;
43+
export function difference(poly1: Polygon, poly2: Polygon): Polygon;
44+
export function differenceRev(poly1: Polygon, poly2: Polygon): Polygon;
45+
export function xor(poly1: Polygon, poly2: Polygon): Polygon;
46+
}

0 commit comments

Comments
 (0)