@woosh/meep-engine 2.33.23 → 2.33.24
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/core/bvh2/BinaryNode.js +1 -1
- package/core/bvh2/aabb3/AABB3.js +18 -0
- package/core/bvh2/aabb3/AABB3Math.js +1 -1
- package/core/bvh2/binary/2/BinaryUint32BVH.js +498 -0
- package/core/bvh2/binary/2/BinaryUint32BVH.spec.js +54 -0
- package/core/bvh2/binary/IndexedBinaryBVH.js +22 -26
- package/core/collection/ArrayUtils.js +1 -1
- package/core/collection/array/arrayQuickSort.js +9 -6
- package/core/collection/array/array_swap.js +22 -0
- package/core/collection/array/computeHashArray.js +22 -0
- package/core/collection/array/computeHashIntegerArray.js +15 -0
- package/core/collection/table/DataType2TypedArrayConstructorMapping.js +15 -0
- package/core/color/Color.js +2 -1
- package/core/function/FunctionCompiler.js +2 -1
- package/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane.js +9 -33
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +41 -0
- package/core/geom/3d/morton/mortonEncode_magicbits.js +2 -1
- package/core/geom/3d/morton/reinterpret_float32_as_int32.js +13 -0
- package/core/geom/3d/morton/v3_morton_encode_transformed.js +33 -0
- package/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
- package/core/geom/3d/shape/AbstractShape3D.js +29 -0
- package/core/geom/3d/shape/CompositeShape.js +60 -0
- package/core/geom/3d/shape/TransformedShape3D.js +70 -0
- package/core/geom/3d/shape/UnitCubeShape3D.js +13 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +16 -0
- package/core/geom/AABB2.js +1 -1
- package/core/geom/ConicRay.js +3 -1
- package/core/geom/LineSegment.js +0 -78
- package/core/geom/Matrix4.js +7 -8
- package/core/geom/Rectangle.js +2 -1
- package/core/geom/Vector1.js +1 -1
- package/core/geom/Vector3.js +2 -1
- package/core/geom/Vector4.js +2 -1
- package/core/geom/random/randomPointInBox.js +7 -3
- package/core/geom/random/randomPointInPoint.js +6 -3
- package/core/geom/random/randomPointInSphere.js +6 -3
- package/core/geom/random/randomPointOnBox.js +7 -3
- package/core/geom/random/randomPointOnSphere.js +6 -3
- package/core/geom/v3_length.js +8 -3
- package/core/graph/graph_k_means_cluster.js +1 -1
- package/core/math/MathUtils.js +0 -354
- package/core/math/MathUtils.spec.js +7 -1
- package/core/math/gaussian.js +9 -0
- package/core/math/hash/computeHashFloat.js +17 -0
- package/core/math/hash/computeHashFloatArray.js +34 -0
- package/core/math/hash/computeObjectHash.js +54 -0
- package/core/math/intersects1D.js +19 -0
- package/core/math/interval/NumericInterval.js +2 -2
- package/core/math/isValueBetween.js +10 -0
- package/core/math/isValueBetweenInclusive.js +10 -0
- package/core/math/noise/curl_noise_3dt.js +1 -1
- package/core/math/noise/sdnoise.js +10 -10
- package/core/math/overlap1D.js +19 -0
- package/core/math/pingpong.js +17 -0
- package/core/math/random/makeRangedRandom.js +19 -0
- package/core/math/random/randomFloatBetween.js +14 -0
- package/core/math/random/randomFromArray.js +19 -0
- package/core/math/random/randomGaussian.js +15 -0
- package/core/math/random/randomIntegerBetween.js +14 -0
- package/core/math/random/roundFair.js +15 -0
- package/core/math/separation1D.js +21 -0
- package/core/math/solveQuadratic.js +25 -0
- package/core/model/BoundedValue.js +1 -1
- package/core/model/node-graph/node/NodeInstancePortReference.js +1 -1
- package/core/model/node-graph/node/Port.js +1 -1
- package/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +3 -1
- package/core/model/reactive/model/ReactiveBinaryExpression.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveReference.js +1 -1
- package/core/model/reactive/model/util/createRandomReactiveExpression.js +1 -1
- package/core/model/stat/LinearModifier.js +1 -1
- package/engine/animation/curve/AnimationCurve.js +72 -0
- package/engine/animation/curve/Keyframe.js +27 -0
- package/engine/animation/keyed2/AnimationTrack.js +27 -3
- package/engine/asset/Asset.js +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.d.ts +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.js +10 -0
- package/engine/asset/loaders/image/ImageRGBADataAsset.js +8 -1
- package/engine/asset/loaders/material/computeMaterialHash.js +3 -1
- package/engine/asset/loaders/material/computeTextureHash.js +2 -1
- package/engine/ecs/animation/Animation.js +2 -1
- package/engine/ecs/animation/InverseKinematics.js +2 -1
- package/engine/ecs/dynamic_actions/DynamicActorSystem.js +2 -1
- package/engine/ecs/dynamic_actions/DynamicRuleDescriptionTable.spec.js +3 -5
- package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
- package/engine/ecs/evaluation/complex/PointFitnessGaussianBlur.js +1 -1
- package/engine/ecs/foliage/ecs/Foliage2.js +1 -1
- package/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
- package/engine/ecs/gui/GUIElement.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplay.js +1 -1
- package/engine/ecs/gui/position/ViewportPosition.js +2 -1
- package/engine/ecs/systems/RangedAttackSystem.js +1 -1
- package/engine/ecs/systems/SteeringSystem.js +1 -1
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -1
- package/engine/ecs/tooltip/TooltipComponent.js +15 -0
- package/engine/graphics/ecs/animation/animator/AnimationClip.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +1 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +2 -1
- package/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
- package/engine/graphics/ecs/highlight/HighlightDefinition.js +2 -1
- package/engine/graphics/ecs/light/Light.d.ts +1 -1
- package/engine/graphics/ecs/light/Light.js +3 -0
- package/engine/graphics/ecs/mesh/Mesh.js +2 -1
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +13 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +6 -0
- package/engine/graphics/geometry/AttributeSpec.js +105 -0
- package/engine/graphics/{micron/format/MicronVertexDataSpec.js → geometry/VertexDataSpec.js} +56 -25
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +7 -7
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
- package/engine/graphics/micron/buildPatchwork.js +1 -1
- package/engine/graphics/micron/format/MicronGeometry.js +3 -3
- package/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +2 -2
- package/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +5 -5
- package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +80 -16
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +57 -52
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +2 -1
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +51 -12
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +3 -2
- package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +1 -1
- package/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +8 -2
- package/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +2 -1
- package/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +1 -1
- package/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +1 -1
- package/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +21 -0
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +0 -20
- package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +9 -9
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +2 -6
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +2 -7
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/update_parameters.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +384 -0
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +558 -0
- package/engine/graphics/particles/particular/group/Operation.js +18 -0
- package/engine/graphics/particles/particular/group/OperationType.js +9 -0
- package/engine/graphics/particles/particular/group/ParticleAttribute.js +2 -1
- package/engine/graphics/particles/particular/group/ParticleAttributeType.js +11 -0
- package/engine/graphics/particles/particular/group/ParticleDataType.js +10 -0
- package/engine/graphics/particles/particular/group/ParticleGroup.js +7 -245
- package/engine/graphics/particles/particular/group/ParticleGroup.spec.js +3 -1
- package/engine/graphics/particles/particular/group/ParticleSpecification.js +21 -14
- package/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +20 -0
- package/engine/graphics/particles/particular/group/optimizeCommandQueue.js +162 -0
- package/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +19 -0
- package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +1 -1
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +2 -1
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +117 -94
- package/engine/graphics/render/forward_plus/PointLight.js +9 -0
- package/engine/graphics/render/forward_plus/PointLightData.js +1 -1
- package/engine/graphics/render/forward_plus/SpotLight.js +9 -0
- package/engine/graphics/render/forward_plus/cluster/compute_light_data_hash_0.js +2 -2
- package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +5 -5
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +180 -86
- package/engine/graphics/render/forward_plus/query/analytical_triplanar_corner_mapping.js +8 -0
- package/engine/graphics/render/forward_plus/query/cube_mapping.js +38 -0
- package/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +86 -0
- package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +73 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +131 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +129 -0
- package/engine/graphics/render/forward_plus/query/spot_light_inside_volume.js +33 -0
- package/engine/graphics/render/forward_plus/read_frustum_corner.js +14 -0
- package/engine/graphics/render/forward_plus/testClusterEquality.js +22 -0
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +11 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/engine/graphics/texture/sampler/HarmonicDiffusionGrid.spec.js +1 -1
- package/engine/graphics/texture/sampler/SampleTraverser.js +1 -1
- package/engine/graphics/texture/sampler/distanceField.spec.js +1 -1
- package/engine/grid/components/GridObstacle.js +1 -1
- package/engine/intelligence/behavior/selector/WeightedElement.js +2 -1
- package/engine/intelligence/optimization/RandomOptimizer.js +1 -1
- package/engine/navigation/ecs/components/Path.js +1 -1
- package/engine/navigation/grid/FastBinaryHeap.spec.js +1 -1
- package/engine/sound/ecs/emitter/SoundEmitter.js +2 -1
- package/engine/sound/ecs/emitter/SoundTrack.js +2 -1
- package/engine/sound/material/concrete/RandomSoundMaterial.js +1 -1
- package/engine/ui/notification/notificationGenerator.js +1 -1
- package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +1 -1
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +2 -1
- package/generation/markers/actions/MarkerNodeActionSelectRandom.js +1 -1
- package/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +1 -1
- package/generation/placement/action/random/CellActionSelectRandom.js +1 -1
- package/generation/theme/ThemeEngine.js +1 -1
- package/misc/makeMaterialIconCached.js +2 -2
- package/package.json +1 -1
- package/view/elements/image/HTMLElementCacheKey.js +2 -1
- package/view/elements/radial/RadialText.js +2 -1
- package/view/minimap/gl/MinimapMarkersGL.js +6 -100
- package/view/minimap/gl/buildMaterial.js +94 -0
- package/engine/graphics/micron/format/MicronGeometryBufferAttributeSpec.js +0 -71
- package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +0 -357
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
2
|
+
import { randomPointInSphere } from "../../random/randomPointInSphere.js";
|
|
3
|
+
|
|
4
|
+
export class UnitSphereShape3D extends AbstractShape3D {
|
|
5
|
+
get volume() {
|
|
6
|
+
return 0.523598776;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
get surface_area() {
|
|
10
|
+
return 3.14159265;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
sample_random_point_in_volume(result, result_offset, random) {
|
|
14
|
+
randomPointInSphere(random, result, result_offset);
|
|
15
|
+
}
|
|
16
|
+
}
|
package/core/geom/AABB2.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
import { assert } from "../assert.js";
|
|
8
8
|
import { clamp } from "../math/clamp.js";
|
|
9
|
-
import { overlap1D } from "../math/MathUtils.js";
|
|
10
9
|
import { max2 } from "../math/max2.js";
|
|
11
10
|
import { min2 } from "../math/min2.js";
|
|
12
11
|
import LineSegment2 from "./LineSegment2.js";
|
|
13
12
|
import Vector2 from "./Vector2.js";
|
|
13
|
+
import { overlap1D } from "../math/overlap1D.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
*
|
package/core/geom/ConicRay.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { EPSILON, epsilonEquals } from "../math/MathUtils.js";
|
|
3
3
|
import Vector3 from "./Vector3.js";
|
|
4
|
+
import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
|
|
5
|
+
import { computeHashFloat } from "../math/hash/computeHashFloat.js";
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
/**
|
package/core/geom/LineSegment.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { clamp } from "../math/clamp.js";
|
|
5
5
|
import Vector3 from "./Vector3.js";
|
|
6
|
-
import { v3_dot } from "./v3_dot.js";
|
|
7
|
-
import { v3_distance_sqr } from "./v3_distance_sqr.js";
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
const SMALL_NUM = 1e-9;
|
|
@@ -19,82 +17,6 @@ const LineSegment = function (first, second) {
|
|
|
19
17
|
|
|
20
18
|
};
|
|
21
19
|
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param {Vector3} result
|
|
25
|
-
* @param {number} origin_x
|
|
26
|
-
* @param {number} origin_y
|
|
27
|
-
* @param {number} origin_z
|
|
28
|
-
* @param {number} direction_x
|
|
29
|
-
* @param {number} direction_y
|
|
30
|
-
* @param {number} direction_z
|
|
31
|
-
* @param {number} px
|
|
32
|
-
* @param {number} py
|
|
33
|
-
* @param {number} pz
|
|
34
|
-
* @returns {number} distance from origin, negative means that the point lies behind the origin in the direction opposite to the ray's own
|
|
35
|
-
*/
|
|
36
|
-
export function ray_computeNearestPointToPoint(result, origin_x, origin_y, origin_z, direction_x, direction_y, direction_z, px, py, pz) {
|
|
37
|
-
// find closest point
|
|
38
|
-
const sp0_x = px - origin_x;
|
|
39
|
-
const sp0_y = py - origin_y;
|
|
40
|
-
const sp0_z = pz - origin_z;
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
const d2 = v3_dot(direction_x, direction_y, direction_z, direction_x, direction_y, direction_z);
|
|
44
|
-
const d3 = v3_dot(direction_x, direction_y, direction_z, sp0_x, sp0_y, sp0_z);
|
|
45
|
-
|
|
46
|
-
const t = d3 / d2;
|
|
47
|
-
|
|
48
|
-
// compute point on the ray
|
|
49
|
-
const lp_x = direction_x * t + origin_x;
|
|
50
|
-
const lp_y = direction_y * t + origin_y;
|
|
51
|
-
const lp_z = direction_z * t + origin_z;
|
|
52
|
-
|
|
53
|
-
result.set(lp_x, lp_y, lp_z);
|
|
54
|
-
|
|
55
|
-
return t;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Computes shortest distance between a line segment(defined by 2 points) and a point
|
|
60
|
-
* @param {number} x0
|
|
61
|
-
* @param {number} y0
|
|
62
|
-
* @param {number} z0
|
|
63
|
-
* @param {number} x1
|
|
64
|
-
* @param {number} y1
|
|
65
|
-
* @param {number} z1
|
|
66
|
-
* @param {number} px
|
|
67
|
-
* @param {number} py
|
|
68
|
-
* @param {number} pz
|
|
69
|
-
*/
|
|
70
|
-
export function line3_computeSegmentPointDistance_sqr(x0, y0, z0, x1, y1, z1, px, py, pz) {
|
|
71
|
-
// find closest point
|
|
72
|
-
const sp0_x = px - x0;
|
|
73
|
-
const sp0_y = py - y0;
|
|
74
|
-
const sp0_z = pz - z0;
|
|
75
|
-
|
|
76
|
-
// get line delta
|
|
77
|
-
const line_delta_x = x1 - x0;
|
|
78
|
-
const line_delta_y = y1 - y0;
|
|
79
|
-
const line_delta_z = z1 - z0;
|
|
80
|
-
|
|
81
|
-
//
|
|
82
|
-
const d2 = line_delta_x * line_delta_x + line_delta_y * line_delta_y + line_delta_z * line_delta_z;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const d3 = line_delta_x * sp0_x + line_delta_y * sp0_y + line_delta_z * sp0_z;
|
|
86
|
-
|
|
87
|
-
const t = clamp(d3 / d2, 0, 1);
|
|
88
|
-
|
|
89
|
-
// compute point on the line
|
|
90
|
-
const lp_x = line_delta_x * t + x0;
|
|
91
|
-
const lp_y = line_delta_y * t + y0;
|
|
92
|
-
const lp_z = line_delta_z * t + z0;
|
|
93
|
-
|
|
94
|
-
// compute distance from the point in question to the point on the line
|
|
95
|
-
return v3_distance_sqr(px, py, pz, lp_x, lp_y, lp_z);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
20
|
LineSegment.prototype.closestPointToPointParameter = function (point, clampToLine) {
|
|
99
21
|
|
|
100
22
|
|
package/core/geom/Matrix4.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Vector3 from "./Vector3.js";
|
|
2
|
-
import { v3_length } from "./v3_length.js";
|
|
3
2
|
|
|
4
3
|
const _z = new Vector3();
|
|
5
4
|
const _x = new Vector3();
|
|
@@ -193,12 +192,12 @@ export class Matrix4 {
|
|
|
193
192
|
decompose(position, rotation, scale) {
|
|
194
193
|
|
|
195
194
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
let sx = Math.hypot(this.a0, this.a1, this.a2);
|
|
196
|
+
const sy = Math.hypot(this.b0, this.b1, this.b2);
|
|
197
|
+
const sz = Math.hypot(this.c0, this.c1, this.c2);
|
|
199
198
|
|
|
200
199
|
// if determine is negative, we need to invert one scale
|
|
201
|
-
|
|
200
|
+
const det = this.determinant();
|
|
202
201
|
if (det < 0) sx = -sx;
|
|
203
202
|
|
|
204
203
|
position.set(
|
|
@@ -208,9 +207,9 @@ export class Matrix4 {
|
|
|
208
207
|
);
|
|
209
208
|
|
|
210
209
|
// scale the rotation part
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
const invSX = 1 / sx;
|
|
211
|
+
const invSY = 1 / sy;
|
|
212
|
+
const invSZ = 1 / sz;
|
|
214
213
|
|
|
215
214
|
const i_a0 = this.a0 * invSX;
|
|
216
215
|
const i_a1 = this.a1 * invSX;
|
package/core/geom/Rectangle.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Alex on 14/03/2016.
|
|
3
3
|
*/
|
|
4
|
-
import { intersects1D, overlap1D } from "../math/MathUtils.js";
|
|
5
4
|
import { max2 } from "../math/max2.js";
|
|
6
5
|
import { min2 } from "../math/min2.js";
|
|
7
6
|
import Vector2 from "./Vector2.js";
|
|
7
|
+
import { intersects1D } from "../math/intersects1D.js";
|
|
8
|
+
import { overlap1D } from "../math/overlap1D.js";
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
/**
|
package/core/geom/Vector1.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { assert } from "../assert.js";
|
|
7
7
|
import Signal from "../events/signal/Signal.js";
|
|
8
8
|
import { clamp } from "../math/clamp.js";
|
|
9
|
-
import { computeHashFloat } from "../math/
|
|
9
|
+
import { computeHashFloat } from "../math/hash/computeHashFloat.js";
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class Vector1 extends Number {
|
package/core/geom/Vector3.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { assert } from "../assert.js";
|
|
7
7
|
import Signal from "../events/signal/Signal.js";
|
|
8
8
|
import { lerp } from "../math/lerp.js";
|
|
9
|
-
import {
|
|
9
|
+
import { EPSILON, epsilonEquals } from "../math/MathUtils.js";
|
|
10
10
|
import { sign } from "../math/sign.js";
|
|
11
11
|
import { v3_dot } from "./v3_dot.js";
|
|
12
12
|
import { v3_length_sqr } from "./v3_length_sqr.js";
|
|
@@ -14,6 +14,7 @@ import { v3_length } from "./v3_length.js";
|
|
|
14
14
|
import { v3_angle_between } from "./v3_angle_between.js";
|
|
15
15
|
import { v3_lerp } from "./v3_lerp.js";
|
|
16
16
|
import { v3_slerp } from "./v3_slerp.js";
|
|
17
|
+
import { computeHashFloat } from "../math/hash/computeHashFloat.js";
|
|
17
18
|
|
|
18
19
|
class Vector3 {
|
|
19
20
|
/**
|
package/core/geom/Vector4.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { assert } from "../assert.js";
|
|
6
6
|
import { Signal } from "../events/signal/Signal.js";
|
|
7
7
|
import { lerp } from "../math/lerp.js";
|
|
8
|
-
import {
|
|
8
|
+
import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
|
|
9
|
+
import { computeHashFloat } from "../math/hash/computeHashFloat.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
*
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
* @param {function} random
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {number[]} result
|
|
5
|
+
* @param {number} result_offset
|
|
5
6
|
*/
|
|
6
|
-
export function randomPointInBox(random, result) {
|
|
7
|
+
export function randomPointInBox(random, result, result_offset) {
|
|
7
8
|
const x = random() - 0.5;
|
|
8
9
|
const y = random() - 0.5;
|
|
9
10
|
const z = random() - 0.5;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
//write the result
|
|
13
|
+
result[result_offset] = x;
|
|
14
|
+
result[result_offset + 1] = y;
|
|
15
|
+
result[result_offset + 2] = z;
|
|
12
16
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Volumetric sampling method, since sample volume is a point, it simply sets result to origin
|
|
3
3
|
* @param {function} random
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {number[]} result
|
|
5
|
+
* @param {number} destination_offset
|
|
5
6
|
*/
|
|
6
|
-
export function randomPointInPoint(random, result) {
|
|
7
|
-
result
|
|
7
|
+
export function randomPointInPoint(random, result, destination_offset) {
|
|
8
|
+
result[destination_offset] = 0;
|
|
9
|
+
result[destination_offset + 1] = 0;
|
|
10
|
+
result[destination_offset + 2] = 0;
|
|
8
11
|
}
|
|
@@ -4,9 +4,10 @@ import { PI2 } from "../../math/MathUtils.js";
|
|
|
4
4
|
*
|
|
5
5
|
* @see based on python code suggested here: https://stackoverflow.com/questions/5408276/sampling-uniformly-distributed-random-points-inside-a-spherical-volume
|
|
6
6
|
* @param {function} random
|
|
7
|
-
* @param {
|
|
7
|
+
* @param {number[]} result
|
|
8
|
+
* @param {number} result_offset
|
|
8
9
|
*/
|
|
9
|
-
export function randomPointInSphere(random, result) {
|
|
10
|
+
export function randomPointInSphere(random, result, result_offset) {
|
|
10
11
|
const phi = PI2 * random();
|
|
11
12
|
|
|
12
13
|
const cosTheta = random() * 2 - 1;
|
|
@@ -27,5 +28,7 @@ export function randomPointInSphere(random, result) {
|
|
|
27
28
|
const z = r * cosTheta;
|
|
28
29
|
|
|
29
30
|
//write the result
|
|
30
|
-
result
|
|
31
|
+
result[result_offset] = x;
|
|
32
|
+
result[result_offset + 1] = y;
|
|
33
|
+
result[result_offset + 2] = z;
|
|
31
34
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
* @param {function} random
|
|
4
|
-
* @param {
|
|
4
|
+
* @param {number[]} result
|
|
5
|
+
* @param {number} result_offset
|
|
5
6
|
*/
|
|
6
|
-
export function randomPointOnBox(random, result) {
|
|
7
|
+
export function randomPointOnBox(random, result, result_offset) {
|
|
7
8
|
//pick a side
|
|
8
9
|
const side = random();
|
|
9
10
|
|
|
@@ -29,5 +30,8 @@ export function randomPointOnBox(random, result) {
|
|
|
29
30
|
z = fixedAxis;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
//write the result
|
|
34
|
+
result[result_offset] = x;
|
|
35
|
+
result[result_offset + 1] = y;
|
|
36
|
+
result[result_offset + 2] = z;
|
|
33
37
|
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
*
|
|
3
3
|
* @see based on python code suggested here: https://stackoverflow.com/questions/5408276/sampling-uniformly-distributed-random-points-inside-a-spherical-volume
|
|
4
4
|
* @param {function} random
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {number[]} result
|
|
6
|
+
* @param {number} result_offset
|
|
6
7
|
*/
|
|
7
|
-
export function randomPointOnSphere(random, result) {
|
|
8
|
+
export function randomPointOnSphere(random, result, result_offset) {
|
|
8
9
|
const phi = Math.PI * 2 * random();
|
|
9
10
|
|
|
10
11
|
const cosTheta = random() * 2 - 1;
|
|
@@ -23,5 +24,7 @@ export function randomPointOnSphere(random, result) {
|
|
|
23
24
|
const z = r * cosTheta;
|
|
24
25
|
|
|
25
26
|
//write the result
|
|
26
|
-
result
|
|
27
|
+
result[result_offset] = x;
|
|
28
|
+
result[result_offset + 1] = y;
|
|
29
|
+
result[result_offset + 2] = z;
|
|
27
30
|
}
|
package/core/geom/v3_length.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} x
|
|
4
|
+
* @param {number} y
|
|
5
|
+
* @param {number} z
|
|
6
|
+
* @returns {number}
|
|
7
|
+
*/
|
|
3
8
|
export function v3_length(x, y, z) {
|
|
4
|
-
return Math.
|
|
9
|
+
return Math.hypot(x, y, z);
|
|
5
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//
|
|
2
2
|
import { seededRandom } from "../math/random/seededRandom.js";
|
|
3
|
-
import { randomIntegerBetween } from "../math/MathUtils.js";
|
|
4
3
|
import { SquareMatrix } from "./SquareMatrix.js";
|
|
5
4
|
import { DataType } from "../collection/table/DataType.js";
|
|
6
5
|
import { BitSet } from "../binary/BitSet.js";
|
|
7
6
|
import FastBinaryHeap from "../../engine/navigation/grid/FastBinaryHeap.js";
|
|
7
|
+
import { randomIntegerBetween } from "../math/random/randomIntegerBetween.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @template N
|