@vpmedia/phaser 1.104.0 → 1.105.0
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/dist/index.js +151 -574
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +35 -57
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +11 -10
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +2 -2
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts +3 -3
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +60 -60
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts +10 -10
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +6 -5
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/event_manager.d.ts +49 -174
- package/dist/phaser/core/event_manager.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +7 -7
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/frame.d.ts +27 -48
- package/dist/phaser/core/frame.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts +11 -60
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/frame_util.d.ts +4 -14
- package/dist/phaser/core/frame_util.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts +49 -58
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +15 -13
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +23 -20
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +26 -1
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +2 -2
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +9 -9
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +2 -1
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +28 -28
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +4 -4
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts +2 -2
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts +22 -17
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +1 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts +10 -9
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +9 -8
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +2 -2
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +56 -101
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +11 -9
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts +4 -4
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts +3 -3
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts +5 -5
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +10 -10
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/timer_event.d.ts +11 -21
- package/dist/phaser/core/timer_event.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +37 -59
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +6 -5
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_easing.d.ts +31 -31
- package/dist/phaser/core/tween_easing.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +4 -4
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts +1 -1
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +22 -20
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +23 -35
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts +2 -2
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts +3 -3
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts +2 -2
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts +5 -5
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -3
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +9 -9
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +45 -42
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +24 -16
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts +24 -37
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +34 -49
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts +1 -1
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +5 -5
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +86 -66
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts +2 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts +2 -2
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts +3 -2
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +10 -10
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +2 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts +3 -2
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +11 -10
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts +2 -1
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +8 -6
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +1 -0
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +4 -2
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +3 -2
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts +5 -4
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +15 -2
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts +6 -6
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +11 -10
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts +6 -5
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +14 -14
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts +13 -12
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts +19 -19
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts +6 -6
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts +20 -20
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts +9 -7
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts +5 -3
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +2 -1
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts +19 -19
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/polygon.d.ts +2 -1
- package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +17 -15
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts +51 -142
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/animation.ts +38 -61
- package/src/phaser/core/animation_manager.ts +21 -21
- package/src/phaser/core/animation_parser.ts +11 -3
- package/src/phaser/core/array_set.ts +8 -8
- package/src/phaser/core/cache.ts +75 -68
- package/src/phaser/core/device.ts +23 -24
- package/src/phaser/core/device_util.ts +10 -10
- package/src/phaser/core/dom.ts +5 -5
- package/src/phaser/core/event_manager.ts +52 -193
- package/src/phaser/core/factory.ts +25 -18
- package/src/phaser/core/frame.ts +37 -51
- package/src/phaser/core/frame_data.ts +29 -76
- package/src/phaser/core/frame_util.ts +3 -16
- package/src/phaser/core/game.ts +36 -63
- package/src/phaser/core/input.ts +68 -68
- package/src/phaser/core/input_handler.ts +81 -86
- package/src/phaser/core/input_mouse.ts +42 -36
- package/src/phaser/core/input_mspointer.ts +24 -25
- package/src/phaser/core/input_pointer.ts +55 -56
- package/src/phaser/core/input_touch.ts +26 -26
- package/src/phaser/core/loader.ts +97 -70
- package/src/phaser/core/loader_parser.ts +6 -7
- package/src/phaser/core/raf.ts +2 -2
- package/src/phaser/core/scale_manager.ts +85 -82
- package/src/phaser/core/scene.ts +3 -4
- package/src/phaser/core/scene_manager.ts +26 -26
- package/src/phaser/core/signal.ts +10 -10
- package/src/phaser/core/signal_binding.ts +2 -2
- package/src/phaser/core/sound.ts +65 -112
- package/src/phaser/core/sound_manager.ts +31 -30
- package/src/phaser/core/sound_sprite.ts +10 -11
- package/src/phaser/core/stage.ts +8 -8
- package/src/phaser/core/time.ts +33 -34
- package/src/phaser/core/timer.ts +40 -34
- package/src/phaser/core/timer_event.ts +23 -23
- package/src/phaser/core/tween.ts +42 -68
- package/src/phaser/core/tween_data.ts +31 -31
- package/src/phaser/core/tween_easing.ts +31 -31
- package/src/phaser/core/tween_manager.ts +10 -11
- package/src/phaser/core/world.ts +1 -2
- package/src/phaser/display/bitmap_text.ts +41 -31
- package/src/phaser/display/button.ts +24 -51
- package/src/phaser/display/canvas/buffer.ts +6 -7
- package/src/phaser/display/canvas/graphics.ts +3 -4
- package/src/phaser/display/canvas/masker.ts +2 -3
- package/src/phaser/display/canvas/pool.ts +3 -4
- package/src/phaser/display/canvas/renderer.ts +19 -20
- package/src/phaser/display/canvas/tinter.ts +4 -5
- package/src/phaser/display/canvas/util.ts +9 -9
- package/src/phaser/display/display_object.ts +49 -50
- package/src/phaser/display/graphics.ts +56 -43
- package/src/phaser/display/graphics_data.ts +11 -12
- package/src/phaser/display/graphics_data_util.ts +1 -2
- package/src/phaser/display/group.ts +32 -42
- package/src/phaser/display/image.ts +32 -52
- package/src/phaser/display/sprite_batch.ts +1 -2
- package/src/phaser/display/sprite_util.ts +5 -6
- package/src/phaser/display/text.ts +82 -56
- package/src/phaser/display/webgl/abstract_filter.ts +8 -8
- package/src/phaser/display/webgl/base_texture.ts +14 -15
- package/src/phaser/display/webgl/blend_manager.ts +5 -5
- package/src/phaser/display/webgl/earcut.ts +27 -27
- package/src/phaser/display/webgl/earcut_node.ts +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -19
- package/src/phaser/display/webgl/filter_manager.ts +5 -5
- package/src/phaser/display/webgl/filter_texture.ts +7 -7
- package/src/phaser/display/webgl/graphics.ts +10 -11
- package/src/phaser/display/webgl/graphics_data.ts +11 -11
- package/src/phaser/display/webgl/mask_manager.ts +2 -3
- package/src/phaser/display/webgl/render_texture.ts +12 -12
- package/src/phaser/display/webgl/renderer.ts +24 -24
- package/src/phaser/display/webgl/shader/complex.ts +7 -7
- package/src/phaser/display/webgl/shader/fast.ts +8 -8
- package/src/phaser/display/webgl/shader/normal.ts +12 -12
- package/src/phaser/display/webgl/shader/primitive.ts +7 -7
- package/src/phaser/display/webgl/shader/strip.ts +7 -7
- package/src/phaser/display/webgl/shader_manager.ts +13 -13
- package/src/phaser/display/webgl/sprite_batch.ts +20 -20
- package/src/phaser/display/webgl/stencil_manager.ts +8 -8
- package/src/phaser/display/webgl/texture.ts +35 -24
- package/src/phaser/display/webgl/texture_util.ts +2 -3
- package/src/phaser/display/webgl/util.ts +6 -6
- package/src/phaser/geom/circle.ts +10 -10
- package/src/phaser/geom/ellipse.ts +6 -6
- package/src/phaser/geom/line.ts +14 -14
- package/src/phaser/geom/matrix.ts +12 -12
- package/src/phaser/geom/point.ts +19 -19
- package/src/phaser/geom/polygon.ts +5 -5
- package/src/phaser/geom/rectangle.ts +21 -21
- package/src/phaser/geom/rounded_rectangle.ts +2 -2
- package/src/phaser/geom/util/circle.ts +7 -7
- package/src/phaser/geom/util/ellipse.ts +1 -1
- package/src/phaser/geom/util/line.ts +5 -5
- package/src/phaser/geom/util/matrix.ts +1 -1
- package/src/phaser/geom/util/point.ts +20 -20
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +15 -15
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
- package/src/phaser/util/math.ts +65 -151
|
@@ -8,7 +8,7 @@ import { Point } from '../point.js';
|
|
|
8
8
|
* @param {Circle} output - Optional circle to store the result in.
|
|
9
9
|
* @returns {Circle} The cloned circle.
|
|
10
10
|
*/
|
|
11
|
-
export const clone = (input, output = null) => {
|
|
11
|
+
export const clone = (input: Circle, output: Circle = null) => {
|
|
12
12
|
const result = output || new Circle();
|
|
13
13
|
result.x = input.x;
|
|
14
14
|
result.y = input.y;
|
|
@@ -23,7 +23,7 @@ export const clone = (input, output = null) => {
|
|
|
23
23
|
* @param {number} y - The y coordinate of the point.
|
|
24
24
|
* @returns {boolean} True if the point is contained within the circle, false otherwise.
|
|
25
25
|
*/
|
|
26
|
-
export const contains = (a, x, y) => {
|
|
26
|
+
export const contains = (a: Circle, x: number, y: number) => {
|
|
27
27
|
if (a.radius > 0 && x >= a.left && x <= a.right && y >= a.top && y <= a.bottom) {
|
|
28
28
|
const dx = (a.x - x) * (a.x - x);
|
|
29
29
|
const dy = (a.y - y) * (a.y - y);
|
|
@@ -38,7 +38,7 @@ export const contains = (a, x, y) => {
|
|
|
38
38
|
* @param {Circle} b - The second circle to compare.
|
|
39
39
|
* @returns {boolean} True if the circles are equal, false otherwise.
|
|
40
40
|
*/
|
|
41
|
-
export const equals = (a, b) => {
|
|
41
|
+
export const equals = (a: Circle, b: Circle) => {
|
|
42
42
|
return a.x === b.x && a.y === b.y && a.diameter === b.diameter;
|
|
43
43
|
};
|
|
44
44
|
|
|
@@ -48,7 +48,7 @@ export const equals = (a, b) => {
|
|
|
48
48
|
* @param {Circle} b - The second circle to check.
|
|
49
49
|
* @returns {boolean} True if the circles intersect, false otherwise.
|
|
50
50
|
*/
|
|
51
|
-
export const intersects = (a, b) => {
|
|
51
|
+
export const intersects = (a: Circle, b: Circle) => {
|
|
52
52
|
return distance(a.x, a.y, b.x, b.y) <= a.radius + b.radius;
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -60,7 +60,7 @@ export const intersects = (a, b) => {
|
|
|
60
60
|
* @param {Point} output - Optional point to store the result in.
|
|
61
61
|
* @returns {Point} The point on the circumference of the circle.
|
|
62
62
|
*/
|
|
63
|
-
export const circumferencePoint = (a, angle, asDegrees = false, output = null) => {
|
|
63
|
+
export const circumferencePoint = (a: Circle, angle: number, asDegrees: boolean = false, output: Point = null) => {
|
|
64
64
|
const result = output || new Point();
|
|
65
65
|
if (asDegrees === true) {
|
|
66
66
|
angle = degToRad(angle);
|
|
@@ -78,7 +78,7 @@ export const circumferencePoint = (a, angle, asDegrees = false, output = null) =
|
|
|
78
78
|
* @param {Point} output - Optional point to store the result in.
|
|
79
79
|
* @returns {Point} The point on the circumference of the circle.
|
|
80
80
|
*/
|
|
81
|
-
export const intersectsPoint = (a, angle, asDegrees = false, output = null) => {
|
|
81
|
+
export const intersectsPoint = (a: Circle, angle: number, asDegrees: boolean = false, output: Point = null) => {
|
|
82
82
|
const result = output || new Point();
|
|
83
83
|
if (asDegrees === true) {
|
|
84
84
|
angle = degToRad(angle);
|
|
@@ -94,7 +94,7 @@ export const intersectsPoint = (a, angle, asDegrees = false, output = null) => {
|
|
|
94
94
|
* @param {object} r - The rectangle to check.
|
|
95
95
|
* @returns {boolean} True if the circle intersects with the rectangle, false otherwise.
|
|
96
96
|
*/
|
|
97
|
-
export const intersectsRectangle = (c, r) => {
|
|
97
|
+
export const intersectsRectangle = (c: Circle, r: any) => {
|
|
98
98
|
const cx = Math.abs(c.x - r.x - r.halfWidth);
|
|
99
99
|
const xDist = r.halfWidth + c.radius;
|
|
100
100
|
if (cx > xDist) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param {number} y - The y coordinate of the point.
|
|
6
6
|
* @returns {boolean} True if the point is contained within the ellipse, false otherwise.
|
|
7
7
|
*/
|
|
8
|
-
export const contains = (a, x, y) => {
|
|
8
|
+
export const contains = (a: import('../ellipse.js').Ellipse, x: number, y: number) => {
|
|
9
9
|
if (a.width <= 0 || a.height <= 0) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
@@ -8,7 +8,7 @@ import { intersects as intersectsRect } from './rectangle.js';
|
|
|
8
8
|
* @param {Line} output - Optional line to store the result in.
|
|
9
9
|
* @returns {Line} The cloned line.
|
|
10
10
|
*/
|
|
11
|
-
export const clone = (input, output = null) => {
|
|
11
|
+
export const clone = (input: Line, output: Line = null) => {
|
|
12
12
|
const result = output || new Line();
|
|
13
13
|
result.start.x = input.start.x;
|
|
14
14
|
result.start.y = input.start.y;
|
|
@@ -27,7 +27,7 @@ export const clone = (input, output = null) => {
|
|
|
27
27
|
* @param {Point} output - Optional point to store the result in.
|
|
28
28
|
* @returns {Point} The intersection point, or null if there is no intersection.
|
|
29
29
|
*/
|
|
30
|
-
export const intersectsPoints = (a, b, e, f, asSegment = true, output = null) => {
|
|
30
|
+
export const intersectsPoints = (a: any, b: any, e: any, f: any, asSegment: boolean = true, output: Point = null) => {
|
|
31
31
|
const result = output || new Point();
|
|
32
32
|
const a1 = b.y - a.y;
|
|
33
33
|
const a2 = f.y - e.y;
|
|
@@ -61,7 +61,7 @@ export const intersectsPoints = (a, b, e, f, asSegment = true, output = null) =>
|
|
|
61
61
|
* @param {Point} result - Optional point to store the result in.
|
|
62
62
|
* @returns {Point} The intersection point, or null if there is no intersection.
|
|
63
63
|
*/
|
|
64
|
-
export const intersects = (a, b, asSegment, result) => {
|
|
64
|
+
export const intersects = (a: any, b: any, asSegment: boolean, result: Point) => {
|
|
65
65
|
return intersectsPoints(a.start, a.end, b.start, b.end, asSegment, result);
|
|
66
66
|
};
|
|
67
67
|
|
|
@@ -71,7 +71,7 @@ export const intersects = (a, b, asSegment, result) => {
|
|
|
71
71
|
* @param {object} rect - The rectangle to check (with x, y, width, height properties).
|
|
72
72
|
* @returns {boolean} True if the line intersects with the rectangle, false otherwise.
|
|
73
73
|
*/
|
|
74
|
-
export const intersectsRectangle = (line, rect) => {
|
|
74
|
+
export const intersectsRectangle = (line: any, rect: any) => {
|
|
75
75
|
// Quick bail out of the Line and Rect bounds don't intersect
|
|
76
76
|
if (!intersectsRect(line, rect)) {
|
|
77
77
|
return false;
|
|
@@ -125,6 +125,6 @@ export const intersectsRectangle = (line, rect) => {
|
|
|
125
125
|
* @param {object} b - The second point (with x, y properties).
|
|
126
126
|
* @returns {number} The distance between the points.
|
|
127
127
|
*/
|
|
128
|
-
export const reflect = (a, b) => {
|
|
128
|
+
export const reflect = (a: any, b: any) => {
|
|
129
129
|
return 2 * b.normalAngle - 3.141592653589793 - a.angle;
|
|
130
130
|
};
|
|
@@ -6,7 +6,7 @@ import { Matrix } from '../matrix.js';
|
|
|
6
6
|
* @param {Matrix} output - Optional matrix to store the result in.
|
|
7
7
|
* @returns {Matrix} The cloned matrix.
|
|
8
8
|
*/
|
|
9
|
-
export const clone = (input, output = null) => {
|
|
9
|
+
export const clone = (input: Matrix, output: Matrix = null) => {
|
|
10
10
|
const result = output || new Matrix();
|
|
11
11
|
result.a = input.a;
|
|
12
12
|
result.b = input.b;
|
|
@@ -7,7 +7,7 @@ import { Point } from '../point.js';
|
|
|
7
7
|
* @param {Point} output - The point to store the result in (optional).
|
|
8
8
|
* @returns {Point} A new point containing the sum of the two points.
|
|
9
9
|
*/
|
|
10
|
-
export const add = (a, b, output = null) => {
|
|
10
|
+
export const add = (a: Point, b: Point, output: Point = null) => {
|
|
11
11
|
const result = output || new Point();
|
|
12
12
|
result.x = a.x + b.x;
|
|
13
13
|
result.y = a.y + b.y;
|
|
@@ -21,7 +21,7 @@ export const add = (a, b, output = null) => {
|
|
|
21
21
|
* @param {Point} output - The point to store the result in (optional).
|
|
22
22
|
* @returns {Point} A new point containing the difference of the two points.
|
|
23
23
|
*/
|
|
24
|
-
export const subtract = (a, b, output = null) => {
|
|
24
|
+
export const subtract = (a: Point, b: Point, output: Point = null) => {
|
|
25
25
|
const result = output || new Point();
|
|
26
26
|
result.x = a.x - b.x;
|
|
27
27
|
result.y = a.y - b.y;
|
|
@@ -35,7 +35,7 @@ export const subtract = (a, b, output = null) => {
|
|
|
35
35
|
* @param {Point} output - The point to store the result in (optional).
|
|
36
36
|
* @returns {Point} A new point containing the product of the two points.
|
|
37
37
|
*/
|
|
38
|
-
export const multiply = (a, b, output = null) => {
|
|
38
|
+
export const multiply = (a: Point, b: Point, output: Point = null) => {
|
|
39
39
|
const result = output || new Point();
|
|
40
40
|
result.x = a.x * b.x;
|
|
41
41
|
result.y = a.y * b.y;
|
|
@@ -49,7 +49,7 @@ export const multiply = (a, b, output = null) => {
|
|
|
49
49
|
* @param {Point} output - The point to store the result in (optional).
|
|
50
50
|
* @returns {Point} A new point containing the quotient of the two points.
|
|
51
51
|
*/
|
|
52
|
-
export const divide = (a, b, output = null) => {
|
|
52
|
+
export const divide = (a: Point, b: Point, output: Point = null) => {
|
|
53
53
|
const result = output || new Point();
|
|
54
54
|
result.x = a.x / b.x;
|
|
55
55
|
result.y = a.y / b.y;
|
|
@@ -62,7 +62,7 @@ export const divide = (a, b, output = null) => {
|
|
|
62
62
|
* @param {Point} b - The second point to compare.
|
|
63
63
|
* @returns {boolean} True if the points are equal, false otherwise.
|
|
64
64
|
*/
|
|
65
|
-
export const equals = (a, b) => {
|
|
65
|
+
export const equals = (a: Point, b: Point) => {
|
|
66
66
|
return a.x === b.x && a.y === b.y;
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -72,7 +72,7 @@ export const equals = (a, b) => {
|
|
|
72
72
|
* @param {Point} b - The second point to calculate the angle to.
|
|
73
73
|
* @returns {number} The angle between the two points in radians.
|
|
74
74
|
*/
|
|
75
|
-
export const angle = (a, b) => {
|
|
75
|
+
export const angle = (a: Point, b: Point) => {
|
|
76
76
|
return Math.atan2(a.y - b.y, a.x - b.x);
|
|
77
77
|
};
|
|
78
78
|
|
|
@@ -82,7 +82,7 @@ export const angle = (a, b) => {
|
|
|
82
82
|
* @param {Point} output - The point to store the result in (optional).
|
|
83
83
|
* @returns {Point} A new point with negated coordinates.
|
|
84
84
|
*/
|
|
85
|
-
export const negative = (a, output = null) => {
|
|
85
|
+
export const negative = (a: Point, output: Point = null) => {
|
|
86
86
|
const result = output || new Point();
|
|
87
87
|
return result.setTo(-a.x, -a.y);
|
|
88
88
|
};
|
|
@@ -95,7 +95,7 @@ export const negative = (a, output = null) => {
|
|
|
95
95
|
* @param {Point} output - The point to store the result in (optional).
|
|
96
96
|
* @returns {Point} A new point with the result of the operation.
|
|
97
97
|
*/
|
|
98
|
-
export const multiplyAdd = (a, b, s, output = null) => {
|
|
98
|
+
export const multiplyAdd = (a: Point, b: Point, s: number, output: Point = null) => {
|
|
99
99
|
const result = output || new Point();
|
|
100
100
|
return result.setTo(a.x + b.x * s, a.y + b.y * s);
|
|
101
101
|
};
|
|
@@ -108,7 +108,7 @@ export const multiplyAdd = (a, b, s, output = null) => {
|
|
|
108
108
|
* @param {Point} output - The point to store the result in (optional).
|
|
109
109
|
* @returns {Point} A new point interpolated between the two points.
|
|
110
110
|
*/
|
|
111
|
-
export const interpolate = (a, b, f, output = null) => {
|
|
111
|
+
export const interpolate = (a: Point, b: Point, f: number, output: Point = null) => {
|
|
112
112
|
const result = output || new Point();
|
|
113
113
|
return result.setTo(a.x + (b.x - a.x) * f, a.y + (b.y - a.y) * f);
|
|
114
114
|
};
|
|
@@ -119,7 +119,7 @@ export const interpolate = (a, b, f, output = null) => {
|
|
|
119
119
|
* @param {Point} output - The point to store the result in (optional).
|
|
120
120
|
* @returns {Point} A new point that is perpendicular to the input point.
|
|
121
121
|
*/
|
|
122
|
-
export const perp = (a, output = null) => {
|
|
122
|
+
export const perp = (a: Point, output: Point = null) => {
|
|
123
123
|
const result = output || new Point();
|
|
124
124
|
return result.setTo(-a.y, a.x);
|
|
125
125
|
};
|
|
@@ -130,7 +130,7 @@ export const perp = (a, output = null) => {
|
|
|
130
130
|
* @param {Point} output - The point to store the result in (optional).
|
|
131
131
|
* @returns {Point} A new point that is perpendicular to the input point (rotated clockwise).
|
|
132
132
|
*/
|
|
133
|
-
export const rperp = (a, output = null) => {
|
|
133
|
+
export const rperp = (a: Point, output: Point = null) => {
|
|
134
134
|
const result = output || new Point();
|
|
135
135
|
return result.setTo(a.y, -a.x);
|
|
136
136
|
};
|
|
@@ -142,7 +142,7 @@ export const rperp = (a, output = null) => {
|
|
|
142
142
|
* @param {boolean} round - Whether to round the result (default: false).
|
|
143
143
|
* @returns {number} The distance between the two points.
|
|
144
144
|
*/
|
|
145
|
-
export const distance = (a, b, round = false) => {
|
|
145
|
+
export const distance = (a: Point, b: Point, round: boolean = false) => {
|
|
146
146
|
const dx = a.x - b.x;
|
|
147
147
|
const dy = a.y - b.y;
|
|
148
148
|
const abDistance = Math.sqrt(dx * dx + dy * dy);
|
|
@@ -156,7 +156,7 @@ export const distance = (a, b, round = false) => {
|
|
|
156
156
|
* @param {Point} output - The point to store the result in (optional).
|
|
157
157
|
* @returns {Point} A new point with the projected result.
|
|
158
158
|
*/
|
|
159
|
-
export const project = (a, b, output = null) => {
|
|
159
|
+
export const project = (a: Point, b: Point, output: Point = null) => {
|
|
160
160
|
const result = output || new Point();
|
|
161
161
|
const amt = a.dot(b) / b.getMagnitudeSq();
|
|
162
162
|
if (amt !== 0) {
|
|
@@ -172,7 +172,7 @@ export const project = (a, b, output = null) => {
|
|
|
172
172
|
* @param {Point} output - The point to store the result in (optional).
|
|
173
173
|
* @returns {Point} A new point with the projected result.
|
|
174
174
|
*/
|
|
175
|
-
export const projectUnit = (a, b, output = null) => {
|
|
175
|
+
export const projectUnit = (a: Point, b: Point, output: Point = null) => {
|
|
176
176
|
const result = output || new Point();
|
|
177
177
|
const amt = a.dot(b);
|
|
178
178
|
if (amt !== 0) {
|
|
@@ -187,7 +187,7 @@ export const projectUnit = (a, b, output = null) => {
|
|
|
187
187
|
* @param {Point} output - The point to store the result in (optional).
|
|
188
188
|
* @returns {Point} A new point with the same x coordinate but negated y coordinate.
|
|
189
189
|
*/
|
|
190
|
-
export const normalRightHand = (a, output = null) => {
|
|
190
|
+
export const normalRightHand = (a: Point, output: Point = null) => {
|
|
191
191
|
const result = output || new Point();
|
|
192
192
|
return result.setTo(a.y * -1, a.x);
|
|
193
193
|
};
|
|
@@ -198,7 +198,7 @@ export const normalRightHand = (a, output = null) => {
|
|
|
198
198
|
* @param {Point} output - The point to store the result in (optional).
|
|
199
199
|
* @returns {Point} A new normalized point.
|
|
200
200
|
*/
|
|
201
|
-
export const normalize = (a, output = null) => {
|
|
201
|
+
export const normalize = (a: Point, output: Point = null) => {
|
|
202
202
|
const result = output || new Point();
|
|
203
203
|
const m = a.getMagnitude();
|
|
204
204
|
if (m !== 0) {
|
|
@@ -217,7 +217,7 @@ export const normalize = (a, output = null) => {
|
|
|
217
217
|
* @param {number | null | undefined} dist - The distance to rotate from (default: null).
|
|
218
218
|
* @returns {Point} The rotated point instance for chaining.
|
|
219
219
|
*/
|
|
220
|
-
export const rotate = (a, x, y, ang, asDegrees, dist) => {
|
|
220
|
+
export const rotate = (a: Point, x: number, y: number, ang: number, asDegrees: boolean, dist: number | null | undefined) => {
|
|
221
221
|
if (asDegrees) {
|
|
222
222
|
ang *= Math.PI / 180;
|
|
223
223
|
}
|
|
@@ -244,7 +244,7 @@ export const rotate = (a, x, y, ang, asDegrees, dist) => {
|
|
|
244
244
|
* @returns {Point} A new point representing the centroid of the input points.
|
|
245
245
|
* @throws {Error} If the points array is empty.
|
|
246
246
|
*/
|
|
247
|
-
export const centroid = (points, output = null) => {
|
|
247
|
+
export const centroid = (points: Point[], output: Point = null) => {
|
|
248
248
|
const result = output || new Point();
|
|
249
249
|
const pointsLen = points.length;
|
|
250
250
|
if (pointsLen < 1) {
|
|
@@ -268,7 +268,7 @@ export const centroid = (points, output = null) => {
|
|
|
268
268
|
* @param {string} yProp - The name of the property containing the y value (default: 'y').
|
|
269
269
|
* @returns {Point} A new point with parsed x and y values.
|
|
270
270
|
*/
|
|
271
|
-
export const parse = (obj, xProp = 'x', yProp = 'y') => {
|
|
271
|
+
export const parse = (obj: any, xProp: string = 'x', yProp: string = 'y') => {
|
|
272
272
|
const point = new Point();
|
|
273
273
|
if (obj[xProp]) {
|
|
274
274
|
point.x = Number.parseInt(obj[xProp], 10);
|
|
@@ -285,7 +285,7 @@ export const parse = (obj, xProp = 'x', yProp = 'y') => {
|
|
|
285
285
|
* @param {Point} output - The point to store the result in (optional).
|
|
286
286
|
* @returns {Point} A new point with the same coordinates as the input.
|
|
287
287
|
*/
|
|
288
|
-
export const clone = (input, output = null) => {
|
|
288
|
+
export const clone = (input: Point, output: Point = null) => {
|
|
289
289
|
const result = output || new Point();
|
|
290
290
|
result.setTo(input.x, input.y);
|
|
291
291
|
return result;
|
|
@@ -6,7 +6,7 @@ import { Polygon } from '../polygon.js';
|
|
|
6
6
|
* @param {Polygon} output - Optional polygon to store the result in.
|
|
7
7
|
* @returns {Polygon} The cloned polygon.
|
|
8
8
|
*/
|
|
9
|
-
export const clone = (input, output = null) => {
|
|
9
|
+
export const clone = (input: Polygon, output: Polygon = null) => {
|
|
10
10
|
const result = output || new Polygon();
|
|
11
11
|
result.setTo(input._points.slice());
|
|
12
12
|
return result;
|
|
@@ -8,7 +8,7 @@ import { Rectangle } from '../rectangle.js';
|
|
|
8
8
|
* @param {number} dy - The amount to inflate the rectangle vertically.
|
|
9
9
|
* @returns {Rectangle} The inflated rectangle.
|
|
10
10
|
*/
|
|
11
|
-
export const inflate = (a, dx, dy) => {
|
|
11
|
+
export const inflate = (a: Rectangle, dx: number, dy: number) => {
|
|
12
12
|
a.x -= dx;
|
|
13
13
|
a.width += 2 * dx;
|
|
14
14
|
a.y -= dy;
|
|
@@ -22,7 +22,7 @@ export const inflate = (a, dx, dy) => {
|
|
|
22
22
|
* @param {object} point - The point containing x and y values to inflate the rectangle by.
|
|
23
23
|
* @returns {Rectangle} The inflated rectangle.
|
|
24
24
|
*/
|
|
25
|
-
export const inflatePoint = (a, point) => {
|
|
25
|
+
export const inflatePoint = (a: Rectangle, point: any) => {
|
|
26
26
|
return inflate(a, point.x, point.y);
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ export const inflatePoint = (a, point) => {
|
|
|
32
32
|
* @param {Point} output - Optional point to store the result in.
|
|
33
33
|
* @returns {Point} The size of the rectangle as a point (width, height).
|
|
34
34
|
*/
|
|
35
|
-
export const size = (a, output = null) => {
|
|
35
|
+
export const size = (a: Rectangle, output: Point = null) => {
|
|
36
36
|
const result = output || new Point();
|
|
37
37
|
result.setTo(a.width, a.height);
|
|
38
38
|
return result;
|
|
@@ -44,7 +44,7 @@ export const size = (a, output = null) => {
|
|
|
44
44
|
* @param {Rectangle} output - Optional rectangle to store the result in.
|
|
45
45
|
* @returns {Rectangle} The cloned rectangle.
|
|
46
46
|
*/
|
|
47
|
-
export const clone = (input, output = null) => {
|
|
47
|
+
export const clone = (input: Rectangle, output: Rectangle = null) => {
|
|
48
48
|
const result = output || new Rectangle();
|
|
49
49
|
result.setTo(input.x, input.y, input.width, input.height);
|
|
50
50
|
return result;
|
|
@@ -57,7 +57,7 @@ export const clone = (input, output = null) => {
|
|
|
57
57
|
* @param {number} y - The y coordinate of the point.
|
|
58
58
|
* @returns {boolean} True if the point is contained within the rectangle, false otherwise.
|
|
59
59
|
*/
|
|
60
|
-
export const contains = (a, x, y) => {
|
|
60
|
+
export const contains = (a: Rectangle, x: number, y: number) => {
|
|
61
61
|
if (a.width <= 0 || a.height <= 0) {
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
@@ -74,7 +74,7 @@ export const contains = (a, x, y) => {
|
|
|
74
74
|
* @param {number} y - The y coordinate of the point.
|
|
75
75
|
* @returns {boolean} True if the point is contained within the rectangle, false otherwise.
|
|
76
76
|
*/
|
|
77
|
-
export const containsRaw = (rx, ry, rw, rh, x, y) => {
|
|
77
|
+
export const containsRaw = (rx: number, ry: number, rw: number, rh: number, x: number, y: number) => {
|
|
78
78
|
return x >= rx && x < rx + rw && y >= ry && y < ry + rh;
|
|
79
79
|
};
|
|
80
80
|
|
|
@@ -84,7 +84,7 @@ export const containsRaw = (rx, ry, rw, rh, x, y) => {
|
|
|
84
84
|
* @param {Point} point - The point to check.
|
|
85
85
|
* @returns {boolean} True if the point is contained within the rectangle, false otherwise.
|
|
86
86
|
*/
|
|
87
|
-
export const containsPoint = (a, point) => {
|
|
87
|
+
export const containsPoint = (a: Rectangle, point: Point) => {
|
|
88
88
|
return contains(a, point.x, point.y);
|
|
89
89
|
};
|
|
90
90
|
|
|
@@ -94,7 +94,7 @@ export const containsPoint = (a, point) => {
|
|
|
94
94
|
* @param {Rectangle} b - The second rectangle to check.
|
|
95
95
|
* @returns {boolean} True if rectangle a contains rectangle b, false otherwise.
|
|
96
96
|
*/
|
|
97
|
-
export const containsRect = (a, b) => {
|
|
97
|
+
export const containsRect = (a: Rectangle, b: Rectangle) => {
|
|
98
98
|
if (a.volume > b.volume) {
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
@@ -107,7 +107,7 @@ export const containsRect = (a, b) => {
|
|
|
107
107
|
* @param {Rectangle} b - The second rectangle to compare.
|
|
108
108
|
* @returns {boolean} True if the rectangles are equal, false otherwise.
|
|
109
109
|
*/
|
|
110
|
-
export const equals = (a, b) => {
|
|
110
|
+
export const equals = (a: Rectangle, b: Rectangle) => {
|
|
111
111
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
112
112
|
};
|
|
113
113
|
|
|
@@ -117,7 +117,7 @@ export const equals = (a, b) => {
|
|
|
117
117
|
* @param {Rectangle} b - The second rectangle to compare.
|
|
118
118
|
* @returns {boolean} True if the rectangles have the same dimensions, false otherwise.
|
|
119
119
|
*/
|
|
120
|
-
export const sameDimensions = (a, b) => {
|
|
120
|
+
export const sameDimensions = (a: Rectangle, b: Rectangle) => {
|
|
121
121
|
return a.width === b.width && a.height === b.height;
|
|
122
122
|
};
|
|
123
123
|
|
|
@@ -127,7 +127,7 @@ export const sameDimensions = (a, b) => {
|
|
|
127
127
|
* @param {Rectangle} b - The second rectangle to check.
|
|
128
128
|
* @returns {boolean} True if the rectangles intersect, false otherwise.
|
|
129
129
|
*/
|
|
130
|
-
export const intersects = (a, b) => {
|
|
130
|
+
export const intersects = (a: Rectangle, b: Rectangle) => {
|
|
131
131
|
if (a.width <= 0 || a.height <= 0 || b.width <= 0 || b.height <= 0) {
|
|
132
132
|
return false;
|
|
133
133
|
}
|
|
@@ -141,7 +141,7 @@ export const intersects = (a, b) => {
|
|
|
141
141
|
* @param {Rectangle} output - Optional rectangle to store the result in.
|
|
142
142
|
* @returns {Rectangle} The intersection of the rectangles, or an empty rectangle if they don't intersect.
|
|
143
143
|
*/
|
|
144
|
-
export const intersection = (a, b, output = null) => {
|
|
144
|
+
export const intersection = (a: Rectangle, b: Rectangle, output: Rectangle = null) => {
|
|
145
145
|
const result = output || new Rectangle();
|
|
146
146
|
if (intersects(a, b)) {
|
|
147
147
|
result.x = Math.max(a.x, b.x);
|
|
@@ -162,7 +162,7 @@ export const intersection = (a, b, output = null) => {
|
|
|
162
162
|
* @param {number} tolerance - Optional tolerance value for intersection.
|
|
163
163
|
* @returns {boolean} True if the rectangle intersects with the area, false otherwise.
|
|
164
164
|
*/
|
|
165
|
-
export const intersectsRaw = (a, left, right, top, bottom, tolerance = 0) => {
|
|
165
|
+
export const intersectsRaw = (a: Rectangle, left: number, right: number, top: number, bottom: number, tolerance: number = 0) => {
|
|
166
166
|
return !(
|
|
167
167
|
left > a.right + tolerance ||
|
|
168
168
|
right < a.left - tolerance ||
|
|
@@ -178,7 +178,7 @@ export const intersectsRaw = (a, left, right, top, bottom, tolerance = 0) => {
|
|
|
178
178
|
* @param {Rectangle} output - Optional rectangle to store the result in.
|
|
179
179
|
* @returns {Rectangle} The union of the rectangles.
|
|
180
180
|
*/
|
|
181
|
-
export const union = (a, b, output = null) => {
|
|
181
|
+
export const union = (a: Rectangle, b: Rectangle, output: Rectangle = null) => {
|
|
182
182
|
const result = output || new Rectangle();
|
|
183
183
|
return result.setTo(
|
|
184
184
|
Math.min(a.x, b.x),
|
|
@@ -194,7 +194,7 @@ export const union = (a, b, output = null) => {
|
|
|
194
194
|
* @param {Rectangle} output - Optional rectangle to store the result in.
|
|
195
195
|
* @returns {Rectangle} The AABB of the points.
|
|
196
196
|
*/
|
|
197
|
-
export const aabb = (points, output = null) => {
|
|
197
|
+
export const aabb = (points: Point[], output: Rectangle = null) => {
|
|
198
198
|
const result = output || new Rectangle();
|
|
199
199
|
let xMax = Number.NEGATIVE_INFINITY;
|
|
200
200
|
let xMin = Number.POSITIVE_INFINITY;
|
|
@@ -6,7 +6,7 @@ import { RoundedRectangle } from '../rounded_rectangle.js';
|
|
|
6
6
|
* @param {RoundedRectangle} output - Optional rounded rectangle to store the result in.
|
|
7
7
|
* @returns {RoundedRectangle} The cloned rounded rectangle.
|
|
8
8
|
*/
|
|
9
|
-
export const clone = (input, output = null) => {
|
|
9
|
+
export const clone = (input: RoundedRectangle, output: RoundedRectangle = null) => {
|
|
10
10
|
const result = output || new RoundedRectangle();
|
|
11
11
|
result.x = input.x;
|
|
12
12
|
result.y = input.y;
|