@woosh/meep-engine 2.105.0 → 2.106.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +358 -188
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +358 -188
- package/package.json +1 -1
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +3 -1
- package/src/core/cache/Cache.d.ts.map +1 -1
- package/src/core/cache/Cache.js +23 -19
- package/src/core/collection/array/array_copy.spec.d.ts +2 -0
- package/src/core/collection/array/array_copy.spec.d.ts.map +1 -0
- package/src/core/collection/array/array_copy.spec.js +19 -0
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/List.js +55 -30
- package/src/core/collection/list/List.spec.js +101 -0
- package/src/core/collection/list/ListForwarder.d.ts.map +1 -1
- package/src/core/collection/list/ListForwarder.js +49 -53
- package/src/core/collection/list/ListForwarder.spec.js +2 -0
- package/src/core/collection/list/SortedListProjection.d.ts +4 -1
- package/src/core/collection/list/SortedListProjection.d.ts.map +1 -1
- package/src/core/collection/list/SortedListProjection.js +4 -1
- package/src/core/collection/map/AbstractAsyncMap.d.ts.map +1 -1
- package/src/core/collection/map/AbstractAsyncMap.js +0 -3
- package/src/core/collection/map/AsyncMapWrapper.d.ts +6 -10
- package/src/core/collection/map/AsyncMapWrapper.d.ts.map +1 -1
- package/src/core/collection/map/AsyncMapWrapper.js +14 -9
- package/src/core/collection/map/HashMap.d.ts.map +1 -1
- package/src/core/collection/map/HashMap.js +30 -3
- package/src/core/collection/map/ObservedMap.d.ts +12 -3
- package/src/core/collection/map/ObservedMap.d.ts.map +1 -1
- package/src/core/collection/map/ObservedMap.js +14 -4
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +100 -95
- package/src/core/collection/set/ArraySet.d.ts.map +1 -0
- package/src/core/collection/set/{Set.js → ArraySet.js} +2 -2
- package/src/core/collection/set/set_remove.d.ts +3 -3
- package/src/core/collection/set/set_remove.d.ts.map +1 -1
- package/src/core/collection/set/set_remove.js +5 -5
- package/src/core/color/oklab/find_gamut_intersection.js +1 -1
- package/src/core/geom/2d/Rectangle.d.ts +54 -5
- package/src/core/geom/2d/Rectangle.d.ts.map +1 -1
- package/src/core/geom/2d/Rectangle.js +70 -3
- package/src/core/geom/2d/circle/Circle.d.ts +1 -1
- package/src/core/geom/2d/circle/Circle.js +1 -1
- package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +1 -1
- package/src/core/geom/2d/compute_triangle_area_2d.js +7 -1
- package/src/core/geom/2d/shape/AbstractShape.d.ts +2 -0
- package/src/core/geom/2d/shape/AbstractShape.d.ts.map +1 -1
- package/src/core/geom/2d/shape/AbstractShape.js +8 -2
- package/src/core/geom/2d/shape/CircleShape.d.ts +14 -0
- package/src/core/geom/2d/shape/CircleShape.d.ts.map +1 -1
- package/src/core/geom/2d/shape/CircleShape.js +64 -22
- package/src/core/geom/2d/uv_map_circle_to_square.d.ts +8 -0
- package/src/core/geom/2d/uv_map_circle_to_square.d.ts.map +1 -0
- package/src/core/geom/2d/{UvUtils.js → uv_map_circle_to_square.js} +2 -17
- package/src/core/geom/2d/uv_map_circle_to_square.spec.d.ts +2 -0
- package/src/core/geom/2d/uv_map_circle_to_square.spec.d.ts.map +1 -0
- package/src/core/geom/2d/uv_map_circle_to_square.spec.js +28 -0
- package/src/core/geom/2d/uv_map_square_to_circle.d.ts +8 -0
- package/src/core/geom/2d/uv_map_square_to_circle.d.ts.map +1 -0
- package/src/core/geom/2d/uv_map_square_to_circle.js +14 -0
- package/src/core/geom/2d/uv_map_square_to_circle.spec.d.ts +2 -0
- package/src/core/geom/2d/uv_map_square_to_circle.spec.d.ts.map +1 -0
- package/src/core/geom/2d/uv_map_square_to_circle.spec.js +30 -0
- package/src/core/geom/Vector3.d.ts +13 -4
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector3.js +83 -36
- package/src/core/geom/Vector3.spec.js +113 -12
- package/src/core/collection/set/Set.d.ts.map +0 -1
- package/src/core/geom/2d/Geometry2D.d.ts +0 -31
- package/src/core/geom/2d/Geometry2D.d.ts.map +0 -1
- package/src/core/geom/2d/Geometry2D.js +0 -59
- package/src/core/geom/2d/UvUtils.d.ts +0 -15
- package/src/core/geom/2d/UvUtils.d.ts.map +0 -1
- package/src/core/geom/2d/UvUtils.spec.d.ts +0 -2
- package/src/core/geom/2d/UvUtils.spec.d.ts.map +0 -1
- package/src/core/geom/2d/UvUtils.spec.js +0 -55
- /package/src/core/collection/set/{Set.d.ts → ArraySet.d.ts} +0 -0
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* Remove all elements of B from A.
|
|
3
3
|
* This operation mutates A
|
|
4
4
|
* @template T
|
|
5
|
-
* @param {Set<T>}
|
|
6
|
-
* @param {Set<T>}
|
|
5
|
+
* @param {Set<T>} from
|
|
6
|
+
* @param {Set<T>} to_be_removed
|
|
7
7
|
*/
|
|
8
|
-
export function set_remove(
|
|
9
|
-
const bs = Array.from(
|
|
8
|
+
export function set_remove(from, to_be_removed) {
|
|
9
|
+
const bs = Array.from(to_be_removed);
|
|
10
10
|
|
|
11
11
|
const n = bs.length;
|
|
12
12
|
for (let i = 0; i < n; i++) {
|
|
13
13
|
const t = bs[i];
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
from.delete(t);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -20,7 +20,7 @@ export function find_gamut_intersection(a, b, L1, C1, L0) {
|
|
|
20
20
|
// Find the cusp of the gamut triangle
|
|
21
21
|
find_cusp(cusp, a, b);
|
|
22
22
|
|
|
23
|
-
// Find the intersection for upper and lower half
|
|
23
|
+
// Find the intersection for upper and lower half separately
|
|
24
24
|
let t;
|
|
25
25
|
if (((L1 - L0) * cusp[1] - (cusp[0] - L0) * C1) <= 0.) {
|
|
26
26
|
// Lower half
|
|
@@ -19,6 +19,26 @@ declare class Rectangle {
|
|
|
19
19
|
* @type {Vector2}
|
|
20
20
|
*/
|
|
21
21
|
readonly size: Vector2;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @return {number}
|
|
25
|
+
*/
|
|
26
|
+
get x0(): number;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @return {number}
|
|
30
|
+
*/
|
|
31
|
+
get x1(): number;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @return {number}
|
|
35
|
+
*/
|
|
36
|
+
get y0(): number;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @return {number}
|
|
40
|
+
*/
|
|
41
|
+
get y1(): number;
|
|
22
42
|
/**
|
|
23
43
|
*
|
|
24
44
|
* @param {number} x
|
|
@@ -61,11 +81,40 @@ declare class Rectangle {
|
|
|
61
81
|
* @returns {boolean}
|
|
62
82
|
*/
|
|
63
83
|
_overlaps(x0: number, y0: number, x1: number, y1: number): boolean;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
* @param {Rectangle} other
|
|
87
|
+
* @returns {boolean}
|
|
88
|
+
*/
|
|
89
|
+
overlaps(other: Rectangle): boolean;
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* @param {number} x0
|
|
93
|
+
* @param {number} y0
|
|
94
|
+
* @param {number} x1
|
|
95
|
+
* @param {number} y1
|
|
96
|
+
*/
|
|
97
|
+
_resizeToFit(x0: number, y0: number, x1: number, y1: number): void;
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @param {Rectangle} other
|
|
101
|
+
*/
|
|
102
|
+
resizeToFit(other: Rectangle): void;
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param {number} x0
|
|
106
|
+
* @param {number} y0
|
|
107
|
+
* @param {number} x1
|
|
108
|
+
* @param {number} y1
|
|
109
|
+
* @returns {boolean}
|
|
110
|
+
*/
|
|
111
|
+
_contains(x0: number, y0: number, x1: number, y1: number): boolean;
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
* @param {Rectangle} other
|
|
115
|
+
* @returns {boolean}
|
|
116
|
+
*/
|
|
117
|
+
contains(other: Rectangle): boolean;
|
|
69
118
|
/**
|
|
70
119
|
*
|
|
71
120
|
* @param {Vector2} result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/Rectangle.js"],"names":[],"mappings":";AAUA;IACI;;;;;;;OAOG;IACH,gBANW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,EAgBhB;IAXG;;;OAGG;IACH,mBAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,eAFU,OAAO,CAEqB;IAG1C;;;;;;OAMG;IACH,OALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAKhB;IAED;;;OAGG;IACH,SAFa,SAAS,
|
|
1
|
+
{"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/Rectangle.js"],"names":[],"mappings":";AAUA;IACI;;;;;;;OAOG;IACH,gBANW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,EAgBhB;IAXG;;;OAGG;IACH,mBAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,eAFU,OAAO,CAEqB;IAG1C;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;;;;OAMG;IACH,OALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAKhB;IAED;;;OAGG;IACH,SAFa,SAAS,CAUrB;IAED;;;OAGG;IACH,YAFW,SAAS,QAKnB;IAED;;;;;;;OAOG;IACH,gBANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,kBAHW,SAAS,GACP,OAAO,CAQnB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,gBAHW,SAAS,GACP,OAAO,CAQnB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAyBhB;IAED;;;OAGG;IACH,mBAFW,SAAS,QASnB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAYnB;IAED;;;;OAIG;IACH,gBAHW,SAAS,GACP,OAAO,CASnB;IAED;;;OAGG;IACH,sBAFW,OAAO,QAUjB;IAED;;;OAGG;IACH,eAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,gBAHW,MAAO,MAAM,CAAC,GAAC,YAAY,GAAC,YAAY,GAAC,UAAU,iBACnD,MAAM,QAOhB;IAED;;;MAKC;IAED,0BAGC;IAGL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;oBAxRmB,eAAe"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Alex on 14/03/2016.
|
|
3
3
|
*/
|
|
4
|
+
import { intersects1D } from "../../math/interval/intersects1D.js";
|
|
5
|
+
import { overlap1D } from "../../math/interval/overlap1D.js";
|
|
4
6
|
import { max2 } from "../../math/max2.js";
|
|
5
7
|
import { min2 } from "../../math/min2.js";
|
|
6
8
|
import Vector2 from "../Vector2.js";
|
|
7
|
-
import { intersects1D } from "../../math/interval/intersects1D.js";
|
|
8
|
-
import { overlap1D } from "../../math/interval/overlap1D.js";
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Rectangle {
|
|
@@ -32,6 +32,38 @@ class Rectangle {
|
|
|
32
32
|
this.size = new Vector2(width, height);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @return {number}
|
|
38
|
+
*/
|
|
39
|
+
get x0() {
|
|
40
|
+
return this.position.x;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @return {number}
|
|
46
|
+
*/
|
|
47
|
+
get x1() {
|
|
48
|
+
return this.position.x + this.size.x;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @return {number}
|
|
54
|
+
*/
|
|
55
|
+
get y0() {
|
|
56
|
+
return this.position.y;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @return {number}
|
|
62
|
+
*/
|
|
63
|
+
get y1() {
|
|
64
|
+
return this.position.y + this.size.y;
|
|
65
|
+
}
|
|
66
|
+
|
|
35
67
|
/**
|
|
36
68
|
*
|
|
37
69
|
* @param {number} x
|
|
@@ -49,7 +81,13 @@ class Rectangle {
|
|
|
49
81
|
* @returns {Rectangle}
|
|
50
82
|
*/
|
|
51
83
|
clone() {
|
|
52
|
-
|
|
84
|
+
const position = this.position;
|
|
85
|
+
const size = this.size;
|
|
86
|
+
|
|
87
|
+
return new Rectangle(
|
|
88
|
+
position.x, position.y,
|
|
89
|
+
size.x, size.y
|
|
90
|
+
);
|
|
53
91
|
}
|
|
54
92
|
|
|
55
93
|
/**
|
|
@@ -110,6 +148,11 @@ class Rectangle {
|
|
|
110
148
|
return overlap1D(x0, x1, _x0, s.x + _x0) && overlap1D(y0, y1, _y0, _y0 + s.y);
|
|
111
149
|
}
|
|
112
150
|
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* @param {Rectangle} other
|
|
154
|
+
* @returns {boolean}
|
|
155
|
+
*/
|
|
113
156
|
overlaps(other) {
|
|
114
157
|
const x0 = other.position.x;
|
|
115
158
|
const y0 = other.position.y;
|
|
@@ -118,6 +161,13 @@ class Rectangle {
|
|
|
118
161
|
return this._overlaps(x0, y0, x1, y1);
|
|
119
162
|
}
|
|
120
163
|
|
|
164
|
+
/**
|
|
165
|
+
*
|
|
166
|
+
* @param {number} x0
|
|
167
|
+
* @param {number} y0
|
|
168
|
+
* @param {number} x1
|
|
169
|
+
* @param {number} y1
|
|
170
|
+
*/
|
|
121
171
|
_resizeToFit(x0, y0, x1, y1) {
|
|
122
172
|
const size = this.size;
|
|
123
173
|
|
|
@@ -143,6 +193,10 @@ class Rectangle {
|
|
|
143
193
|
size.set(nX1 - nX0, nY1 - nY0);
|
|
144
194
|
}
|
|
145
195
|
|
|
196
|
+
/**
|
|
197
|
+
*
|
|
198
|
+
* @param {Rectangle} other
|
|
199
|
+
*/
|
|
146
200
|
resizeToFit(other) {
|
|
147
201
|
const x0 = other.position.x;
|
|
148
202
|
const y0 = other.position.y;
|
|
@@ -152,6 +206,14 @@ class Rectangle {
|
|
|
152
206
|
return this._resizeToFit(x0, y0, x1, y1);
|
|
153
207
|
}
|
|
154
208
|
|
|
209
|
+
/**
|
|
210
|
+
*
|
|
211
|
+
* @param {number} x0
|
|
212
|
+
* @param {number} y0
|
|
213
|
+
* @param {number} x1
|
|
214
|
+
* @param {number} y1
|
|
215
|
+
* @returns {boolean}
|
|
216
|
+
*/
|
|
155
217
|
_contains(x0, y0, x1, y1) {
|
|
156
218
|
const size = this.size;
|
|
157
219
|
|
|
@@ -164,6 +226,11 @@ class Rectangle {
|
|
|
164
226
|
return x0 >= _x0 && x1 <= _x1 && y0 >= _y0 && y1 <= _y1;
|
|
165
227
|
}
|
|
166
228
|
|
|
229
|
+
/**
|
|
230
|
+
*
|
|
231
|
+
* @param {Rectangle} other
|
|
232
|
+
* @returns {boolean}
|
|
233
|
+
*/
|
|
167
234
|
contains(other) {
|
|
168
235
|
const x0 = other.position.x;
|
|
169
236
|
const y0 = other.position.y;
|
|
@@ -4,7 +4,7 @@ declare class Circle {
|
|
|
4
4
|
* A circle or a 2-dimensional sphere. Represented as a position (x,y) and radius (r)
|
|
5
5
|
* @param {Number} [x=0]
|
|
6
6
|
* @param {Number} [y=0]
|
|
7
|
-
* @param {Number} [r=0]
|
|
7
|
+
* @param {Number} [r=0] radius
|
|
8
8
|
* @constructor
|
|
9
9
|
*/
|
|
10
10
|
constructor(x?: number, y?: number, r?: number);
|
|
@@ -5,7 +5,7 @@ class Circle {
|
|
|
5
5
|
* A circle or a 2-dimensional sphere. Represented as a position (x,y) and radius (r)
|
|
6
6
|
* @param {Number} [x=0]
|
|
7
7
|
* @param {Number} [y=0]
|
|
8
|
-
* @param {Number} [r=0]
|
|
8
|
+
* @param {Number} [r=0] radius
|
|
9
9
|
* @constructor
|
|
10
10
|
*/
|
|
11
11
|
constructor(x = 0, y = 0, r = 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_triangle_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_triangle_area_2d.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,6CARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"compute_triangle_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_triangle_area_2d.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,6CARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAYlB"}
|
|
@@ -8,8 +8,14 @@
|
|
|
8
8
|
* @param {number} y2
|
|
9
9
|
* @returns {number}
|
|
10
10
|
*/
|
|
11
|
-
export function compute_triangle_area_2d(
|
|
11
|
+
export function compute_triangle_area_2d(
|
|
12
|
+
x0, y0,
|
|
13
|
+
x1, y1,
|
|
14
|
+
x2, y2
|
|
15
|
+
) {
|
|
16
|
+
|
|
12
17
|
return 0.5 * (
|
|
13
18
|
(x0 * y1 - y0 * x1) + (x1 * y2 - y1 * x2) + (x2 * y0 - y2 * x0)
|
|
14
19
|
);
|
|
20
|
+
|
|
15
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractShape.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/shape/AbstractShape.js"],"names":[],"mappings":"AAAA;
|
|
1
|
+
{"version":3,"file":"AbstractShape.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/shape/AbstractShape.js"],"names":[],"mappings":"AAAA;IAEI,uBAEC;IAED;;OAEG;IACH,SAFa,aAAa,CAIzB;IAED,4BAEC;IAED,eAEC;IAED;;;;OAIG;IACH,kBAHW,aAAa,GACX,OAAO,CAInB;IAED;;;;;OAKG;IACH,mBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;OAMG;IACH,oBALW,MAAM,KACN,MAAM,UACN,MAAM,GACJ,OAAO,CAInB;CACJ"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export class AbstractShape {
|
|
2
|
-
constructor() {
|
|
3
|
-
}
|
|
4
2
|
|
|
5
3
|
copy(other) {
|
|
6
4
|
throw new Error('Not implemented');
|
|
@@ -13,6 +11,14 @@ export class AbstractShape {
|
|
|
13
11
|
throw new Error('Not implemented');
|
|
14
12
|
}
|
|
15
13
|
|
|
14
|
+
equals(other) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
hash() {
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
/**
|
|
17
23
|
*
|
|
18
24
|
* @param {AbstractShape} other
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export class CircleShape extends AbstractShape {
|
|
2
|
+
static from(x?: number, y?: number, r?: number): CircleShape;
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* @type {number}
|
|
@@ -23,6 +24,19 @@ export class CircleShape extends AbstractShape {
|
|
|
23
24
|
intersects(other: any): boolean;
|
|
24
25
|
intersectsPoint(x: any, y: any): boolean;
|
|
25
26
|
intersectsCircle(x: any, y: any, radius: any): boolean;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param {number} x
|
|
30
|
+
* @param {number} y
|
|
31
|
+
* @param {number} r
|
|
32
|
+
*/
|
|
33
|
+
set(x: number, y: number, r: number): void;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param {AbstractShape|CircleShape} other
|
|
37
|
+
* @returns {boolean}
|
|
38
|
+
*/
|
|
39
|
+
equals(other: AbstractShape | CircleShape): boolean;
|
|
26
40
|
/**
|
|
27
41
|
*
|
|
28
42
|
* @type {boolean}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircleShape.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/shape/CircleShape.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CircleShape.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/shape/CircleShape.js"],"names":[],"mappings":"AAKA;IA0FI,6DAMC;IA9FD;;;OAGG;IACH,GAFU,MAAM,CAEV;IACN;;;OAGG;IACH,GAFU,MAAM,CAEV;IACN;;;OAGG;IACH,QAFU,MAAM,CAEL;IAEX;;;OAGG;IACH,YAFW,WAAW,QAKrB;IAED,qBAMC;IAED,gCAQC;IAED,yCAEC;IAED,uDAEC;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,KACN,MAAM,QAgBhB;IAED;;;;OAIG;IACH,cAHW,aAAa,GAAC,WAAW,GACvB,OAAO,CAUnB;IAWL;;;OAGG;IACH,eAFU,OAAO,CAEkB;CANlC;8BAnG6B,oBAAoB"}
|
|
@@ -1,36 +1,33 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
1
2
|
import { circle_intersects_circle } from "../circle/circle_intersects_circle.js";
|
|
2
3
|
import { circle_intersects_point } from "../circle/circle_intersects_point.js";
|
|
3
4
|
import { AbstractShape } from "./AbstractShape.js";
|
|
4
5
|
|
|
5
6
|
export class CircleShape extends AbstractShape {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
this.radius = 0;
|
|
24
|
-
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @type {number}
|
|
11
|
+
*/
|
|
12
|
+
x = 0;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {number}
|
|
16
|
+
*/
|
|
17
|
+
y = 0;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
22
|
+
radius = 0;
|
|
25
23
|
|
|
26
24
|
/**
|
|
27
25
|
*
|
|
28
26
|
* @param {CircleShape} other
|
|
29
27
|
*/
|
|
30
28
|
copy(other) {
|
|
31
|
-
|
|
32
|
-
this.y
|
|
33
|
-
this.radius = other.radius;
|
|
29
|
+
|
|
30
|
+
this.set(other.x, other.y, other.radius);
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
clone() {
|
|
@@ -58,6 +55,51 @@ export class CircleShape extends AbstractShape {
|
|
|
58
55
|
intersectsCircle(x, y, radius) {
|
|
59
56
|
return circle_intersects_circle(x, y, radius, this.x, this.y, this.radius);
|
|
60
57
|
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param {number} x
|
|
62
|
+
* @param {number} y
|
|
63
|
+
* @param {number} r
|
|
64
|
+
*/
|
|
65
|
+
set(x, y, r) {
|
|
66
|
+
|
|
67
|
+
assert.isNumber(x, 'x');
|
|
68
|
+
assert.isNumber(y, 'y');
|
|
69
|
+
assert.isNumber(r, 'r');
|
|
70
|
+
|
|
71
|
+
assert.notNaN(x, 'x');
|
|
72
|
+
assert.notNaN(y, 'y');
|
|
73
|
+
assert.notNaN(r, 'r');
|
|
74
|
+
|
|
75
|
+
this.x = x;
|
|
76
|
+
this.y = y;
|
|
77
|
+
this.radius = r;
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param {AbstractShape|CircleShape} other
|
|
84
|
+
* @returns {boolean}
|
|
85
|
+
*/
|
|
86
|
+
equals(other) {
|
|
87
|
+
if (other.isCircleShape !== true) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return this.x === other.x
|
|
92
|
+
&& this.y === other.y
|
|
93
|
+
&& this.radius === other.radius;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static from(x = 0, y = 0, r = 0) {
|
|
97
|
+
const result = new CircleShape();
|
|
98
|
+
|
|
99
|
+
result.set(x, y, r);
|
|
100
|
+
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
61
103
|
}
|
|
62
104
|
|
|
63
105
|
/**
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* based on paper "Elliptification of Rectangular Imagery" by Chamberlain Fong, Joint Mathematics Meetings 2019, SIGMAA-ARTS
|
|
3
|
+
* @param {Vector2} result
|
|
4
|
+
* @param {number} u
|
|
5
|
+
* @param {number} v
|
|
6
|
+
*/
|
|
7
|
+
export function uv_map_circle_to_square(result: Vector2, u: number, v: number): void;
|
|
8
|
+
//# sourceMappingURL=uv_map_circle_to_square.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uv_map_circle_to_square.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/uv_map_circle_to_square.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,4DAHW,MAAM,KACN,MAAM,QA2BhB"}
|
|
@@ -6,7 +6,7 @@ import { sign } from "../../math/sign.js";
|
|
|
6
6
|
* @param {number} u
|
|
7
7
|
* @param {number} v
|
|
8
8
|
*/
|
|
9
|
-
export function
|
|
9
|
+
export function uv_map_circle_to_square(result, u, v) {
|
|
10
10
|
if (u === 0 || v === 0) {
|
|
11
11
|
//special case
|
|
12
12
|
result.set(u, v);
|
|
@@ -31,19 +31,4 @@ export function uv_mapCircleToSquare(result, u, v) {
|
|
|
31
31
|
const y = (sign_uv / (u * Math.SQRT2)) * alpha;
|
|
32
32
|
|
|
33
33
|
result.set(x, y);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* based on paper "Elliptification of Rectangular Imagery" by Chamberlain Fong, Joint Mathematics Meetings 2019, SIGMAA-ARTS
|
|
38
|
-
* @param {Vector2} result
|
|
39
|
-
* @param {number} x
|
|
40
|
-
* @param {number} y
|
|
41
|
-
*/
|
|
42
|
-
export function uv_mapSquareToCircle(result, x, y) {
|
|
43
|
-
const alpha = Math.sqrt(1 + x * x * y * y);
|
|
44
|
-
|
|
45
|
-
const u = x / alpha;
|
|
46
|
-
const v = y / alpha;
|
|
47
|
-
|
|
48
|
-
result.set(u, v);
|
|
49
|
-
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uv_map_circle_to_square.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/uv_map_circle_to_square.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Vector2 from "../Vector2.js";
|
|
2
|
+
import { uv_map_circle_to_square } from "./uv_map_circle_to_square.js";
|
|
3
|
+
|
|
4
|
+
test("uv_map_circle_to_square", () => {
|
|
5
|
+
const v = new Vector2();
|
|
6
|
+
|
|
7
|
+
function check(inputX, inputY, outputX, outputY) {
|
|
8
|
+
|
|
9
|
+
uv_map_circle_to_square(v, inputX, inputY);
|
|
10
|
+
|
|
11
|
+
expect(v.x).toBeCloseTo(outputX);
|
|
12
|
+
expect(v.y).toBeCloseTo(outputY);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
check(0, 0, 0, 0);
|
|
16
|
+
|
|
17
|
+
check(-1, 0, -1, 0);
|
|
18
|
+
check(1, 0, 1, 0);
|
|
19
|
+
check(0, -1, 0, -1);
|
|
20
|
+
check(0, 1, 0, 1);
|
|
21
|
+
|
|
22
|
+
const s = Math.SQRT1_2;
|
|
23
|
+
|
|
24
|
+
check(s, s, 1, 1);
|
|
25
|
+
check(-s, s, -1, 1);
|
|
26
|
+
check(-s, -s, -1, -1);
|
|
27
|
+
check(s, -s, 1, -1);
|
|
28
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* based on paper "Elliptification of Rectangular Imagery" by Chamberlain Fong, Joint Mathematics Meetings 2019, SIGMAA-ARTS
|
|
3
|
+
* @param {Vector2} result
|
|
4
|
+
* @param {number} x
|
|
5
|
+
* @param {number} y
|
|
6
|
+
*/
|
|
7
|
+
export function uv_map_square_to_circle(result: Vector2, x: number, y: number): void;
|
|
8
|
+
//# sourceMappingURL=uv_map_square_to_circle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uv_map_square_to_circle.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/uv_map_square_to_circle.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,4DAHW,MAAM,KACN,MAAM,QAShB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* based on paper "Elliptification of Rectangular Imagery" by Chamberlain Fong, Joint Mathematics Meetings 2019, SIGMAA-ARTS
|
|
3
|
+
* @param {Vector2} result
|
|
4
|
+
* @param {number} x
|
|
5
|
+
* @param {number} y
|
|
6
|
+
*/
|
|
7
|
+
export function uv_map_square_to_circle(result, x, y) {
|
|
8
|
+
const alpha = Math.sqrt(1 + x * x * y * y);
|
|
9
|
+
|
|
10
|
+
const u = x / alpha;
|
|
11
|
+
const v = y / alpha;
|
|
12
|
+
|
|
13
|
+
result.set(u, v);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uv_map_square_to_circle.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/uv_map_square_to_circle.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Vector2 from "../Vector2.js";
|
|
2
|
+
import { uv_map_square_to_circle } from "./uv_map_square_to_circle.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
test("uv_mapSquareToCircle", () => {
|
|
6
|
+
|
|
7
|
+
const v = new Vector2();
|
|
8
|
+
|
|
9
|
+
function check(inputX, inputY, outputX, outputY) {
|
|
10
|
+
|
|
11
|
+
uv_map_square_to_circle(v, inputX, inputY);
|
|
12
|
+
|
|
13
|
+
expect(v.x).toBeCloseTo(outputX);
|
|
14
|
+
expect(v.y).toBeCloseTo(outputY);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
check(0, 0, 0, 0);
|
|
18
|
+
|
|
19
|
+
check(-1, 0, -1, 0);
|
|
20
|
+
check(1, 0, 1, 0);
|
|
21
|
+
check(0, -1, 0, -1);
|
|
22
|
+
check(0, 1, 0, 1);
|
|
23
|
+
|
|
24
|
+
const s = Math.SQRT1_2;
|
|
25
|
+
|
|
26
|
+
check(1, 1, s, s);
|
|
27
|
+
check(-1, 1, -s, s);
|
|
28
|
+
check(-1, -1, -s, -s);
|
|
29
|
+
check(1, -1, s, -s);
|
|
30
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import {Matrix3, Matrix4} from "three";
|
|
1
2
|
import Signal from "../events/signal/Signal";
|
|
2
3
|
import Quaternion from "./Quaternion";
|
|
3
|
-
import {Matrix3, Matrix4} from "three";
|
|
4
4
|
|
|
5
5
|
interface Vector3Like {
|
|
6
6
|
readonly x: number
|
|
@@ -9,9 +9,9 @@ interface Vector3Like {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export default class Vector3 implements Vector3Like {
|
|
12
|
-
x: number
|
|
13
|
-
y: number
|
|
14
|
-
z: number
|
|
12
|
+
readonly x: number
|
|
13
|
+
readonly y: number
|
|
14
|
+
readonly z: number
|
|
15
15
|
|
|
16
16
|
0: number
|
|
17
17
|
1: number
|
|
@@ -87,10 +87,19 @@ export default class Vector3 implements Vector3Like {
|
|
|
87
87
|
|
|
88
88
|
applyQuaternion(q: Quaternion): void
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated
|
|
92
|
+
*/
|
|
90
93
|
applyMatrix4_three(m4: Matrix4): void
|
|
91
94
|
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated
|
|
97
|
+
*/
|
|
92
98
|
applyMatrix3_three(m4: Matrix3): void
|
|
93
99
|
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated
|
|
102
|
+
*/
|
|
94
103
|
transformDirection_three(m4: Matrix4): void
|
|
95
104
|
|
|
96
105
|
angleTo(other: Vector3Like): number
|