-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathindex.js
30 lines (26 loc) · 932 Bytes
/
index.js
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
import boolean from './clip';
/**
* @param {Array.<Array.<Number>|Array.<Object>} polygonA
* @param {Array.<Array.<Number>|Array.<Object>} polygonB
* @return {Array.<Array.<Number>>|Array.<Array.<Object>|Null}
*/
export function union (polygonA, polygonB) {
return boolean(polygonA, polygonB, false, false);
}
/**
* @param {Array.<Array.<Number>|Array.<Object>} polygonA
* @param {Array.<Array.<Number>|Array.<Object>} polygonB
* @return {Array.<Array.<Number>>|Array.<Array.<Object>>|Null}
*/
export function intersection (polygonA, polygonB) {
return boolean(polygonA, polygonB, true, true);
}
/**
* @param {Array.<Array.<Number>|Array.<Object>} polygonA
* @param {Array.<Array.<Number>|Array.<Object>} polygonB
* @return {Array.<Array.<Number>>|Array.<Array.<Object>>|Null}
*/
export function diff (polygonA, polygonB) {
return boolean(polygonA, polygonB, false, true);
}
export const clip = boolean;