@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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AABB3 } from "../../aabb/AABB3.js";
|
|
2
|
+
import { TetrahedralMesh } from "../TetrahedralMesh.js";
|
|
3
|
+
import { tetrahedral_mesh_build_from_grid } from "./tetrahedral_mesh_build_from_grid.js";
|
|
4
|
+
|
|
5
|
+
test("Single cube", () => {
|
|
6
|
+
|
|
7
|
+
const mesh = new TetrahedralMesh();
|
|
8
|
+
|
|
9
|
+
const points = [];
|
|
10
|
+
|
|
11
|
+
tetrahedral_mesh_build_from_grid(
|
|
12
|
+
mesh,
|
|
13
|
+
points,
|
|
14
|
+
new AABB3(0, 0, 0, 1, 1, 1),
|
|
15
|
+
2, 2, 2
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// number of points
|
|
19
|
+
expect(points.length).toBe(8 * 3);
|
|
20
|
+
|
|
21
|
+
expect(mesh.count).toBeGreaterThanOrEqual(5);
|
|
22
|
+
expect(mesh.count).toBeLessThanOrEqual(6);
|
|
23
|
+
|
|
24
|
+
// mesh should only reference created points
|
|
25
|
+
const tetrahedrons = mesh.getLive();
|
|
26
|
+
|
|
27
|
+
for (let i = 0; i < tetrahedrons.length; i++) {
|
|
28
|
+
const tet = tetrahedrons[i];
|
|
29
|
+
|
|
30
|
+
for (let vertex_index = 0; vertex_index < 4; vertex_index++) {
|
|
31
|
+
|
|
32
|
+
const vert = mesh.getVertexIndex(tet, vertex_index);
|
|
33
|
+
|
|
34
|
+
expect(vert).toBeGreaterThanOrEqual(0);
|
|
35
|
+
expect(vert).toBeLessThan(8);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -7,6 +7,7 @@ import { ShadedGeometry } from "../../../../engine/graphics/ecs/mesh-v2/ShadedGe
|
|
|
7
7
|
import { ShadedGeometrySystem } from "../../../../engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
8
8
|
import { Gizmo } from "../../../../engine/graphics/render/gizmo/Gizmo.js";
|
|
9
9
|
import { GizmoRenderingPlugin } from "../../../../engine/graphics/render/gizmo/GizmoRenderingPlugin.js";
|
|
10
|
+
import { randomFloatBetween } from "../../../math/random/randomFloatBetween.js";
|
|
10
11
|
import { seededRandom } from "../../../math/random/seededRandom.js";
|
|
11
12
|
import { number_pretty_print } from "../../../primitives/numbers/number_pretty_print.js";
|
|
12
13
|
import { delay } from "../../../process/delay.js";
|
|
@@ -14,8 +15,38 @@ import { AABB3 } from "../aabb/AABB3.js";
|
|
|
14
15
|
import { make_justified_point_grid } from "../util/make_justified_point_grid.js";
|
|
15
16
|
import { build_tetrahedral_mesh_buffer_geometry } from "./build_tetrahedral_mesh_buffer_geometry.js";
|
|
16
17
|
import { compute_delaunay_tetrahedral_mesh } from "./delaunay/compute_delaunay_tetrahedral_mesh.js";
|
|
18
|
+
import { tetrahedral_mesh_build_from_grid } from "./delaunay/tetrahedral_mesh_build_from_grid.js";
|
|
17
19
|
import { TetrahedralMesh } from "./TetrahedralMesh.js";
|
|
18
20
|
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {TetrahedralMesh} tetrahedra
|
|
25
|
+
* @param {number[]} points
|
|
26
|
+
*/
|
|
27
|
+
function make_delaunay_grid(tetrahedra, points) {
|
|
28
|
+
|
|
29
|
+
const random = seededRandom();
|
|
30
|
+
|
|
31
|
+
for (let i = 0; i < 600; i++) {
|
|
32
|
+
points.push(
|
|
33
|
+
randomFloatBetween(random, -100, 100),
|
|
34
|
+
randomFloatBetween(random, 0, 150),
|
|
35
|
+
randomFloatBetween(random, -100, 100),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
make_justified_point_grid(
|
|
40
|
+
new AABB3(-100, 0, -100, 100, 150, 100),
|
|
41
|
+
20,
|
|
42
|
+
(x, y, z) => {
|
|
43
|
+
points.push(x, y, z);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
compute_delaunay_tetrahedral_mesh(tetrahedra, points, points.length / 3);
|
|
48
|
+
}
|
|
49
|
+
|
|
19
50
|
/**
|
|
20
51
|
*
|
|
21
52
|
* @param {Engine} engine
|
|
@@ -30,51 +61,23 @@ async function main(engine) {
|
|
|
30
61
|
const offset = [7.5, 1, 7.5];
|
|
31
62
|
const scale = [.5, .5, .5];
|
|
32
63
|
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @type {number[]}
|
|
67
|
+
*/
|
|
33
68
|
const points = [];
|
|
34
69
|
|
|
35
|
-
|
|
36
|
-
// 0, 0, 0,
|
|
37
|
-
// 10, 0, 0,
|
|
38
|
-
// 10, 0, 10,
|
|
39
|
-
// 0, 0, 10,
|
|
40
|
-
//
|
|
41
|
-
// 0, 10, 0,
|
|
42
|
-
// 10, 10, 0,
|
|
43
|
-
// 10, 10, 10,
|
|
44
|
-
// 0, 10, 10,
|
|
45
|
-
// );
|
|
46
|
-
|
|
47
|
-
const random = seededRandom();
|
|
48
|
-
|
|
49
|
-
// for (let i = 0; i < 600; i++) {
|
|
50
|
-
// points.push(
|
|
51
|
-
// randomFloatBetween(random, -100, 100),
|
|
52
|
-
// randomFloatBetween(random, 0, 150),
|
|
53
|
-
// randomFloatBetween(random, -100, 100),
|
|
54
|
-
// );
|
|
55
|
-
// }
|
|
56
|
-
|
|
57
|
-
make_justified_point_grid(
|
|
58
|
-
new AABB3(-100, 0, -100, 100, 150, 100),
|
|
59
|
-
20,
|
|
60
|
-
(x, y, z) => {
|
|
61
|
-
points.push(x, y, z);
|
|
62
|
-
}
|
|
63
|
-
);
|
|
70
|
+
const tetrahedra = new TetrahedralMesh();
|
|
64
71
|
|
|
65
72
|
await delay(1000);
|
|
66
73
|
|
|
67
|
-
const tetrahedra = new TetrahedralMesh();
|
|
68
74
|
console.time('mesh build');
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// 64, 32, 64
|
|
76
|
-
// )
|
|
77
|
-
// console.profileEnd('mesh build');
|
|
75
|
+
tetrahedral_mesh_build_from_grid(
|
|
76
|
+
tetrahedra,
|
|
77
|
+
points,
|
|
78
|
+
new AABB3(-10, 0, -10, 10, 10, 10),
|
|
79
|
+
8, 4, 8
|
|
80
|
+
)
|
|
78
81
|
console.timeEnd('mesh build');
|
|
79
82
|
console.log(`Mesh build for ${number_pretty_print(points.length / 3)} points`)
|
|
80
83
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]|Float32Array} result
|
|
4
|
+
* @param {number} result_offset
|
|
5
|
+
* @param {number[]|Float32Array} input
|
|
6
|
+
* @param {number} input_offset
|
|
7
|
+
*/
|
|
8
|
+
export function v3_negate_array(result: number[] | Float32Array, result_offset: number, input: number[] | Float32Array, input_offset: number): void;
|
|
9
|
+
//# sourceMappingURL=v3_negate_array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3_negate_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/v3_negate_array.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wCALW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,QAUhB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]|Float32Array} result
|
|
4
|
+
* @param {number} result_offset
|
|
5
|
+
* @param {number[]|Float32Array} input
|
|
6
|
+
* @param {number} input_offset
|
|
7
|
+
*/
|
|
8
|
+
export function v3_negate_array(result, result_offset, input, input_offset) {
|
|
9
|
+
const x = input[input_offset];
|
|
10
|
+
const y = input[input_offset + 1];
|
|
11
|
+
const z = input[input_offset + 2];
|
|
12
|
+
|
|
13
|
+
result[result_offset] = -x;
|
|
14
|
+
result[result_offset + 1] = -y;
|
|
15
|
+
result[result_offset + 2] = -z;
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quaternion.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Quaternion.js"],"names":[],"mappings":";AAsBA;
|
|
1
|
+
{"version":3,"file":"Quaternion.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Quaternion.js"],"names":[],"mappings":"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"}
|
|
@@ -13,9 +13,9 @@ import { v4_length } from "./vec4/v4_length.js";
|
|
|
13
13
|
import Vector3 from "./Vector3.js";
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
16
|
+
const scratch_v3_a = new Vector3();
|
|
17
|
+
const scratch_v3_b = new Vector3();
|
|
18
|
+
const scratch_v3_c = new Vector3();
|
|
19
19
|
|
|
20
20
|
const sin = Math.sin;
|
|
21
21
|
const cos = Math.cos;
|
|
@@ -116,12 +116,12 @@ class Quaternion {
|
|
|
116
116
|
* @param {number} uz up vector
|
|
117
117
|
*/
|
|
118
118
|
_lookRotation(fx, fy, fz, ux, uy, uz) {
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
scratch_v3_a.set(fx, fy, fz);
|
|
120
|
+
scratch_v3_a.normalize();
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
scratch_v3_c._crossVectors(ux, uy, uz, scratch_v3_a.x, scratch_v3_a.y, scratch_v3_a.z);
|
|
123
123
|
|
|
124
|
-
if (
|
|
124
|
+
if (scratch_v3_c.lengthSq() === 0) {
|
|
125
125
|
// up and forward are parallel
|
|
126
126
|
|
|
127
127
|
/*
|
|
@@ -130,32 +130,32 @@ class Quaternion {
|
|
|
130
130
|
*/
|
|
131
131
|
|
|
132
132
|
if (Math.abs(uz) === 1) {
|
|
133
|
-
|
|
133
|
+
scratch_v3_a.x += 0.001;
|
|
134
134
|
} else {
|
|
135
|
-
|
|
135
|
+
scratch_v3_a.z += 0.001;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
scratch_v3_a.normalize();
|
|
139
|
+
scratch_v3_c._crossVectors(ux, uy, uz, scratch_v3_a.x, scratch_v3_a.y, scratch_v3_a.z);
|
|
140
140
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
scratch_v3_c.normalize();
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
scratch_v3_b.crossVectors(scratch_v3_a, scratch_v3_c);
|
|
146
146
|
|
|
147
147
|
// construct partial transform matrix
|
|
148
|
-
const m00 =
|
|
149
|
-
const m10 =
|
|
150
|
-
const m20 =
|
|
148
|
+
const m00 = scratch_v3_c.x;
|
|
149
|
+
const m10 = scratch_v3_c.y;
|
|
150
|
+
const m20 = scratch_v3_c.z;
|
|
151
151
|
|
|
152
|
-
const m01 =
|
|
153
|
-
const m11 =
|
|
154
|
-
const m21 =
|
|
152
|
+
const m01 = scratch_v3_b.x;
|
|
153
|
+
const m11 = scratch_v3_b.y;
|
|
154
|
+
const m21 = scratch_v3_b.z;
|
|
155
155
|
|
|
156
|
-
const m02 =
|
|
157
|
-
const m12 =
|
|
158
|
-
const m22 =
|
|
156
|
+
const m02 = scratch_v3_a.x;
|
|
157
|
+
const m12 = scratch_v3_a.y;
|
|
158
|
+
const m22 = scratch_v3_a.z;
|
|
159
159
|
|
|
160
160
|
this.__setFromRotationMatrix(
|
|
161
161
|
m00, m01, m02,
|
|
@@ -189,7 +189,7 @@ class Quaternion {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
*
|
|
192
|
+
* Makes this quaternion into an inverse of the other
|
|
193
193
|
* @param {Quaternion} other
|
|
194
194
|
*/
|
|
195
195
|
copyInverse(other) {
|
|
@@ -209,7 +209,7 @@ class Quaternion {
|
|
|
209
209
|
const length_sqr = x * x + y * y + z * z + w * w;
|
|
210
210
|
|
|
211
211
|
if (length_sqr === 0) {
|
|
212
|
-
this.set(0, 0, 0,
|
|
212
|
+
this.set(0, 0, 0, 1);
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
|
|
@@ -265,6 +265,11 @@ class Quaternion {
|
|
|
265
265
|
* @param {number} angle
|
|
266
266
|
*/
|
|
267
267
|
_fromAxisAngle(ax, ay, az, angle) {
|
|
268
|
+
assert.isNumber(ax, 'ax');
|
|
269
|
+
assert.isNumber(ay, 'ay');
|
|
270
|
+
assert.isNumber(az, 'az');
|
|
271
|
+
assert.isNumber(angle, 'angle');
|
|
272
|
+
|
|
268
273
|
const halfAngle = angle * 0.5;
|
|
269
274
|
|
|
270
275
|
const sinA2 = sin(halfAngle);
|
|
@@ -303,7 +308,7 @@ class Quaternion {
|
|
|
303
308
|
// perform projection of rotation onto axis
|
|
304
309
|
const d = v3_dot(x, y, z, axis.x, axis.y, axis.z);
|
|
305
310
|
|
|
306
|
-
const mag2 =
|
|
311
|
+
const mag2 = axis.x * axis.x + axis.y * axis.y + axis.z * axis.z;
|
|
307
312
|
|
|
308
313
|
const m = d / mag2;
|
|
309
314
|
|
|
@@ -818,58 +823,6 @@ class Quaternion {
|
|
|
818
823
|
this.set(_x, _y, _z, _w);
|
|
819
824
|
}
|
|
820
825
|
|
|
821
|
-
/**
|
|
822
|
-
* Based on blog post: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
|
|
823
|
-
* @param {Vector3} from
|
|
824
|
-
* @param {Vector3} to
|
|
825
|
-
*/
|
|
826
|
-
fromNonUnitVectors(from, to) {
|
|
827
|
-
//quat quat::fromtwovectors(vec3 u, vec3 v)
|
|
828
|
-
// {
|
|
829
|
-
// vec3 w = cross(u, v);
|
|
830
|
-
// quat q = quat(dot(u, v), w.x, w.y, w.z);
|
|
831
|
-
// q.w += length(q);
|
|
832
|
-
// return normalize(q);
|
|
833
|
-
// }
|
|
834
|
-
|
|
835
|
-
const ax = from.x;
|
|
836
|
-
const ay = from.y;
|
|
837
|
-
const az = from.z;
|
|
838
|
-
|
|
839
|
-
const bx = to.x;
|
|
840
|
-
const by = to.y;
|
|
841
|
-
const bz = to.z;
|
|
842
|
-
|
|
843
|
-
//compute cross product
|
|
844
|
-
const crossX = ay * bz - az * by;
|
|
845
|
-
const crossY = az * bx - ax * bz;
|
|
846
|
-
const crossZ = ax * by - ay * bx;
|
|
847
|
-
|
|
848
|
-
const uv_dot = v3_dot(ax, ay, az, bx, by, bz);
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
const qX = crossX;
|
|
852
|
-
const qY = crossY;
|
|
853
|
-
const qZ = crossZ;
|
|
854
|
-
const qW = uv_dot;
|
|
855
|
-
|
|
856
|
-
const p0 = qX * qX + qY * qY + qZ * qZ;
|
|
857
|
-
|
|
858
|
-
const l0 = Math.sqrt(p0 + qW * qW);
|
|
859
|
-
|
|
860
|
-
const qW_1 = qW + l0;
|
|
861
|
-
|
|
862
|
-
//normalize result
|
|
863
|
-
const l1 = 1 / Math.sqrt(p0 + qW_1 * qW_1);
|
|
864
|
-
|
|
865
|
-
const x = qX * l1;
|
|
866
|
-
const y = qY * l1;
|
|
867
|
-
const z = qZ * l1;
|
|
868
|
-
const w = qW * l1;
|
|
869
|
-
|
|
870
|
-
this.set(x, y, z, w);
|
|
871
|
-
}
|
|
872
|
-
|
|
873
826
|
/**
|
|
874
827
|
* NOTE: Vectors need to be normalized
|
|
875
828
|
* Based on blog post: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
|
|
@@ -112,6 +112,10 @@ export default class Vector3 implements Vector3Like {
|
|
|
112
112
|
|
|
113
113
|
writeToArray(array: number[] | ArrayLike<number>, offset?: number): void
|
|
114
114
|
|
|
115
|
+
toArray(array: number[] | ArrayLike<number>, offset?: number): void
|
|
116
|
+
|
|
117
|
+
fromArray(array: number[] | ArrayLike<number>, offset?: number): void
|
|
118
|
+
|
|
115
119
|
asArray(): number[]
|
|
116
120
|
|
|
117
121
|
static distance(a: Vector3Like, b: Vector3Like): number
|
package/src/core/geom/Vector3.js
CHANGED
|
@@ -505,10 +505,10 @@ class Vector3 {
|
|
|
505
505
|
|
|
506
506
|
// calculate quat * vector
|
|
507
507
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
508
|
+
const ix = qw * x + qy * z - qz * y;
|
|
509
|
+
const iy = qw * y + qz * x - qx * z;
|
|
510
|
+
const iz = qw * z + qx * y - qy * x;
|
|
511
|
+
const iw = -qx * x - qy * y - qz * z;
|
|
512
512
|
|
|
513
513
|
// calculate result * inverse quat
|
|
514
514
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross product
|
|
3
|
+
* @param {number[]|Float32Array} output
|
|
4
|
+
* @param {number} output_offset
|
|
5
|
+
* @param {number[]|Float32Array} a
|
|
6
|
+
* @param {number} a_offset
|
|
7
|
+
* @param {number[]|Float32Array} b
|
|
8
|
+
* @param {number} b_offset
|
|
9
|
+
*/
|
|
10
|
+
export function v3_cross_array(output: number[] | Float32Array, output_offset: number, a: number[] | Float32Array, a_offset: number, b: number[] | Float32Array, b_offset: number): void;
|
|
11
|
+
//# sourceMappingURL=v3_cross_array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3_cross_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_cross_array.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,uCAPW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,KACN,MAAM,EAAE,GAAC,YAAY,YACrB,MAAM,KACN,MAAM,EAAE,GAAC,YAAY,YACrB,MAAM,QAuBhB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross product
|
|
3
|
+
* @param {number[]|Float32Array} output
|
|
4
|
+
* @param {number} output_offset
|
|
5
|
+
* @param {number[]|Float32Array} a
|
|
6
|
+
* @param {number} a_offset
|
|
7
|
+
* @param {number[]|Float32Array} b
|
|
8
|
+
* @param {number} b_offset
|
|
9
|
+
*/
|
|
10
|
+
export function v3_cross_array(
|
|
11
|
+
output, output_offset,
|
|
12
|
+
a, a_offset,
|
|
13
|
+
b, b_offset,
|
|
14
|
+
) {
|
|
15
|
+
|
|
16
|
+
const ax = a[a_offset];
|
|
17
|
+
const ay = a[a_offset + 1];
|
|
18
|
+
const az = a[a_offset + 2];
|
|
19
|
+
|
|
20
|
+
const bx = b[b_offset];
|
|
21
|
+
const by = b[b_offset + 1];
|
|
22
|
+
const bz = b[b_offset + 2];
|
|
23
|
+
|
|
24
|
+
const x = ay * bz - az * by;
|
|
25
|
+
const y = az * bx - ax * bz;
|
|
26
|
+
const z = ax * by - ay * bx;
|
|
27
|
+
|
|
28
|
+
output[output_offset] = x;
|
|
29
|
+
output[output_offset + 1] = y;
|
|
30
|
+
output[output_offset + 2] = z;
|
|
31
|
+
}
|
|
@@ -16,7 +16,7 @@ export function v3_displace_in_direction(
|
|
|
16
16
|
origin_x, source_y, source_z,
|
|
17
17
|
direction_x, direction_y, direction_z
|
|
18
18
|
) {
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
if (distance === 0) {
|
|
21
21
|
result.set(origin_x, source_y, source_z);
|
|
22
22
|
return true;
|
|
@@ -43,4 +43,5 @@ export function v3_displace_in_direction(
|
|
|
43
43
|
result.set(x, y, z);
|
|
44
44
|
|
|
45
45
|
return true;
|
|
46
|
-
}
|
|
46
|
+
}
|
|
47
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Direction vector must be normalized
|
|
3
|
+
* @param {number[]|Float32Array} result
|
|
4
|
+
* @param {number} result_offset
|
|
5
|
+
* @param {number[]|Float32Array} origin
|
|
6
|
+
* @param {number} origin_offset
|
|
7
|
+
* @param {number[]|Float32Array} direction Must be normalized
|
|
8
|
+
* @param {number} direction_offset
|
|
9
|
+
* @param {number} distance
|
|
10
|
+
*/
|
|
11
|
+
export function v3_displace_in_direction_array(result: number[] | Float32Array, result_offset: number, origin: number[] | Float32Array, origin_offset: number, direction: number[] | Float32Array, direction_offset: number, distance: number): void;
|
|
12
|
+
//# sourceMappingURL=v3_displace_in_direction_array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3_displace_in_direction_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_displace_in_direction_array.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,uDARW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,UACN,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,oBACrB,MAAM,YACN,MAAM,QAahB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Direction vector must be normalized
|
|
3
|
+
* @param {number[]|Float32Array} result
|
|
4
|
+
* @param {number} result_offset
|
|
5
|
+
* @param {number[]|Float32Array} origin
|
|
6
|
+
* @param {number} origin_offset
|
|
7
|
+
* @param {number[]|Float32Array} direction Must be normalized
|
|
8
|
+
* @param {number} direction_offset
|
|
9
|
+
* @param {number} distance
|
|
10
|
+
*/
|
|
11
|
+
export function v3_displace_in_direction_array(
|
|
12
|
+
result, result_offset,
|
|
13
|
+
origin, origin_offset,
|
|
14
|
+
direction, direction_offset,
|
|
15
|
+
distance
|
|
16
|
+
) {
|
|
17
|
+
|
|
18
|
+
result[result_offset] = origin[origin_offset] + direction[direction_offset + 0] * distance;
|
|
19
|
+
result[result_offset + 1] = origin[origin_offset + 1] + direction[direction_offset + 1] * distance;
|
|
20
|
+
result[result_offset + 2] = origin[origin_offset + 2] + direction[direction_offset + 2] * distance;
|
|
21
|
+
|
|
22
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3_dot_array_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_dot_array_array.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,sCANW,MAAM,EAAE,GAAC,YAAY,YACrB,MAAM,KACN,MAAM,EAAE,GAAC,YAAY,YACrB,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"v3_dot_array_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_dot_array_array.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,sCANW,MAAM,EAAE,GAAC,YAAY,YACrB,MAAM,KACN,MAAM,EAAE,GAAC,YAAY,YACrB,MAAM,GACJ,MAAM,CAgBlB"}
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* @param {number} b_offset
|
|
7
7
|
* @returns {number}
|
|
8
8
|
*/
|
|
9
|
-
export function v3_dot_array_array(
|
|
9
|
+
export function v3_dot_array_array(
|
|
10
|
+
a, a_offset,
|
|
11
|
+
b, b_offset
|
|
12
|
+
) {
|
|
10
13
|
|
|
11
14
|
const a_x = a[a_offset];
|
|
12
15
|
const a_y = a[a_offset + 1];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* @param {number[]|Float32Array} input
|
|
4
|
-
* @param {number} input_offset
|
|
5
3
|
* @param {number[]|Float32Array} output
|
|
6
4
|
* @param {number} output_offset
|
|
5
|
+
* @param {number[]|Float32Array} input
|
|
6
|
+
* @param {number} input_offset
|
|
7
7
|
*/
|
|
8
|
-
export function v3_normalize_array(
|
|
8
|
+
export function v3_normalize_array(output: number[] | Float32Array, output_offset: number, input: number[] | Float32Array, input_offset: number): void;
|
|
9
9
|
//# sourceMappingURL=v3_normalize_array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3_normalize_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_normalize_array.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,
|
|
1
|
+
{"version":3,"file":"v3_normalize_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_normalize_array.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,2CALW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,QAqBhB"}
|
|
@@ -2,14 +2,14 @@ import { v3_length } from "./v3_length.js";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* @param {number[]|Float32Array} input
|
|
6
|
-
* @param {number} input_offset
|
|
7
5
|
* @param {number[]|Float32Array} output
|
|
8
6
|
* @param {number} output_offset
|
|
7
|
+
* @param {number[]|Float32Array} input
|
|
8
|
+
* @param {number} input_offset
|
|
9
9
|
*/
|
|
10
10
|
export function v3_normalize_array(
|
|
11
|
+
output, output_offset,
|
|
11
12
|
input, input_offset,
|
|
12
|
-
output, output_offset
|
|
13
13
|
) {
|
|
14
14
|
|
|
15
15
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Returns a value with the magnitude of x and the sign of y.
|
|
3
3
|
* NOTE: a port of c++ method from tgmath.h
|
|
4
4
|
* @param {number} x
|
|
5
|
-
* @param {number} y
|
|
5
|
+
* @param {number} y take sign from this value
|
|
6
6
|
* @returns {number}
|
|
7
7
|
*/
|
|
8
8
|
export function copysign(x: number, y: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epsilonEquals.d.ts","sourceRoot":"","sources":["../../../../src/core/math/epsilonEquals.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"epsilonEquals.d.ts","sourceRoot":"","sources":["../../../../src/core/math/epsilonEquals.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,iCALW,MAAM,KACN,MAAM,cACN,MAAM,GACJ,OAAO,CASnB"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
|
+
import { EPSILON } from "./EPSILON.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Comparison of two numbers with a given tolerance
|
|
5
6
|
* @param {number} a
|
|
6
7
|
* @param {number} b
|
|
7
|
-
* @param {number} tolerance
|
|
8
|
+
* @param {number} [tolerance]
|
|
8
9
|
* @returns {boolean}
|
|
9
10
|
*/
|
|
10
|
-
export function epsilonEquals(a, b, tolerance) {
|
|
11
|
+
export function epsilonEquals(a, b, tolerance = EPSILON) {
|
|
11
12
|
assert.isNumber(a, 'a');
|
|
12
13
|
assert.isNumber(b, 'b');
|
|
13
14
|
assert.isNumber(tolerance, 'tolerance');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Linear
|
|
1
|
+
# Linear Algebra package
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param {number} t normalized interpolation position in interval [0,1]
|
|
5
5
|
* @param {number} p0 first value
|
|
6
6
|
* @param {number} p1 second value
|
|
7
|
-
* @param {number} m0 first tangent (tangent
|
|
7
|
+
* @param {number} m0 first tangent (tangent exiting from first value)
|
|
8
8
|
* @param {number} m1 second tangent (tangent entering into second value)
|
|
9
9
|
* @return {number}
|
|
10
10
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param {number} t normalized interpolation position in interval [0,1]
|
|
5
5
|
* @param {number} p0 first value
|
|
6
6
|
* @param {number} p1 second value
|
|
7
|
-
* @param {number} m0 first tangent (tangent
|
|
7
|
+
* @param {number} m0 first tangent (tangent exiting from first value)
|
|
8
8
|
* @param {number} m1 second tangent (tangent entering into second value)
|
|
9
9
|
* @return {number}
|
|
10
10
|
*/
|