@woosh/meep-engine 2.110.7 → 2.110.9
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-terrain.js +1 -1
- package/build/meep.cjs +115 -119
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +115 -119
- package/editor/tools/v2/TransformControls.js +11 -6
- package/package.json +2 -1
- package/src/core/UUID.d.ts +3 -0
- package/src/core/UUID.d.ts.map +1 -1
- package/src/core/UUID.js +9 -7
- package/src/core/collection/array/arraySetDiff.d.ts.map +1 -1
- package/src/core/collection/array/arraySetDiff.js +0 -1
- package/src/core/collection/array/binarySearchHighIndex.d.ts.map +1 -1
- package/src/core/collection/array/binarySearchHighIndex.js +7 -1
- package/src/core/collection/array/computeHashArray.d.ts.map +1 -1
- package/src/core/collection/array/computeHashArray.js +3 -2
- package/src/core/collection/array/fastArrayEquals.d.ts +1 -0
- package/src/core/collection/array/fastArrayEquals.d.ts.map +1 -1
- package/src/core/collection/array/fastArrayEquals.js +1 -0
- package/src/core/collection/array/isArrayEqual.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqual.js +9 -12
- package/src/core/collection/array/isArrayEqual.spec.d.ts +2 -0
- package/src/core/collection/array/isArrayEqual.spec.d.ts.map +1 -0
- package/src/core/collection/array/isArrayEqual.spec.js +25 -0
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.js +1 -0
- package/src/core/function/makeSequenceLoop.d.ts.map +1 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +14 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts +9 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/PointShape3D.js +14 -0
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +26 -8
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +33 -4
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitCubeShape3D.js +13 -6
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +10 -0
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +15 -8
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +33 -9
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.d.ts +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +7 -7
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.d.ts +2 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.js +38 -0
- package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +42 -39
- package/src/core/geom/3d/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/3d/v3_negate_array.d.ts +9 -0
- package/src/core/geom/3d/v3_negate_array.d.ts.map +1 -0
- package/src/core/geom/3d/v3_negate_array.js +16 -0
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +30 -77
- package/src/core/geom/Vector3.d.ts +4 -0
- package/src/core/geom/Vector3.js +4 -4
- package/src/core/geom/vec3/v3_cross_array.d.ts +11 -0
- package/src/core/geom/vec3/v3_cross_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cross_array.js +31 -0
- package/src/core/geom/vec3/v3_displace_in_direction.js +3 -2
- package/src/core/geom/vec3/v3_displace_in_direction_array.d.ts +12 -0
- package/src/core/geom/vec3/v3_displace_in_direction_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_displace_in_direction_array.js +22 -0
- package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +4 -1
- package/src/core/geom/vec3/v3_normalize_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_normalize_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_normalize_array.js +3 -3
- package/src/core/math/copysign.d.ts +1 -1
- package/src/core/math/copysign.js +1 -1
- package/src/core/math/epsilonEquals.d.ts.map +1 -1
- package/src/core/math/epsilonEquals.js +3 -2
- package/src/core/math/linalg/README.md +1 -1
- package/src/core/math/random/randomGaussian.spec.js +1 -1
- package/src/core/math/spline/spline_hermite3.d.ts +1 -1
- package/src/core/math/spline/spline_hermite3.js +1 -1
- package/src/core/process/delay.d.ts +6 -1
- package/src/core/process/delay.d.ts.map +1 -1
- package/src/core/process/delay.js +6 -1
- package/src/core/process/undo/Mark.d.ts +5 -5
- package/src/core/process/undo/Mark.d.ts.map +1 -1
- package/src/core/process/undo/Mark.js +6 -5
- package/src/core/process/worker/WorkerBuilder.d.ts +13 -2
- package/src/core/process/worker/WorkerBuilder.d.ts.map +1 -1
- package/src/core/process/worker/WorkerBuilder.js +9 -1
- package/src/core/process/worker/WorkerProxy.d.ts +16 -6
- package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
- package/src/core/process/worker/WorkerProxy.js +24 -5
- package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
- package/src/core/process/worker/extractTransferables.js +3 -1
- package/src/engine/EngineHarness.d.ts +7 -1
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +12 -1
- package/src/engine/animation/clip/AnimationTrack.d.ts.map +1 -1
- package/src/engine/animation/clip/AnimationTrack.js +3 -0
- package/src/engine/animation/clip/bind_property_writer.d.ts +2 -2
- package/src/engine/animation/clip/bind_property_writer.d.ts.map +1 -1
- package/src/engine/animation/clip/bind_property_writer.js +22 -13
- package/src/engine/animation/clip/curve_from_track_data.d.ts.map +1 -1
- package/src/engine/animation/clip/curve_from_track_data.js +9 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.js +6 -5
- package/src/engine/animation/curve/AnimationCurve.d.ts +21 -0
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +43 -15
- package/src/engine/animation/curve/AnimationCurve.spec.js +67 -0
- package/src/engine/animation/curve/Keyframe.d.ts +24 -3
- package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
- package/src/engine/animation/curve/Keyframe.js +49 -3
- package/src/engine/animation/curve/Keyframe.spec.js +11 -0
- package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts +7 -0
- package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts.map +1 -0
- package/src/engine/animation/curve/{compute_curve_aabb.js → animation_curve_compute_aabb.js} +1 -1
- package/src/engine/animation/curve/animation_curve_optimize.d.ts +8 -0
- package/src/engine/animation/curve/animation_curve_optimize.d.ts.map +1 -0
- package/src/engine/animation/curve/animation_curve_optimize.js +89 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.d.ts +2 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.d.ts.map +1 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.js +50 -0
- package/src/engine/animation/curve/draw/build_curve_editor.js +2 -2
- package/src/engine/animation/curve/evaluate_two_key_curve.d.ts +9 -0
- package/src/engine/animation/curve/evaluate_two_key_curve.d.ts.map +1 -0
- package/src/engine/animation/curve/evaluate_two_key_curve.js +23 -0
- package/src/engine/animation/curve/prototypeGLTF.js +14 -14
- package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.js +4 -6
- package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureHash.js +6 -6
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts +6 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts.map +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +11 -6
- package/src/engine/ecs/guid/GUIDSerializationAdapter.spec.js +5 -5
- package/src/engine/ecs/guid/{GUID.d.ts → UUID.d.ts} +17 -12
- package/src/engine/ecs/guid/UUID.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUID.js → UUID.js} +35 -12
- package/src/engine/ecs/guid/UUID.spec.d.ts +2 -0
- package/src/engine/ecs/guid/UUID.spec.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUID.spec.js → UUID.spec.js} +18 -12
- package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts +18 -0
- package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUIDSerializationAdapter.js → UUIDSerializationAdapter.js} +5 -5
- package/src/engine/ecs/ik/InverseKinematics.js +3 -3
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.d.ts.map +1 -1
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +1 -140
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +1 -1
- package/src/engine/graphics/material/manager/MaterialManager.d.ts.map +1 -1
- package/src/engine/graphics/texture/isImageBitmap.d.ts +7 -0
- package/src/engine/graphics/texture/isImageBitmap.d.ts.map +1 -0
- package/src/engine/graphics/texture/isImageBitmap.js +12 -0
- package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonXPlugin.js +9 -1
- package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
- package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.d.ts +1 -1
- package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.js +4 -4
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +13 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +395 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.d.ts +2 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.d.ts.map +1 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.js +46 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.d.ts +18 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.js +277 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.d.ts +2 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.js +43 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.d.ts +12 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.js +100 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.d.ts +2 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.js +112 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts +16 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.js +127 -0
- package/src/view/elements/DropDownSelectionView.js +2 -2
- package/src/view/elements/tiles2d/Tile.d.ts.map +1 -1
- package/src/view/elements/tiles2d/Tile.js +2 -3
- package/src/core/math/makeSequenceLoop.d.ts.map +0 -1
- package/src/engine/animation/curve/compute_curve_aabb.d.ts +0 -7
- package/src/engine/animation/curve/compute_curve_aabb.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUID.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUID.spec.d.ts +0 -2
- package/src/engine/ecs/guid/GUID.spec.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUIDSerializationAdapter.d.ts +0 -18
- package/src/engine/ecs/guid/GUIDSerializationAdapter.d.ts.map +0 -1
- /package/src/core/{math → function}/makeSequenceLoop.d.ts +0 -0
- /package/src/core/{math → function}/makeSequenceLoop.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isArrayEqual.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/isArrayEqual.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,6DAFY,OAAO,
|
|
1
|
+
{"version":3,"file":"isArrayEqual.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/isArrayEqual.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,6DAFY,OAAO,CAkDlB"}
|
|
@@ -14,16 +14,16 @@ export function isArrayEqual(first, second) {
|
|
|
14
14
|
assert.defined(second, 'second');
|
|
15
15
|
assert.isArray(second, 'second');
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const element_count = first.length;
|
|
18
18
|
|
|
19
|
-
if (
|
|
19
|
+
if (element_count !== second.length) {
|
|
20
20
|
// arrays are of different size
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
let i = 0;
|
|
25
25
|
|
|
26
|
-
for (; i <
|
|
26
|
+
for (; i < element_count; i++) {
|
|
27
27
|
|
|
28
28
|
const a = first[i];
|
|
29
29
|
const b = second[i];
|
|
@@ -32,19 +32,16 @@ export function isArrayEqual(first, second) {
|
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (a === null) {
|
|
42
|
-
// A is null and B is something else
|
|
35
|
+
if (
|
|
36
|
+
a === undefined || a === null
|
|
37
|
+
|| b === undefined || b === null
|
|
38
|
+
) {
|
|
39
|
+
// shortcut to avoid working with nulls and undefined values
|
|
43
40
|
return false;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
// try "equals" method
|
|
47
|
-
if (typeof a.equals === "function") {
|
|
44
|
+
if (typeof a === "object" && typeof a.equals === "function") {
|
|
48
45
|
|
|
49
46
|
if (!a.equals(b)) {
|
|
50
47
|
return false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isArrayEqual.spec.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/isArrayEqual.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isArrayEqual } from "./isArrayEqual.js";
|
|
2
|
+
|
|
3
|
+
test("empty", () => {
|
|
4
|
+
|
|
5
|
+
expect(isArrayEqual([], [])).toBe(true);
|
|
6
|
+
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test("primitives", () => {
|
|
10
|
+
|
|
11
|
+
expect(isArrayEqual([1], [1])).toBe(true);
|
|
12
|
+
expect(isArrayEqual([1], [7])).toBe(false);
|
|
13
|
+
|
|
14
|
+
expect(isArrayEqual([1, 3], [1, 3])).toBe(true);
|
|
15
|
+
|
|
16
|
+
expect(isArrayEqual([""], [""])).toBe(true);
|
|
17
|
+
expect(isArrayEqual(["a"], ["a"])).toBe(true);
|
|
18
|
+
expect(isArrayEqual(["a"], ["b"])).toBe(false);
|
|
19
|
+
expect(isArrayEqual(["a"], ["a", "b"])).toBe(false);
|
|
20
|
+
|
|
21
|
+
expect(isArrayEqual([true], [true])).toBe(true);
|
|
22
|
+
expect(isArrayEqual([true], [true, true])).toBe(false);
|
|
23
|
+
expect(isArrayEqual([true], [false])).toBe(false);
|
|
24
|
+
|
|
25
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is_typed_array_equals.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/is_typed_array_equals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,yCAJW,UAAU,GAAC,WAAW,KACtB,UAAU,GAAC,WAAW,GACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"is_typed_array_equals.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/is_typed_array_equals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,yCAJW,UAAU,GAAC,WAAW,KACtB,UAAU,GAAC,WAAW,GACpB,OAAO,CAkEnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeSequenceLoop.d.ts","sourceRoot":"","sources":["../../../../src/core/function/makeSequenceLoop.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4DAcC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/AbstractShape3D.js"],"names":[],"mappings":"AAAA;IACI;;;;OAIG;IACH,gCAHW,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;;;OAKG;IACH,0CAJW,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;;;OAKG;IACH,iCAJW,MAAM,EAAE,aACR,MAAM,EAAE,GACN,IAAI,CAIhB;IAED;;;;;;OAMG;IACH,sCALW,MAAM,EAAE,iBACR,MAAM,qBAEJ,IAAI,CAIhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,EAAE,GACN,OAAO,CAInB;IAED;;;OAGG;IACH,qBAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,6BAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,YAAY,GAClD,IAAI,CAIhB;IAED;;;;OAIG;IACH,6CAFa,OAAO,CAInB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;CACJ"}
|
|
1
|
+
{"version":3,"file":"AbstractShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/AbstractShape3D.js"],"names":[],"mappings":"AAAA;IACI;;;;OAIG;IACH,gCAHW,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;;;OAKG;IACH,0CAJW,MAAM,EAAE,SACR,MAAM,EAAE,GACN,MAAM,CAIlB;IAED;;;;;OAKG;IACH,iCAJW,MAAM,EAAE,aACR,MAAM,EAAE,GACN,IAAI,CAIhB;IAED;;;;;;OAMG;IACH,sCALW,MAAM,EAAE,iBACR,MAAM,qBAEJ,IAAI,CAIhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,EAAE,GACN,OAAO,CAInB;IAED;;;OAGG;IACH,qBAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,6BAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,YAAY,GAClD,IAAI,CAIhB;IAED;;;;;;;;;OASG;IACH,gBAPW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,IAAI,CAIhB;IAED;;;;OAIG;IACH,6CAFa,OAAO,CAInB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;CACJ"}
|
|
@@ -72,6 +72,20 @@ export class AbstractShape3D {
|
|
|
72
72
|
throw new Error('Not Implemented');
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Support function, given a direction vector, return point on the shape that's furthest in that direction
|
|
77
|
+
* Assumes direction is a unit vector
|
|
78
|
+
* @param {number[]|Float32Array} result
|
|
79
|
+
* @param {number} result_offset
|
|
80
|
+
* @param {number} direction_x
|
|
81
|
+
* @param {number} direction_y
|
|
82
|
+
* @param {number} direction_z
|
|
83
|
+
* @returns {void}
|
|
84
|
+
*/
|
|
85
|
+
support(result, result_offset, direction_x, direction_y, direction_z) {
|
|
86
|
+
throw new Error("Not Implemented");
|
|
87
|
+
}
|
|
88
|
+
|
|
75
89
|
/**
|
|
76
90
|
* @template {AbstractShape3D} T
|
|
77
91
|
* @param {T} other
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes a point, shape that encloses no space
|
|
3
|
+
*/
|
|
4
|
+
export class PointShape3D extends AbstractShape3D {
|
|
5
|
+
static INSTANCE: PointShape3D;
|
|
6
|
+
support(result: any, result_offset: any, direction_x: any, direction_y: any, direction_z: any): void;
|
|
7
|
+
}
|
|
8
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
9
|
+
//# sourceMappingURL=PointShape3D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/PointShape3D.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IAOI,8BAAqC;IANrC,qGAIC;CAGJ;gCAb+B,sBAAsB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Describes a point, shape that encloses no space
|
|
5
|
+
*/
|
|
6
|
+
export class PointShape3D extends AbstractShape3D {
|
|
7
|
+
support(result, result_offset, direction_x, direction_y, direction_z) {
|
|
8
|
+
result[result_offset] = 0;
|
|
9
|
+
result[result_offset + 1] = 0;
|
|
10
|
+
result[result_offset + 2] = 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static INSTANCE = new PointShape3D();
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransformedShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/TransformedShape3D.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"TransformedShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/TransformedShape3D.js"],"names":[],"mappings":";AAgBA;IAkCI;;;;;OAKG;IACH,wBAHW,eAAe,MADf,MAAM,EAAE,GAAC,YAAY,GAAC,IAAI,GAExB,kBAAkB,CAS9B;IAED;;;;;OAKG;IACH,uCAJW,eAAe,eACf,MAAM,EAAE,SACR,MAAM,EAAE,sBAalB;IAED;;;;OAIG;IACH,iCAHW,eAAe,eACf,MAAM,EAAE,sBAIlB;IAED;;;;;OAKG;IACH,2BAHW,eAAe,SACf,MAAM,EAAE,GAAC,YAAY,GAAC,IAAI,GAFxB,kBAAkB,CAS9B;IApFG;;;;OAIG;IACH,iBAAoC;IAEpC;;;;OAIG;IACH,yBAA4C;IAE5C;;;;OAIG;IACH,kBAAqB;IAGzB;;;OAGG;IACH,+BAEC;IA0DD;;;OAGG;IACH,4CAIC;IAED,yCAEC;IAED,qBAMC;IAED,wCAKC;IAED,mEAgDC;IAED,6CAEC;IAED,gCAKC;IAED,kFAIC;IAED,qGAMC;IAED;;;;OAIG;IACH,cAHW,kBAAkB,GAChB,OAAO,CAOnB;IAED,eAGC;CACJ;;8BAIS,OAAO;;gCA9Ne,sBAAsB;qBAR3B,WAAW;qBAAX,WAAW"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { mat4, vec3 } from "gl-matrix";
|
|
2
|
+
import { assert } from "../../../assert.js";
|
|
2
3
|
import { isArrayEqualStrict } from "../../../collection/array/isArrayEqualStrict.js";
|
|
3
4
|
import { computeHashFloatArray } from "../../../math/hash/computeHashFloatArray.js";
|
|
4
5
|
import { sign } from "../../../math/sign.js";
|
|
5
6
|
import { v3_length } from "../../vec3/v3_length.js";
|
|
7
|
+
import { v3_matrix4_multiply } from "../../vec3/v3_matrix4_multiply.js";
|
|
6
8
|
import { aabb3_matrix4_project } from "../aabb/aabb3_matrix4_project.js";
|
|
7
9
|
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
8
10
|
|
|
@@ -10,7 +12,7 @@ import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
|
10
12
|
*
|
|
11
13
|
* @type {number[]|Float32Array|vec3}
|
|
12
14
|
*/
|
|
13
|
-
const scratch_v3_0 =
|
|
15
|
+
const scratch_v3_0 = new Float32Array(3);
|
|
14
16
|
|
|
15
17
|
export class TransformedShape3D extends AbstractShape3D {
|
|
16
18
|
constructor() {
|
|
@@ -69,12 +71,26 @@ export class TransformedShape3D extends AbstractShape3D {
|
|
|
69
71
|
*/
|
|
70
72
|
static from_translation_scale(subject, translation, scale) {
|
|
71
73
|
|
|
74
|
+
assert.isArrayLike(translation,'translation');
|
|
75
|
+
assert.greaterThanOrEqual(translation.length,3,'translation length must be >= 3');
|
|
76
|
+
assert.isArrayLike(scale,'scale');
|
|
77
|
+
assert.greaterThanOrEqual(scale.length,3,'scale length must be >= 3');
|
|
78
|
+
|
|
72
79
|
const mat = mat4.create();
|
|
73
80
|
mat4.fromRotationTranslationScale(mat, [0, 0, 0, 1], translation, scale);
|
|
74
81
|
|
|
75
82
|
return TransformedShape3D.from_m4(subject, mat);
|
|
76
83
|
}
|
|
77
84
|
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* @param {AbstractShape3D} subject
|
|
88
|
+
* @param {number[]} translation
|
|
89
|
+
*/
|
|
90
|
+
static from_translation(subject, translation) {
|
|
91
|
+
return TransformedShape3D.from_translation_scale(subject, translation, [1, 1, 1]);
|
|
92
|
+
}
|
|
93
|
+
|
|
78
94
|
/**
|
|
79
95
|
*
|
|
80
96
|
* @returns {TransformedShape3D}
|
|
@@ -119,7 +135,7 @@ export class TransformedShape3D extends AbstractShape3D {
|
|
|
119
135
|
|
|
120
136
|
signed_distance_gradient_at_point(result, point) {
|
|
121
137
|
// transform point to subject's local space
|
|
122
|
-
|
|
138
|
+
v3_matrix4_multiply(scratch_v3_0, 0, point, 0, this.__inverse_matrix);
|
|
123
139
|
|
|
124
140
|
const subject = this.__subject;
|
|
125
141
|
|
|
@@ -181,13 +197,15 @@ export class TransformedShape3D extends AbstractShape3D {
|
|
|
181
197
|
sample_random_point_in_volume(result, result_offset, random) {
|
|
182
198
|
this.__subject.sample_random_point_in_volume(scratch_v3_0, 0, random);
|
|
183
199
|
|
|
184
|
-
|
|
185
|
-
|
|
200
|
+
v3_matrix4_multiply(result, result_offset, scratch_v3_0, 0, this.__matrix);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
support(result, result_offset, direction_x, direction_y, direction_z) {
|
|
204
|
+
|
|
205
|
+
this.__subject.support(scratch_v3_0, 0, direction_x, direction_y, direction_z);
|
|
206
|
+
|
|
207
|
+
v3_matrix4_multiply(result, result_offset, scratch_v3_0, 0, this.__matrix);
|
|
186
208
|
|
|
187
|
-
// write out
|
|
188
|
-
result[0] = scratch_v3_0[0];
|
|
189
|
-
result[1] = scratch_v3_0[1];
|
|
190
|
-
result[2] = scratch_v3_0[2];
|
|
191
209
|
}
|
|
192
210
|
|
|
193
211
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnionShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnionShape3D.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnionShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnionShape3D.js"],"names":[],"mappings":"AA0BA;IAqII;;;;OAIG;IACH,sBAHW,eAAe,EAAE,GACf,YAAY,CAQxB;IA5IG;;;OAGG;IACH,UAFU,eAAe,EAAE,CAET;IAElB;;;;;OAKG;IACH,kCAAmC;IAEnC,qBAAsB;IACtB,qBAAuB;IACvB,uBAAyB;IAG7B,wCAgCC;IAED;;;OAGG;IACH,mCAkBC;IAED;;;OAGG;IACH,2CA8CC;IAeD,qBAuBC;IAED,2BAYC;IAED,mEAEC;IAED,6CAaC;IAED,oCAYC;IAED,kFAoDC;IAED,qGAyBC;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAKnB;IAED,eAWC;CACJ;gCAnV+B,sBAAsB"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { seededRandom } from "../../../math/random/seededRandom.js";
|
|
1
|
+
import { array_copy } from "../../../collection/array/array_copy.js";
|
|
3
2
|
import { binarySearchHighIndex } from "../../../collection/array/binarySearchHighIndex.js";
|
|
4
|
-
import { min2 } from "../../../math/min2.js";
|
|
5
|
-
import { compute_signed_distance_gradient_by_sampling } from "./util/compute_signed_distance_gradient_by_sampling.js";
|
|
6
3
|
import { isArrayEqual } from "../../../collection/array/isArrayEqual.js";
|
|
7
4
|
import { max2 } from "../../../math/max2.js";
|
|
5
|
+
import { min2 } from "../../../math/min2.js";
|
|
6
|
+
import { seededRandom } from "../../../math/random/seededRandom.js";
|
|
8
7
|
import { number_compare_ascending } from "../../../primitives/numbers/number_compare_ascending.js";
|
|
8
|
+
import { v3_dot } from "../../vec3/v3_dot.js";
|
|
9
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
10
|
+
import { compute_signed_distance_gradient_by_sampling } from "./util/compute_signed_distance_gradient_by_sampling.js";
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* To avoid severe performance overhead, we limit number of possible rejections
|
|
@@ -294,6 +296,33 @@ export class UnionShape3D extends AbstractShape3D {
|
|
|
294
296
|
}
|
|
295
297
|
}
|
|
296
298
|
|
|
299
|
+
support(result, result_offset, direction_x, direction_y, direction_z) {
|
|
300
|
+
let best_distance = -Infinity;
|
|
301
|
+
|
|
302
|
+
const children = this.children;
|
|
303
|
+
const child_count = children.length;
|
|
304
|
+
|
|
305
|
+
for (let i = 0; i < child_count; i++) {
|
|
306
|
+
const child = children[i];
|
|
307
|
+
|
|
308
|
+
child.support(scratch_array, 0, direction_x, direction_y, direction_z);
|
|
309
|
+
|
|
310
|
+
const d = v3_dot(
|
|
311
|
+
scratch_array[0], scratch_array[1], scratch_array[2],
|
|
312
|
+
direction_x, direction_y, direction_z
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
if (d > best_distance) {
|
|
316
|
+
// best candidate so far, write to result
|
|
317
|
+
array_copy(scratch_array, 0, result, result_offset, 3);
|
|
318
|
+
|
|
319
|
+
best_distance = d;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
}
|
|
325
|
+
|
|
297
326
|
/**
|
|
298
327
|
*
|
|
299
328
|
* @param {UnionShape3D} other
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitCubeShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnitCubeShape3D.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnitCubeShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnitCubeShape3D.js"],"names":[],"mappings":"AAUA;IAkFI,iCAAwC;IAhFxC,qBAEC;IAED,wCAQC;IAED,4DAYC;IAED,qGAIC;IAED,mEAEC;IAED,6CAqBC;IAED,oCASC;IAED,kFAEC;IAED,eAEC;CAGJ;gCAtF+B,sBAAsB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
2
|
-
import { randomPointInBox } from "../../random/randomPointInBox.js";
|
|
3
|
-
import { v3_length } from "../../vec3/v3_length.js";
|
|
4
1
|
import { max2 } from "../../../math/max2.js";
|
|
5
2
|
import { max3 } from "../../../math/max3.js";
|
|
6
3
|
import { min2 } from "../../../math/min2.js";
|
|
7
|
-
import {
|
|
4
|
+
import { sign_not_zero } from "../../../math/sign_not_zero.js";
|
|
5
|
+
import { randomPointInBox } from "../../random/randomPointInBox.js";
|
|
6
|
+
import { v3_length } from "../../vec3/v3_length.js";
|
|
8
7
|
import { aabb3_nearest_point_on_surface } from "../aabb/aabb3_nearest_point_on_surface.js";
|
|
8
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
9
|
+
import { compute_signed_distance_gradient_by_sampling } from "./util/compute_signed_distance_gradient_by_sampling.js";
|
|
9
10
|
|
|
10
11
|
export class UnitCubeShape3D extends AbstractShape3D {
|
|
11
12
|
|
|
@@ -37,6 +38,12 @@ export class UnitCubeShape3D extends AbstractShape3D {
|
|
|
37
38
|
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
support(result, result_offset, direction_x, direction_y, direction_z) {
|
|
42
|
+
result[result_offset] = sign_not_zero(direction_x) * 0.5;
|
|
43
|
+
result[result_offset + 1] = sign_not_zero(direction_y) * 0.5;
|
|
44
|
+
result[result_offset + 2] = sign_not_zero(direction_z) * 0.5;
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
signed_distance_gradient_at_point(result, point) {
|
|
41
48
|
return compute_signed_distance_gradient_by_sampling(result, this, point);
|
|
42
49
|
}
|
|
@@ -82,6 +89,6 @@ export class UnitCubeShape3D extends AbstractShape3D {
|
|
|
82
89
|
hash() {
|
|
83
90
|
return 1;
|
|
84
91
|
}
|
|
85
|
-
}
|
|
86
92
|
|
|
87
|
-
|
|
93
|
+
static INSTANCE = new UnitCubeShape3D();
|
|
94
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitSphereShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnitSphereShape3D.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IACI,qBAEC;IAED,2BAEC;IAED,wCAQC;IAED,4DAYC;IAED,mEAEC;IAED,6CAMC;IAED,oCAMC;IAED,kFAEC;IAED,eAEC;CACJ;;;;
|
|
1
|
+
{"version":3,"file":"UnitSphereShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/UnitSphereShape3D.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IACI,qBAEC;IAED,2BAEC;IAED,qGAQC;IAED,wCAQC;IAED,4DAYC;IAED,mEAEC;IAED,6CAMC;IAED,oCAMC;IAED,kFAEC;IAED,eAEC;CACJ;;;;gCA5E+B,sBAAsB"}
|
|
@@ -15,6 +15,16 @@ export class UnitSphereShape3D extends AbstractShape3D {
|
|
|
15
15
|
return Math.PI * 4;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
support(result, result_offset, direction_x, direction_y, direction_z) {
|
|
19
|
+
|
|
20
|
+
// since the sphere has a radius of 1, we don't have to multiply by it
|
|
21
|
+
|
|
22
|
+
result[result_offset] = direction_x;
|
|
23
|
+
result[result_offset + 1] = direction_y;
|
|
24
|
+
result[result_offset + 2] = direction_z;
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
compute_bounding_box(result) {
|
|
19
29
|
result[0] = -1;
|
|
20
30
|
result[1] = -1;
|
|
@@ -97,11 +97,17 @@ export class TetrahedralMesh {
|
|
|
97
97
|
*/
|
|
98
98
|
get isCompacted(): boolean;
|
|
99
99
|
/**
|
|
100
|
-
* Traverse tetrahedrons
|
|
101
|
-
* @param {function(
|
|
100
|
+
* Traverse live tetrahedrons
|
|
101
|
+
* @param { function( tet_id:number, mesh:TetrahedralMesh ):* } visitor
|
|
102
102
|
* @param {*} [thisArg]
|
|
103
103
|
*/
|
|
104
104
|
forEach(visitor: any, thisArg?: any): void;
|
|
105
|
+
/**
|
|
106
|
+
* Produces a list of live tetrahedrons
|
|
107
|
+
* Allocates.
|
|
108
|
+
* @return {number[]}
|
|
109
|
+
*/
|
|
110
|
+
getLive(): number[];
|
|
105
111
|
/**
|
|
106
112
|
* Clears all data from the mesh, making it contain 0 tetrahedrons
|
|
107
113
|
*/
|
|
@@ -117,17 +123,18 @@ export class TetrahedralMesh {
|
|
|
117
123
|
*/
|
|
118
124
|
getCapacity(): number;
|
|
119
125
|
/**
|
|
120
|
-
* How many tetrahedrons are contained in the mesh
|
|
126
|
+
* How many tetrahedrons are contained in the mesh, includes any unallocated tetrahedrons
|
|
121
127
|
* @return {number}
|
|
122
128
|
*/
|
|
123
129
|
size(): number;
|
|
124
130
|
/**
|
|
125
131
|
* Grow capacity to at least the specified size
|
|
126
|
-
* @
|
|
132
|
+
* @private
|
|
133
|
+
* @param {number} capacity minimum
|
|
127
134
|
*/
|
|
128
|
-
growCapacity
|
|
135
|
+
private growCapacity;
|
|
129
136
|
/**
|
|
130
|
-
*
|
|
137
|
+
* Make sure that capacity is large enough to contain a certain total number of tetrahedrons
|
|
131
138
|
* @param {number} capacity
|
|
132
139
|
*/
|
|
133
140
|
ensureCapacity(capacity: number): void;
|
|
@@ -241,12 +248,12 @@ export class TetrahedralMesh {
|
|
|
241
248
|
*/
|
|
242
249
|
deserialize(buffer: BinaryBuffer): void;
|
|
243
250
|
/**
|
|
244
|
-
*
|
|
251
|
+
* Turns data into a base64 encoded string
|
|
245
252
|
* @return {string}
|
|
246
253
|
*/
|
|
247
254
|
serialize_base64(): string;
|
|
248
255
|
/**
|
|
249
|
-
*
|
|
256
|
+
* Dual of serialization method, decodes a base64 representation
|
|
250
257
|
* @param {string} str
|
|
251
258
|
*/
|
|
252
259
|
deserialize_base64(str: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TetrahedralMesh.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/TetrahedralMesh.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,qCAFU,MAAM,CAEkD;AAElE;;;GAGG;AACH,gCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,4BAFU,MAAM,CAEwB;AAoBxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACI;;;OAGG;IACH,2BAFW,MAAM,EAqDhB;IAhDG;;;;OAIG;IACH,iBAAsE;IAEtE;;;;OAIG;IACH,sBAAmD;IAEnD;;;;OAIG;IACH,eAAyC;IAEzC;;;;OAIG;IACH,mBAA8B;IAE9B;;;;OAIG;IACH,mBAAmB;IAEnB;;;;OAIG;IACH,eAAgB;IAEhB;;;;OAIG;IACH,uBAAuB;IAG3B;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"TetrahedralMesh.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/TetrahedralMesh.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,qCAFU,MAAM,CAEkD;AAElE;;;GAGG;AACH,gCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,4BAFU,MAAM,CAEwB;AAoBxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACI;;;OAGG;IACH,2BAFW,MAAM,EAqDhB;IAhDG;;;;OAIG;IACH,iBAAsE;IAEtE;;;;OAIG;IACH,sBAAmD;IAEnD;;;;OAIG;IACH,eAAyC;IAEzC;;;;OAIG;IACH,mBAA8B;IAE9B;;;;OAIG;IACH,mBAAmB;IAEnB;;;;OAIG;IACH,eAAgB;IAEhB;;;;OAIG;IACH,uBAAuB;IAG3B;;;OAGG;IACH,oBAIC;IAED;;;OAGG;IACH,2BAEC;IAED;;;;OAIG;IACH,2CAUC;IAED;;;;OAIG;IACH,WAFY,MAAM,EAAE,CAYnB;IAED;;OAEG;IACH,cAWC;IAED;;;OAGG;IACH,sBAFW,MAAM,QA8BhB;IAED;;;OAGG;IACH,eAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,qBAYC;IAED;;;OAGG;IACH,yBAFW,MAAM,QAWhB;IAED;;;;OAIG;IACH,YAHW,MAAM,GACL,OAAO,CAiBlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,mBACN,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,mBACN,MAAM,aACN,MAAM,QAchB;IAGD;;;;;OAKG;IACH,0BAJW,MAAM,eACN,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,eACN,MAAM,UACN,MAAM,QAiBhB;IAED;;;;;OAKG;IACH,uBAJW,MAAM,UACN,MAAM,GACL,OAAO,CAUlB;IAGD;;;;OAIG;IACH,YAFY,MAAM,CA4BjB;IAED;;;;;;;;OAQG;IACH,eAPW,MAAM,EAAE,GAAC,YAAY,KACrB,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAqBlB;IAED;;;;OAIG;IACH,wBAFW,MAAM,QAmBhB;IAED;;;;OAIG;IACH,oBAFW,MAAM,QAmBhB;IAED;;;;;OAKG;IACH,2CAHW,MAAM,aACN,MAAM,QAwBhB;IAED;;;;;;;;OAQG;IACH,8BAPW,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,EAAE,sBACR,MAAM,GACJ,MAAM,CA8DlB;IAGD;;;;;OAKG;IACH,uBAHW,MAAM,qBACN,MAAM,QA6BhB;IAED;;;;OAIG;IACH,WAFa,MAAM,CA2ClB;IAED;;;OAGG;IACH,kBAFW,YAAY,QAUtB;IAED;;;OAGG;IACH,oBAFW,YAAY,QAiBtB;IAED;;;OAGG;IACH,oBAFY,MAAM,CAUjB;IAED;;;OAGG;IACH,wBAFW,MAAM,QAQhB;IAGL;;;OAGG;IACH,4BAFU,OAAO,CAE0B;CAN1C;6BAvvB4B,iCAAiC"}
|
|
@@ -138,6 +138,8 @@ export class TetrahedralMesh {
|
|
|
138
138
|
* @return {number}
|
|
139
139
|
*/
|
|
140
140
|
get count() {
|
|
141
|
+
assert.equal(this.isCompacted, true, 'must be compacted');
|
|
142
|
+
|
|
141
143
|
return this.__used_end;
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -150,11 +152,13 @@ export class TetrahedralMesh {
|
|
|
150
152
|
}
|
|
151
153
|
|
|
152
154
|
/**
|
|
153
|
-
* Traverse tetrahedrons
|
|
154
|
-
* @param {function(
|
|
155
|
+
* Traverse live tetrahedrons
|
|
156
|
+
* @param { function( tet_id:number, mesh:TetrahedralMesh ):* } visitor
|
|
155
157
|
* @param {*} [thisArg]
|
|
156
158
|
*/
|
|
157
159
|
forEach(visitor, thisArg) {
|
|
160
|
+
assert.isFunction(visitor, 'visitor');
|
|
161
|
+
|
|
158
162
|
for (let i = 0; i < this.__used_end; i++) {
|
|
159
163
|
if (!this.exists(i)) {
|
|
160
164
|
continue;
|
|
@@ -164,6 +168,23 @@ export class TetrahedralMesh {
|
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Produces a list of live tetrahedrons
|
|
173
|
+
* Allocates.
|
|
174
|
+
* @return {number[]}
|
|
175
|
+
*/
|
|
176
|
+
getLive() {
|
|
177
|
+
/**
|
|
178
|
+
*
|
|
179
|
+
* @type {number[]}
|
|
180
|
+
*/
|
|
181
|
+
const r = [];
|
|
182
|
+
|
|
183
|
+
this.forEach((tet) => r.push(tet));
|
|
184
|
+
|
|
185
|
+
return r;
|
|
186
|
+
}
|
|
187
|
+
|
|
167
188
|
/**
|
|
168
189
|
* Clears all data from the mesh, making it contain 0 tetrahedrons
|
|
169
190
|
*/
|
|
@@ -223,7 +244,7 @@ export class TetrahedralMesh {
|
|
|
223
244
|
}
|
|
224
245
|
|
|
225
246
|
/**
|
|
226
|
-
* How many tetrahedrons are contained in the mesh
|
|
247
|
+
* How many tetrahedrons are contained in the mesh, includes any unallocated tetrahedrons
|
|
227
248
|
* @return {number}
|
|
228
249
|
*/
|
|
229
250
|
size() {
|
|
@@ -232,7 +253,8 @@ export class TetrahedralMesh {
|
|
|
232
253
|
|
|
233
254
|
/**
|
|
234
255
|
* Grow capacity to at least the specified size
|
|
235
|
-
* @
|
|
256
|
+
* @private
|
|
257
|
+
* @param {number} capacity minimum
|
|
236
258
|
*/
|
|
237
259
|
growCapacity(capacity) {
|
|
238
260
|
assert.isNonNegativeInteger(capacity, 'capacity');
|
|
@@ -249,12 +271,14 @@ export class TetrahedralMesh {
|
|
|
249
271
|
}
|
|
250
272
|
|
|
251
273
|
/**
|
|
252
|
-
*
|
|
274
|
+
* Make sure that capacity is large enough to contain a certain total number of tetrahedrons
|
|
253
275
|
* @param {number} capacity
|
|
254
276
|
*/
|
|
255
277
|
ensureCapacity(capacity) {
|
|
256
278
|
assert.isNonNegativeInteger(capacity, 'capacity');
|
|
279
|
+
|
|
257
280
|
if (this.__capacity >= capacity) {
|
|
281
|
+
// big enough
|
|
258
282
|
return;
|
|
259
283
|
}
|
|
260
284
|
|
|
@@ -570,7 +594,7 @@ export class TetrahedralMesh {
|
|
|
570
594
|
// point is outside the tet on the neighbour's side, move in that direction
|
|
571
595
|
const neighbour = this.getNeighbour(cur_tet, i);
|
|
572
596
|
|
|
573
|
-
if(neighbour === INVALID_NEIGHBOUR){
|
|
597
|
+
if (neighbour === INVALID_NEIGHBOUR) {
|
|
574
598
|
// walked outside the mesh, point is not contained within
|
|
575
599
|
return -1;
|
|
576
600
|
}
|
|
@@ -704,7 +728,7 @@ export class TetrahedralMesh {
|
|
|
704
728
|
this.__used_end = buffer.readUintVar();
|
|
705
729
|
this.__free_pointer = buffer.readUintVar();
|
|
706
730
|
|
|
707
|
-
this.
|
|
731
|
+
this.ensureCapacity(this.__used_end);
|
|
708
732
|
|
|
709
733
|
buffer.readUint32Array(this.__data_uint32, 0, this.__used_end * LAYOUT_TETRA_WORD_COUNT);
|
|
710
734
|
|
|
@@ -712,7 +736,7 @@ export class TetrahedralMesh {
|
|
|
712
736
|
}
|
|
713
737
|
|
|
714
738
|
/**
|
|
715
|
-
*
|
|
739
|
+
* Turns data into a base64 encoded string
|
|
716
740
|
* @return {string}
|
|
717
741
|
*/
|
|
718
742
|
serialize_base64() {
|
|
@@ -726,7 +750,7 @@ export class TetrahedralMesh {
|
|
|
726
750
|
}
|
|
727
751
|
|
|
728
752
|
/**
|
|
729
|
-
*
|
|
753
|
+
* Dual of serialization method, decodes a base64 representation
|
|
730
754
|
* @param {string} str
|
|
731
755
|
*/
|
|
732
756
|
deserialize_base64(str) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param {TetrahedralMesh} mesh
|
|
5
5
|
* @param {number[]} input serialized set of 3d points (x,y,z)
|
|
6
6
|
* @param {number} [n] number of points in the input
|
|
7
|
-
* @returns {boolean}
|
|
7
|
+
* @returns {boolean} whether mesh was created or not. Returns false on failure
|
|
8
8
|
*/
|
|
9
9
|
export function compute_delaunay_tetrahedral_mesh(mesh: TetrahedralMesh, input: number[], n?: number): boolean;
|
|
10
10
|
import { TetrahedralMesh } from "../TetrahedralMesh.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_delaunay_tetrahedral_mesh.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js"],"names":[],"mappings":"AAcA;;;;;;;GAOG;AACH,wDALW,eAAe,SACf,MAAM,EAAE,MACR,MAAM,GACJ,OAAO,CAuEnB;
|
|
1
|
+
{"version":3,"file":"compute_delaunay_tetrahedral_mesh.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js"],"names":[],"mappings":"AAcA;;;;;;;GAOG;AACH,wDALW,eAAe,SACf,MAAM,EAAE,MACR,MAAM,GACJ,OAAO,CAuEnB;gCAtF+B,uBAAuB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
//
|
|
2
2
|
|
|
3
|
+
import { assert } from "../../../../assert.js";
|
|
4
|
+
import { BitSet } from "../../../../binary/BitSet.js";
|
|
3
5
|
import { compute_bounding_simplex_3d } from "../compute_bounding_simplex_3d.js";
|
|
4
6
|
import { TetrahedralMesh } from "../TetrahedralMesh.js";
|
|
7
|
+
import { Cavity } from "./Cavity.js";
|
|
8
|
+
import { fill_in_a_cavity } from "./fill_in_a_cavity.js";
|
|
9
|
+
import { tetrahedral_mesh_compute_cavity } from "./tetrahedral_mesh_compute_cavity.js";
|
|
5
10
|
import {
|
|
6
11
|
tetrahedral_mesh_walk_towards_containing_tetrahedron
|
|
7
12
|
} from "./tetrahedral_mesh_walk_towards_containing_tetrahedron.js";
|
|
8
|
-
import { Cavity } from "./Cavity.js";
|
|
9
|
-
import { tetrahedral_mesh_compute_cavity } from "./tetrahedral_mesh_compute_cavity.js";
|
|
10
|
-
import { fill_in_a_cavity } from "./fill_in_a_cavity.js";
|
|
11
|
-
import { BitSet } from "../../../../binary/BitSet.js";
|
|
12
|
-
import { assert } from "../../../../assert.js";
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -18,7 +18,7 @@ import { assert } from "../../../../assert.js";
|
|
|
18
18
|
* @param {TetrahedralMesh} mesh
|
|
19
19
|
* @param {number[]} input serialized set of 3d points (x,y,z)
|
|
20
20
|
* @param {number} [n] number of points in the input
|
|
21
|
-
* @returns {boolean}
|
|
21
|
+
* @returns {boolean} whether mesh was created or not. Returns false on failure
|
|
22
22
|
*/
|
|
23
23
|
export function compute_delaunay_tetrahedral_mesh(mesh, input, n = input.length / 3) {
|
|
24
24
|
assert.notNull(mesh, 'mesh');
|
|
@@ -43,7 +43,7 @@ export function compute_delaunay_tetrahedral_mesh(mesh, input, n = input.length
|
|
|
43
43
|
|
|
44
44
|
// start with a fairly low capacity for best-case scenario, rely on internal resizing after that
|
|
45
45
|
|
|
46
|
-
mesh.
|
|
46
|
+
mesh.ensureCapacity(n + 1);
|
|
47
47
|
|
|
48
48
|
const CAVITY = new Cavity();
|
|
49
49
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tetrahedral_mesh_build_from_grid.spec.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.js"],"names":[],"mappings":""}
|