@woosh/meep-engine 2.48.22 → 2.49.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/editor/ecs/component/editors/three/BufferGeometryEditor.js +1 -1
- package/editor/ecs/component/editors/three/MeshEditor.js +1 -1
- package/editor/tools/GridPaintTool.js +1 -1
- package/editor/tools/SelectionTool.js +1 -1
- package/editor/tools/paint/TerrainPaintTool.js +1 -1
- package/editor/view/GridPickCoordinateView.js +1 -1
- package/editor/view/library/MeshLibraryView.js +1 -1
- package/package.json +1 -1
- package/src/core/UUID.js +2 -0
- package/src/core/assert.js +4 -1
- package/src/core/binary/32BitEncoder.js +1 -1
- package/src/core/binary/ctz32.js +1 -1
- package/src/core/binary/operations/bitCount.spec.js +19 -0
- package/src/core/binary/uint82float.spec.js +7 -0
- package/src/core/bvh2/LeafNode.js +2 -2
- package/src/core/bvh2/Node.d.ts +1 -1
- package/src/core/bvh2/Node.js +1 -1
- package/src/core/bvh2/NodeValidator.js +1 -1
- package/src/core/bvh2/bvh3/EBBVHLeafProxy.js +3 -0
- package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +5 -4
- package/src/core/bvh2/serialization/deserializeBinaryNode.js +1 -1
- package/src/core/bvh2/serialization/deserializeBinaryNodeFromBinaryBuffer.js +2 -2
- package/src/core/bvh2/serialization/serializeBinaryNode.js +1 -1
- package/src/core/bvh2/serialization/serializeBinaryNodeToBinaryBuffer.js +2 -2
- package/src/core/bvh2/transform/RotationOptimizer.spec.js +161 -155
- package/src/core/cache/Cache.js +4 -2
- package/src/core/codegen/LineBuilder.js +15 -3
- package/src/core/codegen/LineBuilder.spec.js +7 -0
- package/src/core/collection/HashMap.js +491 -236
- package/src/core/collection/HashMap.spec.js +110 -1
- package/src/core/collection/array/{typedArrayToDataType.js → typed/typedArrayToDataType.js} +1 -1
- package/src/core/collection/array/weightedRandomFromArray.spec.js +20 -0
- package/src/core/collection/heap/Uint32Heap.js +1 -0
- package/src/core/debug/matchers/AnyOf.js +1 -2
- package/src/core/events/signal/Signal.js +7 -5
- package/src/core/events/signal/SignalBinding.js +56 -54
- package/src/core/events/signal/SignalFlags.js +7 -0
- package/src/core/function/Functions.js +1 -1
- package/src/core/geom/{Rectangle.js → 2d/Rectangle.js} +5 -5
- package/src/core/geom/{AABB2.js → 2d/aabb/AABB2.js} +10 -78
- package/src/core/geom/2d/aabb/aabb2_compute_center_from_multiple.js +19 -0
- package/src/core/geom/2d/aabb/aabb2_compute_overlap.js +42 -0
- package/src/core/geom/2d/aabb/aabb2_contains.js +23 -0
- package/src/core/geom/2d/aabb/aabb2_distance_sqr_to_point.js +25 -0
- package/src/core/geom/2d/aabb/aabb2_distance_to_point.js +17 -0
- package/src/core/geom/2d/aabb/aabb2_distance_to_point.spec.js +17 -0
- package/src/core/geom/2d/aabb/aabb2_overlap_exists.js +18 -0
- package/src/core/geom/2d/aabb/aabb2_signed_distance_sqr_to_point.js +45 -0
- package/src/core/geom/2d/aabb/aabb2_signed_distance_sqr_to_point.spec.js +40 -0
- package/src/core/geom/2d/aabb/aabb2_signed_distance_to_point.js +27 -0
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +4 -0
- package/src/core/geom/2d/quad-tree/PointQuadTree.js +3 -0
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.js +1 -1
- package/src/core/geom/2d/quad-tree/QuadTreeNode.js +3 -3
- package/src/core/geom/2d/quad-tree/qt_collect_by_circle.js +6 -8
- package/src/core/geom/2d/quad-tree/qt_match_data_by_circle.js +3 -3
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +8 -10
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/AABB3.d.ts +1 -1
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/AABB3.js +13 -13
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/AABB3.spec.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_compute_plane_side.js +17 -15
- package/src/core/geom/3d/aabb/aabb3_compute_plane_side.spec.js +25 -0
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.js +3 -0
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.spec.js +32 -0
- package/src/core/geom/3d/aabb/aabb3_intersects_aabb3.spec.js +115 -0
- package/src/core/geom/3d/aabb/aabb3_raycast.js +6 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js +13 -9
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/serializeAABB3Encoded_v0.js +6 -6
- package/src/core/geom/3d/{CircleMath.js → compute_circle_bounding_box.js} +1 -1
- package/src/core/geom/3d/decompose_matrix_4_array.js +18 -19
- package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/src/{engine/graphics/ecs/mesh-v2 → core/geom/3d/matrix}/allocate_transform_m4.js +1 -1
- package/src/core/geom/3d/normal/hemioct/decode_hemioct_to_unit.js +26 -0
- package/src/core/geom/3d/normal/hemioct/encode_unit3_hemioct.js +0 -26
- package/src/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +2 -1
- package/src/core/geom/3d/plane/computePlaneLineIntersection.js +51 -0
- package/src/core/geom/3d/plane/computePlanePlaneIntersection.js +77 -0
- package/src/core/geom/3d/plane/computePlaneRayIntersection.js +55 -0
- package/src/core/geom/3d/plane/plane3_computeLineSegmentIntersection.js +50 -0
- package/src/core/geom/3d/plane/planeRayIntersection.js +14 -0
- package/src/core/geom/3d/{tetrahedra/in_sphere_fast.js → sphere/in_sphere3d_fast.js} +1 -1
- package/src/core/geom/3d/{tetrahedra/in_sphere_robust.js → sphere/in_sphere3d_robust.js} +1 -1
- package/src/core/geom/3d/sphere/sphere_array_intersects_point.js +2 -2
- package/src/core/geom/3d/sphere/{sphereIntersectsPoint.js → sphere_intersects_point.js} +7 -4
- package/src/core/geom/3d/sphere/sphere_intersects_point.spec.js +134 -0
- package/src/core/geom/3d/sphere/sphere_intersects_ray.spec.js +49 -0
- package/src/core/geom/3d/sphere/sphere_radius_sqr_from_v3_array_transformed.js +11 -7
- package/src/core/geom/3d/tetrahedra/delaunay/{debug_validate_mesh.js → debug/debug_validate_mesh.js} +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/{push_boundary_with_validation.js → debug/push_boundary_with_validation.js} +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/{validate_cavity_boundary.js → debug/validate_cavity_boundary.js} +2 -2
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_cavity.js +2 -2
- package/src/core/geom/3d/triangle/computeTriangleRayIntersection.js +0 -164
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +87 -0
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js +81 -0
- package/src/core/geom/{GeometryMath.js → 3d/triangle/rayTriangleIntersection.js} +7 -3
- package/src/core/geom/ConicRay.js +160 -152
- package/src/core/geom/Matrix4.js +2 -0
- package/src/core/geom/Quaternion.js +19 -1
- package/src/core/geom/packing/max-rect/MaxRectangles.js +5 -215
- package/src/core/geom/packing/max-rect/cost/costByBestShortSide.js +11 -0
- package/src/core/geom/packing/max-rect/cost/costByRemainingArea.js +14 -0
- package/src/core/geom/packing/max-rect/cutArea.js +79 -0
- package/src/core/geom/packing/max-rect/findBestContainer.js +58 -0
- package/src/core/geom/packing/max-rect/packOneBox.js +49 -0
- package/src/core/geom/v3_dot.js +1 -1
- package/src/core/graph/GraphUtils.js +1 -1
- package/src/core/graph/build_face_graph_from_mesh.js +1 -3
- package/src/core/graph/layout/CircleLayout.js +3 -3
- package/src/core/graph/layout/{BoxLayouter.js → box/BoxLayouter.js} +6 -50
- package/src/core/graph/layout/box/applyCentralGravityAABB2.js +29 -0
- package/src/core/json/resolvePath.spec.js +14 -0
- package/src/core/land/reactive/{compiler/ReactiveCompiler.spec.js → compileReactiveExpression.spec.js} +17 -17
- package/src/core/math/random/MersenneTwister.spec.js +19 -0
- package/src/core/math/random/randomGaussian.spec.js +9 -0
- package/src/core/math/statistics/computeStatisticalMean.js +2 -2
- package/src/core/model/node-graph/visual/NodeVisualData.js +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveAdd.js +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveDivide.js +3 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveMultiply.js +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveNegate.js +3 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveSubtract.js +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveEquals.js +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveGreaterThan.js +3 -1
- package/src/core/model/reactive/model/comparative/ReactiveGreaterThanOrEqual.js +3 -1
- package/src/core/model/reactive/model/comparative/ReactiveLessThan.js +3 -1
- package/src/core/model/reactive/model/comparative/ReactiveLessThanOrEqual.js +3 -1
- package/src/core/model/reactive/model/comparative/ReactiveNotEquals.js +1 -1
- package/src/core/model/reactive/model/logic/ReactiveAnd.js +1 -1
- package/src/core/model/reactive/model/logic/ReactiveNot.js +3 -1
- package/src/core/model/reactive/model/logic/ReactiveOr.js +1 -1
- package/src/core/primitives/numbers/computeHashFloat.spec.js +7 -0
- package/src/core/process/task/util/iteratorTask.js +3 -1
- package/src/engine/animation/curve/AnimationCurve.js +34 -5
- package/src/engine/animation/curve/AnimationCurve.spec.js +100 -0
- package/src/engine/asset/AssetTransformer.js +1 -0
- package/src/engine/asset/loaders/GLTFAssetLoader.js +1 -1
- package/src/engine/asset/loaders/image/ImageRGBADataLoader.js +2 -2
- package/src/engine/asset/preloader/Preloader.js +3 -3
- package/src/engine/computeStridedIntegerArrayHash.js +4 -2
- package/src/engine/ecs/components/Renderable.d.ts +2 -2
- package/src/engine/ecs/components/Renderable.js +1 -1
- package/src/{ecs → engine/ecs}/grid/pick.js +4 -4
- package/src/engine/ecs/gui/position/ViewportPositionSystem.js +1 -1
- package/src/engine/ecs/parent/entity_node_compute_bounding_box.js +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +1 -18
- package/src/engine/ecs/systems/MotionSystem.js +7 -1
- package/src/engine/ecs/systems/SynchronizePositionSystem.js +8 -2
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +2 -2
- package/src/engine/ecs/tooltip/TooltipComponentSystem.js +1 -1
- package/src/engine/ecs/transform/Transform.js +1 -1
- package/src/engine/graphics/camera/makeScreenScissorFrustum.d.ts +1 -1
- package/src/engine/graphics/camera/makeScreenScissorFrustum.js +3 -3
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +13 -13
- package/src/engine/graphics/ecs/camera/Camera.js +1 -1
- package/src/engine/graphics/ecs/light/LightSystem.js +1 -1
- package/src/engine/graphics/ecs/mesh/Mesh.d.ts +1 -1
- package/src/engine/graphics/ecs/mesh/Mesh.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.d.ts +1 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js +9 -0
- package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.d.ts +1 -1
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +1 -1
- package/src/engine/graphics/geometry/MikkT/STSpace.js +1 -1
- package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +1 -1
- package/src/engine/graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js +1 -1
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
- package/src/engine/graphics/particles/particular/engine/MovingBoundingBox.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +1 -0
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/src/engine/graphics/postprocess/threejs/postprocessing/TexturePass.js +2 -2
- package/src/engine/graphics/render/forward_plus/debug/createScreenGrid.js +1 -1
- package/src/engine/graphics/render/view/CameraView.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +2 -2
- package/src/engine/graphics/texture/atlas/AtlasPatch.js +2 -2
- package/src/engine/graphics/texture/atlas/TextureAtlas.spec.js +2 -2
- package/src/engine/graphics/texture/sampler/Sampler2D.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js +1 -1
- package/src/engine/graphics/util/makeMeshPreviewScene.js +1 -1
- package/src/engine/graphics/util/renderObjectToSampler2D.js +1 -1
- package/src/engine/intelligence/behavior/Behavior.spec.js +15 -0
- package/src/engine/intelligence/mcts/MoveEdge.js +1 -1
- package/src/engine/reference/v1/ReferenceManager.js +3 -0
- package/src/engine/reference/v2/Reference.js +33 -37
- package/src/engine/sound/sopra/README.md +6 -0
- package/src/engine/ui/tiles2d/computeTileGridMove.js +3 -2
- package/src/engine/ui/tiles2d/computeTileGridMove.spec.js +1 -1
- package/src/generation/automata/CaveGeneratorCellularAutomata.js +10 -7
- package/src/generation/automata/CaveGeneratorCellularAutomata.spec.js +12 -0
- package/src/generation/automata/CellularAutomata.js +5 -4
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +25 -9
- package/src/generation/theme/AreaMask.js +1 -1
- package/src/view/View.js +1 -1
- package/src/view/elements/progress/RectangularPieProgressView.js +1 -1
- package/src/view/minimap/Minimap.js +1 -1
- package/src/view/minimap/dom/MinimapCameraView.js +1 -1
- package/src/view/minimap/gl/MinimapFogOfWar.js +1 -1
- package/src/view/tooltip/DomTooltipObserver.js +1 -1
- package/src/view/tooltip/TooltipManager.js +1 -1
- package/src/view/tooltip/TooltipView.js +1 -1
- package/src/view/util/DomSizeObserver.js +2 -2
- package/src/core/geom/2d/AABB2Math.js +0 -40
- package/src/core/geom/2d/AABB2Math.spec.js +0 -17
- package/src/core/geom/Plane.js +0 -250
- package/src/core/land/reactive/ReactiveLexer.js +0 -158
- package/src/core/land/reactive/ReactiveLexer.ts +0 -181
- package/src/core/land/reactive/ReactiveListener.ts +0 -323
- package/src/core/land/reactive/ReactiveParser.js +0 -1573
- package/src/core/land/reactive/ReactiveParser.ts +0 -1776
- package/src/core/land/reactive/ReactiveVisitor.js +0 -1
- package/src/core/land/reactive/ReactiveVisitor.ts +0 -218
- package/src/core/land/reactive/compiler/ReactiveCompiler.js +0 -350
- package/src/core/land/reactive/compiler/ReactiveNearlyCompiler.js +0 -166
- package/src/core/land/reactive/compiler/ReactiveParser.js +0 -34
- package/src/core/land/reactive/nearley/ReactiveNearley.js +0 -187
- /package/src/core/geom/{LineSegment2.js → 2d/LineSegment2.js} +0 -0
- /package/src/core/geom/{Rectangle.spec.js → 2d/Rectangle.spec.js} +0 -0
- /package/src/core/geom/{AABB2.d.ts → 2d/aabb/AABB2.d.ts} +0 -0
- /package/src/core/geom/{AABB2.spec.js → 2d/aabb/AABB2.spec.js} +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/deserializeAABB3.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/deserializeAABB3Encoded_v0.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/deserializeAABB3Quantized16Uint.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/serializeAABB3.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/serializeAABB3Quantized16Uint.js +0 -0
- /package/src/{engine/graphics/ecs/mesh-v2 → core/geom/3d/vector}/allocate_v3.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HashMap } from "./HashMap.js";
|
|
1
|
+
import { generate_next_linear_congruential_index, HashMap } from "./HashMap.js";
|
|
2
2
|
import { passThrough, returnOne, strictEquals } from "../function/Functions.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -16,6 +16,7 @@ function makeSample() {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
|
|
19
20
|
test('put and get same value', () => {
|
|
20
21
|
const m = makeSample();
|
|
21
22
|
|
|
@@ -107,6 +108,44 @@ test("retrieval works as intended after hash map grows", () => {
|
|
|
107
108
|
|
|
108
109
|
});
|
|
109
110
|
|
|
111
|
+
test("after deletion element is not found", () => {
|
|
112
|
+
const map = new HashMap({
|
|
113
|
+
keyHashFunction: passThrough,
|
|
114
|
+
keyEqualityFunction: strictEquals,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
map.set(1, "a");
|
|
118
|
+
|
|
119
|
+
map.delete(1);
|
|
120
|
+
|
|
121
|
+
expect(map.size).toBe(0);
|
|
122
|
+
expect(map.get(1)).toBeUndefined();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test("deleting an element then inserting another one all with hash collisions", () => {
|
|
126
|
+
const map = new HashMap({
|
|
127
|
+
keyHashFunction: returnOne,
|
|
128
|
+
keyEqualityFunction: strictEquals,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
map.set(1, "a");
|
|
132
|
+
map.set(7, "b");
|
|
133
|
+
|
|
134
|
+
map.delete(1);
|
|
135
|
+
|
|
136
|
+
expect(map.get(7)).toBe("b");
|
|
137
|
+
expect(map.get(1)).toBeUndefined();
|
|
138
|
+
|
|
139
|
+
map.set(13, "c");
|
|
140
|
+
|
|
141
|
+
expect(map.get(13)).toBe("c");
|
|
142
|
+
|
|
143
|
+
map.delete(13);
|
|
144
|
+
|
|
145
|
+
expect(map.get(7)).toBe("b");
|
|
146
|
+
expect(map.get(13)).toBeUndefined();
|
|
147
|
+
});
|
|
148
|
+
|
|
110
149
|
|
|
111
150
|
test("key iterator", () => {
|
|
112
151
|
const map = new HashMap({
|
|
@@ -129,3 +168,73 @@ test("value iterator", () => {
|
|
|
129
168
|
|
|
130
169
|
expect(map.values().next().value).toBe("hello");
|
|
131
170
|
});
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
test("clear works as expected", () => {
|
|
174
|
+
const map = new HashMap({
|
|
175
|
+
keyHashFunction: passThrough,
|
|
176
|
+
keyEqualityFunction: strictEquals
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
map.set(7, "hello");
|
|
180
|
+
|
|
181
|
+
map.clear();
|
|
182
|
+
|
|
183
|
+
expect(map.get(7)).toBe(undefined);
|
|
184
|
+
expect(map.size).toBe(0);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("lcg 32", () => {
|
|
188
|
+
const generated = new Uint32Array(32);
|
|
189
|
+
|
|
190
|
+
let next = 0;
|
|
191
|
+
for (let i = 0; i < 32; i++) {
|
|
192
|
+
|
|
193
|
+
generated[i] = next;
|
|
194
|
+
|
|
195
|
+
next = generate_next_linear_congruential_index(next, 31);
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
generated.sort();
|
|
200
|
+
|
|
201
|
+
for (let i = 0; i < 32; i++) {
|
|
202
|
+
expect(generated[i]).toBe(i);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
test.skip("performance - random fill 100,000", () => {
|
|
208
|
+
const map = new HashMap({
|
|
209
|
+
keyHashFunction: passThrough,
|
|
210
|
+
keyEqualityFunction: strictEquals
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const map_warmup = new HashMap({
|
|
214
|
+
keyHashFunction: passThrough,
|
|
215
|
+
keyEqualityFunction: strictEquals
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// warm up
|
|
219
|
+
for (let i = 0; i < 10000; i++) {
|
|
220
|
+
map_warmup.set(i, i);
|
|
221
|
+
map_warmup.get(i);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const t0 = performance.now();
|
|
225
|
+
|
|
226
|
+
for (let i = 0; i < 100000; i++) {
|
|
227
|
+
map.set(i, i);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const t1 = performance.now();
|
|
231
|
+
|
|
232
|
+
for (let i = 0; i < 100000; i++) {
|
|
233
|
+
map.get(i);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const t2 = performance.now();
|
|
237
|
+
|
|
238
|
+
console.log(`Fill: ${t1 - t0}ms`)
|
|
239
|
+
console.log(`Drain: ${t2 - t1}ms`)
|
|
240
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { weightedRandomFromArray } from "./weightedRandomFromArray.js";
|
|
2
|
+
import { passThrough, returnOne, returnZero } from "../../function/Functions.js";
|
|
3
|
+
|
|
4
|
+
test("empty array", () => {
|
|
5
|
+
expect(weightedRandomFromArray([], returnZero, passThrough, null, 0))
|
|
6
|
+
.toBeUndefined();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test("single element array", () => {
|
|
10
|
+
expect(weightedRandomFromArray([1], returnZero, passThrough, null, 1))
|
|
11
|
+
.toBe(1);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test("two elements", () => {
|
|
15
|
+
expect(weightedRandomFromArray([1,3], returnZero, passThrough, null, 2))
|
|
16
|
+
.toBe(1);
|
|
17
|
+
|
|
18
|
+
expect(weightedRandomFromArray([1,3], returnOne, passThrough, null, 2))
|
|
19
|
+
.toBe(3);
|
|
20
|
+
});
|
|
@@ -49,6 +49,7 @@ function HEAP_RIGHT(i) {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Binary Heap implementation that stores uin32 ID along with a floating point score value
|
|
52
|
+
* Very fast and compact
|
|
52
53
|
* Inspired by Blender's heap implementation found here: https://github.com/blender/blender/blob/594f47ecd2d5367ca936cf6fc6ec8168c2b360d0/source/blender/blenlib/intern/BLI_heap.c
|
|
53
54
|
*/
|
|
54
55
|
export class Uint32Heap {
|
|
@@ -20,8 +20,7 @@ export class AnyOf extends BaseMatcher {
|
|
|
20
20
|
|
|
21
21
|
matches(item, mismatch_description) {
|
|
22
22
|
for (const matcher of this.#matchers) {
|
|
23
|
-
if (
|
|
24
|
-
|
|
23
|
+
if (matcher.matches(item, NullDescription.INSTANCE)) {
|
|
25
24
|
return true;
|
|
26
25
|
}
|
|
27
26
|
}
|
|
@@ -41,6 +41,7 @@ export class Signal {
|
|
|
41
41
|
* @returns {boolean}
|
|
42
42
|
*/
|
|
43
43
|
get dispatching() {
|
|
44
|
+
console.warn('deprecated, use .isDispatching instead');
|
|
44
45
|
return this.getFlag(SignalFlags.Dispatching);
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -49,6 +50,7 @@ export class Signal {
|
|
|
49
50
|
* @param {boolean} v
|
|
50
51
|
*/
|
|
51
52
|
set dispatching(v) {
|
|
53
|
+
console.warn('deprecated, flag should not be written to from outside of the signal');
|
|
52
54
|
this.writeFlag(SignalFlags.Dispatching, v);
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -147,7 +149,7 @@ export class Signal {
|
|
|
147
149
|
* @param {*} [context]
|
|
148
150
|
*/
|
|
149
151
|
addOne(h, context) {
|
|
150
|
-
assert.isFunction(
|
|
152
|
+
assert.isFunction(h, "handler");
|
|
151
153
|
|
|
152
154
|
const handler = new SignalHandler(h, context);
|
|
153
155
|
|
|
@@ -209,12 +211,12 @@ export class Signal {
|
|
|
209
211
|
}
|
|
210
212
|
|
|
211
213
|
//mark dispatch process
|
|
212
|
-
this.
|
|
214
|
+
this.setFlag(SignalFlags.Dispatching);
|
|
213
215
|
|
|
214
216
|
dispatchViaProxy(this.handlers, args);
|
|
215
217
|
|
|
216
218
|
//mark end of dispatch process
|
|
217
|
-
this.
|
|
219
|
+
this.clearFlag(SignalFlags.Dispatching);
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
/**
|
|
@@ -588,11 +590,11 @@ export class Signal {
|
|
|
588
590
|
}
|
|
589
591
|
|
|
590
592
|
/**
|
|
591
|
-
*
|
|
593
|
+
* @deprecated do not use
|
|
592
594
|
* @returns {boolean}
|
|
593
595
|
*/
|
|
594
596
|
isDispatching() {
|
|
595
|
-
return this.
|
|
597
|
+
return this.getFlag(SignalFlags.Dispatching);
|
|
596
598
|
}
|
|
597
599
|
|
|
598
600
|
/**
|
|
@@ -4,73 +4,75 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
export class SignalBinding {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {Signal} signal
|
|
11
|
+
* @param {function} handler
|
|
12
|
+
* @param {*} [context]
|
|
13
|
+
* @constructor
|
|
14
|
+
*/
|
|
15
|
+
constructor(signal, handler, context) {
|
|
16
|
+
if (typeof handler !== "function") {
|
|
17
|
+
throw new TypeError(`handler must be a function, instead was ${handler}`);
|
|
18
|
+
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
if (typeof signal !== "object") {
|
|
21
|
+
throw new TypeError(`signal must be of an object, instead was ${signal}`)
|
|
22
|
+
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
if (typeof signal.add !== "function") {
|
|
25
|
+
throw new TypeError(`signal.add must be a function, instead was ${signal.add}`);
|
|
26
|
+
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Binding signal
|
|
30
|
+
* @type {Signal}
|
|
31
|
+
*/
|
|
32
|
+
this.signal = signal;
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Signal handler to be attached to the signal
|
|
36
|
+
* @type {Function}
|
|
37
|
+
*/
|
|
38
|
+
this.handler = handler;
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @type {*}
|
|
43
|
+
*/
|
|
44
|
+
this.context = context;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* State flag
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
*/
|
|
50
|
+
this.linked = false;
|
|
51
|
+
}
|
|
44
52
|
|
|
45
53
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
54
|
+
* Attaches handler to the signal
|
|
55
|
+
* Idempotent
|
|
48
56
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
link() {
|
|
58
|
+
if (this.linked) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
51
61
|
|
|
52
|
-
/**
|
|
53
|
-
* Attaches handler to the signal
|
|
54
|
-
* Idempotent
|
|
55
|
-
*/
|
|
56
|
-
SignalBinding.prototype.link = function () {
|
|
57
|
-
if (!this.linked) {
|
|
58
62
|
this.linked = true;
|
|
59
63
|
this.signal.add(this.handler, this.context);
|
|
60
64
|
}
|
|
61
|
-
};
|
|
62
65
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Detaches handler from the signal
|
|
68
|
+
* Idempotent
|
|
69
|
+
*/
|
|
70
|
+
unlink() {
|
|
71
|
+
if (!this.linked) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
this.linked = false;
|
|
70
76
|
this.signal.remove(this.handler, this.context);
|
|
71
77
|
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export {
|
|
75
|
-
SignalBinding
|
|
76
|
-
};
|
|
78
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Alex on 14/03/2016.
|
|
3
3
|
*/
|
|
4
|
-
import { max2 } from "
|
|
5
|
-
import { min2 } from "
|
|
6
|
-
import Vector2 from "
|
|
7
|
-
import { intersects1D } from "
|
|
8
|
-
import { overlap1D } from "
|
|
4
|
+
import { max2 } from "../../math/max2.js";
|
|
5
|
+
import { min2 } from "../../math/min2.js";
|
|
6
|
+
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 {
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
import { assert } from "
|
|
8
|
-
import { clamp } from "
|
|
9
|
-
import { max2 } from "
|
|
10
|
-
import { min2 } from "
|
|
11
|
-
import LineSegment2 from "
|
|
12
|
-
import Vector2 from "
|
|
13
|
-
import {
|
|
7
|
+
import { assert } from "../../../assert.js";
|
|
8
|
+
import { clamp } from "../../../math/clamp.js";
|
|
9
|
+
import { max2 } from "../../../math/max2.js";
|
|
10
|
+
import { min2 } from "../../../math/min2.js";
|
|
11
|
+
import LineSegment2 from "../LineSegment2.js";
|
|
12
|
+
import Vector2 from "../../Vector2.js";
|
|
13
|
+
import { aabb2_compute_overlap } from "./aabb2_compute_overlap.js";
|
|
14
|
+
import { aabb2_overlap_exists } from "./aabb2_overlap_exists.js";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
*
|
|
@@ -137,7 +138,7 @@ class AABB2 {
|
|
|
137
138
|
const bx1 = other.x1;
|
|
138
139
|
const by1 = other.y1;
|
|
139
140
|
|
|
140
|
-
return
|
|
141
|
+
return aabb2_compute_overlap(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1, result);
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
/**
|
|
@@ -156,7 +157,7 @@ class AABB2 {
|
|
|
156
157
|
const bx1 = other.x1;
|
|
157
158
|
const by1 = other.y1;
|
|
158
159
|
|
|
159
|
-
return
|
|
160
|
+
return aabb2_overlap_exists(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1);
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
/**
|
|
@@ -583,74 +584,5 @@ AABB2.zero = Object.freeze(new AABB2(0, 0, 0, 0));
|
|
|
583
584
|
*/
|
|
584
585
|
AABB2.unit = Object.freeze(new AABB2(0, 0, 1, 1));
|
|
585
586
|
|
|
586
|
-
/**
|
|
587
|
-
*
|
|
588
|
-
* @param {number} ax0
|
|
589
|
-
* @param {number} ay0
|
|
590
|
-
* @param {number} ax1
|
|
591
|
-
* @param {number} ay1
|
|
592
|
-
* @param {number} bx0
|
|
593
|
-
* @param {number} by0
|
|
594
|
-
* @param {number} bx1
|
|
595
|
-
* @param {number} by1
|
|
596
|
-
* @returns {boolean} true if overlap exists, false if no overlap
|
|
597
|
-
*/
|
|
598
|
-
export function aabb2_overlapExists(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1) {
|
|
599
|
-
return overlap1D(ax0, ax1, bx0, bx1)
|
|
600
|
-
&& overlap1D(ay0, ay1, by0, by1);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
*
|
|
605
|
-
* @param {number} bounds_x0
|
|
606
|
-
* @param {number} bounds_y0
|
|
607
|
-
* @param {number} bounds_x1
|
|
608
|
-
* @param {number} bounds_y1
|
|
609
|
-
* @param {number} x0
|
|
610
|
-
* @param {number} y0
|
|
611
|
-
* @param {number} x1
|
|
612
|
-
* @param {number} y1
|
|
613
|
-
* @return {boolean}
|
|
614
|
-
*/
|
|
615
|
-
export function aabb2_contains(bounds_x0, bounds_y0, bounds_x1, bounds_y1, x0, y0, x1, y1) {
|
|
616
|
-
|
|
617
|
-
return x0 >= bounds_x0 && x1 <= bounds_x1 && y0 >= bounds_y0 && y1 <= bounds_y1;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
*
|
|
622
|
-
* @param {number} ax0
|
|
623
|
-
* @param {number} ay0
|
|
624
|
-
* @param {number} ax1
|
|
625
|
-
* @param {number} ay1
|
|
626
|
-
* @param {number} bx0
|
|
627
|
-
* @param {number} by0
|
|
628
|
-
* @param {number} bx1
|
|
629
|
-
* @param {number} by1
|
|
630
|
-
* @param {AABB2} result
|
|
631
|
-
* @returns {boolean} true if overlap exists, false if no overlap
|
|
632
|
-
*/
|
|
633
|
-
function computeOverlap(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1, result) {
|
|
634
|
-
const x0 = max2(ax0, bx0);
|
|
635
|
-
const x1 = min2(ax1, bx1);
|
|
636
|
-
|
|
637
|
-
if (x0 >= x1) {
|
|
638
|
-
//no overlap
|
|
639
|
-
return false;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
const y0 = max2(ay0, by0);
|
|
643
|
-
const y1 = min2(ay1, by1);
|
|
644
|
-
|
|
645
|
-
if (y0 >= y1) {
|
|
646
|
-
//no overlap
|
|
647
|
-
return false;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
result.set(x0, y0, x1, y1);
|
|
651
|
-
|
|
652
|
-
return true;
|
|
653
|
-
}
|
|
654
|
-
|
|
655
587
|
|
|
656
588
|
export default AABB2;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Vector2 from "../../Vector2.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {Array.<AABB2>} boxes
|
|
6
|
+
* @returns {Vector2}
|
|
7
|
+
*/
|
|
8
|
+
export function aabb2_compute_center_from_multiple(boxes) {
|
|
9
|
+
const numBoxes = boxes.length;
|
|
10
|
+
|
|
11
|
+
const center = new Vector2();
|
|
12
|
+
for (let i = 0; i < numBoxes; i++) {
|
|
13
|
+
const box = boxes[i];
|
|
14
|
+
center._add(box.midX(), box.midY());
|
|
15
|
+
}
|
|
16
|
+
center.multiplyScalar(1 / numBoxes);
|
|
17
|
+
|
|
18
|
+
return center;
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { max2 } from "../../../math/max2.js";
|
|
2
|
+
import { min2 } from "../../../math/min2.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {number} ax0
|
|
7
|
+
* @param {number} ay0
|
|
8
|
+
* @param {number} ax1
|
|
9
|
+
* @param {number} ay1
|
|
10
|
+
* @param {number} bx0
|
|
11
|
+
* @param {number} by0
|
|
12
|
+
* @param {number} bx1
|
|
13
|
+
* @param {number} by1
|
|
14
|
+
* @param {AABB2} result
|
|
15
|
+
* @returns {boolean} true if overlap exists, false if no overlap
|
|
16
|
+
*/
|
|
17
|
+
export function aabb2_compute_overlap(
|
|
18
|
+
ax0, ay0, ax1, ay1,
|
|
19
|
+
bx0, by0, bx1, by1,
|
|
20
|
+
result
|
|
21
|
+
) {
|
|
22
|
+
|
|
23
|
+
const x0 = max2(ax0, bx0);
|
|
24
|
+
const x1 = min2(ax1, bx1);
|
|
25
|
+
|
|
26
|
+
if (x0 >= x1) {
|
|
27
|
+
//no overlap
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const y0 = max2(ay0, by0);
|
|
32
|
+
const y1 = min2(ay1, by1);
|
|
33
|
+
|
|
34
|
+
if (y0 >= y1) {
|
|
35
|
+
//no overlap
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
result.set(x0, y0, x1, y1);
|
|
40
|
+
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} bounds_x0
|
|
4
|
+
* @param {number} bounds_y0
|
|
5
|
+
* @param {number} bounds_x1
|
|
6
|
+
* @param {number} bounds_y1
|
|
7
|
+
* @param {number} x0
|
|
8
|
+
* @param {number} y0
|
|
9
|
+
* @param {number} x1
|
|
10
|
+
* @param {number} y1
|
|
11
|
+
* @return {boolean}
|
|
12
|
+
*/
|
|
13
|
+
export function aabb2_contains(
|
|
14
|
+
bounds_x0, bounds_y0, bounds_x1, bounds_y1,
|
|
15
|
+
x0, y0, x1, y1
|
|
16
|
+
) {
|
|
17
|
+
|
|
18
|
+
return x0 >= bounds_x0
|
|
19
|
+
&& x1 <= bounds_x1
|
|
20
|
+
&& y0 >= bounds_y0
|
|
21
|
+
&& y1 <= bounds_y1
|
|
22
|
+
;
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { max3 } from "../../../math/max3.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* NOTE: The result is not a signed distance, any degree of penetration will produce 0 distance as a result
|
|
5
|
+
* @param {number} x0
|
|
6
|
+
* @param {number} y0
|
|
7
|
+
* @param {number} x1
|
|
8
|
+
* @param {number} y1
|
|
9
|
+
* @param {number} px
|
|
10
|
+
* @param {number} py
|
|
11
|
+
* @returns {number}
|
|
12
|
+
*/
|
|
13
|
+
export function aabb2_distance_sqr_to_point(x0, y0, x1, y1, px, py) {
|
|
14
|
+
|
|
15
|
+
const dx0 = x0 - px;
|
|
16
|
+
const dx1 = px - x1;
|
|
17
|
+
|
|
18
|
+
const dy0 = y0 - py;
|
|
19
|
+
const dy1 = py - y1;
|
|
20
|
+
|
|
21
|
+
const dx = max3(0, dx0, dx1);
|
|
22
|
+
const dy = max3(0, dy0, dy1);
|
|
23
|
+
|
|
24
|
+
return dx * dx + dy * dy;
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { aabb2_distance_sqr_to_point } from "./aabb2_distance_sqr_to_point.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} x0
|
|
6
|
+
* @param {number} y0
|
|
7
|
+
* @param {number} x1
|
|
8
|
+
* @param {number} y1
|
|
9
|
+
* @param {number} px
|
|
10
|
+
* @param {number} py
|
|
11
|
+
* @returns {number}
|
|
12
|
+
*/
|
|
13
|
+
export function aabb2_distance_to_point(x0, y0, x1, y1, px, py) {
|
|
14
|
+
const sqrD = aabb2_distance_sqr_to_point(x0, y0, x1, y1, px, py);
|
|
15
|
+
return Math.sqrt(sqrD);
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { aabb2_distance_to_point } from "./aabb2_distance_to_point.js";
|
|
2
|
+
|
|
3
|
+
test('aabb2_distance_to_point', () => {
|
|
4
|
+
expect(aabb2_distance_to_point(0, 0, 0, 0, 0, 0)).toBeCloseTo(0);
|
|
5
|
+
|
|
6
|
+
expect(aabb2_distance_to_point(0, 0, 0, 0, 1, 0)).toBeCloseTo(1);
|
|
7
|
+
expect(aabb2_distance_to_point(0, 0, 0, 0, 0, 1)).toBeCloseTo(1);
|
|
8
|
+
|
|
9
|
+
expect(aabb2_distance_to_point(0, 0, 0, 0, 1, 1)).toBeCloseTo(1.41421356237);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
expect(aabb2_distance_to_point(0, 0, 1, 1, 2, 0.5)).toBeCloseTo(1);
|
|
13
|
+
expect(aabb2_distance_to_point(0, 0, 1, 1, 0.5, 2)).toBeCloseTo(1);
|
|
14
|
+
|
|
15
|
+
expect(aabb2_distance_to_point(0, 0, 1, 1, -1, 0.5)).toBeCloseTo(1);
|
|
16
|
+
expect(aabb2_distance_to_point(0, 0, 1, 1, 0.5, -1)).toBeCloseTo(1);
|
|
17
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { overlap1D } from "../../../math/interval/overlap1D.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} ax0
|
|
6
|
+
* @param {number} ay0
|
|
7
|
+
* @param {number} ax1
|
|
8
|
+
* @param {number} ay1
|
|
9
|
+
* @param {number} bx0
|
|
10
|
+
* @param {number} by0
|
|
11
|
+
* @param {number} bx1
|
|
12
|
+
* @param {number} by1
|
|
13
|
+
* @returns {boolean} true if overlap exists, false if no overlap
|
|
14
|
+
*/
|
|
15
|
+
export function aabb2_overlap_exists(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1) {
|
|
16
|
+
return overlap1D(ax0, ax1, bx0, bx1)
|
|
17
|
+
&& overlap1D(ay0, ay1, by0, by1);
|
|
18
|
+
}
|