@pirireis/webglobeplugins 0.9.1 → 0.9.3
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/Math/arc.ts +74 -245
- package/Math/constants.ts +4 -1
- package/Math/frustum/camera.ts +32 -0
- package/Math/frustum/from-globeinfo.ts +63 -0
- package/Math/frustum/types.ts +11 -0
- package/Math/globe-util/horizon-plane.ts +137 -0
- package/Math/juction/arc-plane.ts +90 -0
- package/Math/juction/line-sphere.ts +30 -0
- package/Math/juction/plane-plane.ts +66 -0
- package/Math/line.ts +70 -0
- package/Math/methods.js +29 -1
- package/Math/plane.ts +57 -138
- package/Math/quaternion.ts +108 -144
- package/Math/types.ts +39 -30
- package/Math/vec3.ts +155 -0
- package/altitude-locator/plugin.js +1 -1
- package/bearing-line/plugin.js +1 -1
- package/circle-line-chain/plugin.js +1 -1
- package/globe-types.ts +13 -0
- package/heatwave/plugins/heatwaveglobeshell.js +5 -9
- package/index.js +3 -0
- package/package.json +1 -1
- package/programs/interface.ts +7 -0
- package/programs/line-on-globe/circle-accurate-3d.js +1 -1
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +1 -1
- package/programs/line-on-globe/lines-color-instanced-flat.js +1 -1
- package/programs/line-on-globe/linestrip.ts +228 -0
- package/programs/line-on-globe/naive-accurate-flexible.js +1 -1
- package/programs/line-on-globe/to-the-surface.js +1 -1
- package/programs/picking/pickable-renderer.js +1 -1
- package/programs/point-on-globe/element-globe-surface-glow.js +1 -1
- package/programs/point-on-globe/element-point-glow.js +1 -1
- package/programs/totems/camerauniformblock.js +24 -1
- package/programs/vectorfields/logics/drawrectangleparticles.js +1 -1
- package/shape-on-terrain/arc/naive/plugin.ts +304 -0
- package/tests/Math/junction/arc-plane.test.ts +129 -0
- package/tests/Math/junction/plane-plane.test.ts +82 -0
- package/tests/Math/plane.test.ts +30 -32
- package/tests/Math/vec3.test.ts +14 -0
- package/timetracks/plugin-line-strip.js +3 -1
- package/{types.js → types.ts} +2 -1
- package/util/account/{index.js → index.ts} +1 -2
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +0 -31
- package/util/account/single-attribute-buffer-management/index.ts +13 -0
- package/util/gl-util/buffer/{integrate-buffer.js → attribute-loader.ts} +17 -6
- package/util/gl-util/buffer/index.ts +6 -0
- package/util/gl-util/buffer/types.ts +13 -0
- package/util/gl-util/draw-options/methods.js +4 -4
- package/util/gl-util/draw-options/{types.js → types.ts} +10 -0
- package/util/gl-util/uniform-block/{manager.js → manager.ts} +24 -13
- package/util/gl-util/uniform-block/types.ts +27 -0
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +17 -17
- package/waveparticles/plugin.js +3 -0
- package/wind/plugin.js +6 -19
- package/Math/methodology/arc-part-on-screen.ts +0 -47
- package/Math/ray.ts +0 -101
- package/Math/vector3d.ts +0 -241
- package/shape-on-terrain/tree-search.js +0 -0
- package/surface-cover-shapes/arc/naive/data-manager.ts +0 -0
- package/surface-cover-shapes/arc/naive/plugin.ts +0 -0
- package/tests/Math/arc.test.ts +0 -112
- package/tests/Math/quaternion.test.ts +0 -98
- package/tests/Math/ray-plane.test.ts +0 -176
- package/tests/Math/vector3d.test.ts +0 -104
- package/util/account/single-attribute-buffer-management/index.js +0 -4
- package/util/gl-util/uniform-block/types.js +0 -7
- /package/{shape-on-terrain/intersection.js → Math/matrix4.ts} +0 -0
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Quaternion } from '../../Math/quaternion';
|
|
2
|
-
import { Vector3D } from '../../Math/vector3d';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let _0vector: Vector3D;
|
|
6
|
-
let _0quaternion: Quaternion;
|
|
7
|
-
let _1quaternion: Quaternion;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
beforeAll(() => {
|
|
11
|
-
_0vector = new Vector3D(0, 0, 0);
|
|
12
|
-
_0quaternion = new Quaternion(0, 0, 0, 1);
|
|
13
|
-
_1quaternion = new Quaternion(0, 0, 0, 1);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test('Quaternion constructor and normalization', () => {
|
|
17
|
-
const quaternion = new Quaternion(1, 2, 3, 4);
|
|
18
|
-
expect(quaternion.x).toBe(1);
|
|
19
|
-
expect(quaternion.y).toBe(2);
|
|
20
|
-
expect(quaternion.z).toBe(3);
|
|
21
|
-
expect(quaternion.w).toBe(4);
|
|
22
|
-
|
|
23
|
-
const length = Math.sqrt(1 ** 2 + 2 ** 2 + 3 ** 2 + 4 ** 2);
|
|
24
|
-
expect(length).toBeCloseTo(length); // Check the length of the quaternion
|
|
25
|
-
|
|
26
|
-
quaternion.normalize();
|
|
27
|
-
expect(quaternion.x).toBeCloseTo(1 / length);
|
|
28
|
-
expect(quaternion.y).toBeCloseTo(2 / length);
|
|
29
|
-
expect(quaternion.z).toBeCloseTo(3 / length);
|
|
30
|
-
expect(quaternion.w).toBeCloseTo(4 / length);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
test('Quaternion Vector3D rotation , Z axis', () => {
|
|
35
|
-
|
|
36
|
-
const xyByEuler = (angle: number) => new Vector3D(
|
|
37
|
-
Math.cos(angle),
|
|
38
|
-
Math.sin(angle),
|
|
39
|
-
0
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
let angle = 0;
|
|
44
|
-
let step = Math.PI / 10;
|
|
45
|
-
_0quaternion.setFromAxisAngle(_0vector.set(0, 0, 1).clone(), step);
|
|
46
|
-
_0vector.set(1, 0, 0);
|
|
47
|
-
while (angle < Math.PI * 2) {
|
|
48
|
-
const vector = xyByEuler(angle);
|
|
49
|
-
expect(_0vector.equals(vector)).toBe(true);
|
|
50
|
-
angle += step;
|
|
51
|
-
_0vector.applyQuaternion(_0quaternion);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('Quaternion Vector3D rotation , Y axis', () => {
|
|
58
|
-
|
|
59
|
-
const xyByEuler = (angle: number) => new Vector3D(
|
|
60
|
-
Math.cos(angle),
|
|
61
|
-
0,
|
|
62
|
-
(angle <= Math.PI ? -1 : 1) * Math.abs(Math.sin(angle)) // because of right hand rule
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
let angle = 0;
|
|
67
|
-
let step = Math.PI / 10;
|
|
68
|
-
_0quaternion.setFromAxisAngle(_0vector.set(0, 1, 0).clone(), step);
|
|
69
|
-
_0vector.set(1, 0, 0);
|
|
70
|
-
while (angle < Math.PI * 2) {
|
|
71
|
-
const vector = xyByEuler(angle);
|
|
72
|
-
expect(_0vector.equals(vector)).toBe(true);
|
|
73
|
-
angle += step;
|
|
74
|
-
_0vector.applyQuaternion(_0quaternion);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
test('Quaternion Multiply', () => {
|
|
84
|
-
_0quaternion.setFromAxisAngle(_0vector.set(0, 0, 1), Math.PI / 2);
|
|
85
|
-
_1quaternion.setFromAxisAngle(_0vector.set(0, 1, 0), Math.PI / 2);
|
|
86
|
-
_0quaternion.multiply(_1quaternion);
|
|
87
|
-
_0vector.set(1, 0, 0).applyQuaternion(_0quaternion);
|
|
88
|
-
_0vector.equals(new Vector3D(0, -1, 0));
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
test("Quaternion all Zeros", () => {
|
|
93
|
-
|
|
94
|
-
_0quaternion.setFromAxisAngle(_0vector.set(0, 0, 0), 0);
|
|
95
|
-
_0vector.set(1, 0, 0).applyQuaternion(_0quaternion);
|
|
96
|
-
expect(_0vector.equals(new Vector3D(1, 0, 0))).toBe(true);
|
|
97
|
-
});
|
|
98
|
-
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { Ray } from '../../Math/ray'
|
|
2
|
-
import { Vector3D } from '../../Math/vector3d';
|
|
3
|
-
import { Plane } from '../../Math/plane';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const _0vector: Vector3D = new Vector3D(0, 0, 1);
|
|
8
|
-
const _1vector: Vector3D = new Vector3D(0, 0, 1);
|
|
9
|
-
const _3vector: Vector3D = new Vector3D(0, 0, 1);
|
|
10
|
-
const _0ray: Ray = new Ray(new Vector3D(0, 0, 0), new Vector3D(1, 0, 0));;
|
|
11
|
-
const _0plane: Plane = new Plane(new Vector3D(1, 0, 0), 0);;
|
|
12
|
-
const _1plane: Plane = new Plane(new Vector3D(1, 0, 0), 0);;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
beforeAll(() => {
|
|
16
|
-
_0vector.randomUnit();
|
|
17
|
-
_1vector.randomUnit();
|
|
18
|
-
_3vector.randomUnit();
|
|
19
|
-
_0plane.setFromPoints(_0vector, _1vector, _3vector);
|
|
20
|
-
_3vector.randomUnit();
|
|
21
|
-
_1plane.setFromPoints(_0vector, _1vector, _3vector);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
test("Plane Intersection => Ray", () => {
|
|
27
|
-
let result = Ray.fromTwoPlanes(_0plane, _1plane, _0ray);
|
|
28
|
-
expect(result).toBeInstanceOf(Ray);
|
|
29
|
-
if (result) {
|
|
30
|
-
expect(_0ray.contains(_0vector)).toBe(true);
|
|
31
|
-
expect(_0ray.contains(_1vector)).toBe(true);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
test('Ray constructor', () => {
|
|
37
|
-
const origin = new Vector3D(1, 2, 3);
|
|
38
|
-
const direction = new Vector3D(4, 5, 6);
|
|
39
|
-
const ray = new Ray(origin, direction);
|
|
40
|
-
|
|
41
|
-
expect(ray.origin).toEqual(origin);
|
|
42
|
-
expect(ray.direction).toEqual(direction.normalize());
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('Ray from two planes 1', () => {
|
|
46
|
-
const plane1 = new Plane(new Vector3D(1, 0, 0), 5);
|
|
47
|
-
const plane2 = new Plane(new Vector3D(0, 1, 0), 10);
|
|
48
|
-
const ray = Ray.fromTwoPlanes(plane1, plane2)!;
|
|
49
|
-
const plane1copy = plane1.clone();
|
|
50
|
-
const plane2copy = plane2.clone();
|
|
51
|
-
expect(ray).toBeInstanceOf(Ray);
|
|
52
|
-
expect(ray.contains(new Vector3D(5, 10, 0))).toBe(true);
|
|
53
|
-
expect(ray.contains(new Vector3D(5, 10, 5))).toBe(true);
|
|
54
|
-
expect(ray.contains(new Vector3D(5, 10, -5))).toBe(true);
|
|
55
|
-
expect(plane1.equals(plane1copy)).toBe(true);
|
|
56
|
-
expect(plane2.equals(plane2copy)).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
test('Ray from two planes 2 ', () => {
|
|
61
|
-
const plane1 = new Plane(new Vector3D(1, 1, 1).normalize(), 1 / Math.sqrt(3));
|
|
62
|
-
const plane2 = new Plane(new Vector3D(0, 0, 1).normalize(), 0);
|
|
63
|
-
const plane1copy = plane1.clone();
|
|
64
|
-
const plane2copy = plane2.clone();
|
|
65
|
-
const ray = Ray.fromTwoPlanes(plane1, plane2)!;
|
|
66
|
-
expect(ray).toBeInstanceOf(Ray);
|
|
67
|
-
expect(ray.contains(new Vector3D(0.5, 0.5, 0))).toBe(true);
|
|
68
|
-
expect(ray.contains(new Vector3D(1, 0, 0))).toBe(true);
|
|
69
|
-
expect(ray.contains(new Vector3D(0, 1, 0))).toBe(true);
|
|
70
|
-
expect(plane1.equals(plane1copy)).toBe(true);
|
|
71
|
-
expect(plane2.equals(plane2copy)).toBe(true);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe('Ray from two planes with parallel planes', () => {
|
|
75
|
-
test(`Ray from two planes from random points, try:`, () => {
|
|
76
|
-
for (let i = 0; i < 100; i++) {
|
|
77
|
-
_0vector.randomUnit();
|
|
78
|
-
_1vector.randomUnit();
|
|
79
|
-
_3vector.randomUnit();
|
|
80
|
-
_0plane.setFromPoints(_0vector, _1vector, _3vector);
|
|
81
|
-
|
|
82
|
-
const n = _3vector.clone().randomUnit();
|
|
83
|
-
_1plane.setFromPoints(_0vector, _1vector, n);
|
|
84
|
-
const plane1copy = _1plane.clone();
|
|
85
|
-
const plane2copy = _0plane.clone();
|
|
86
|
-
|
|
87
|
-
const ray = Ray.fromTwoPlanes(_0plane, _1plane)!;
|
|
88
|
-
if (ray === null) {
|
|
89
|
-
console.log(_0plane, _1plane, ray);
|
|
90
|
-
console.log(_0vector, _1vector, _3vector, n);
|
|
91
|
-
}
|
|
92
|
-
expect(ray).toBeInstanceOf(Ray);
|
|
93
|
-
|
|
94
|
-
expect(ray.contains(_0vector)).toBe(true);
|
|
95
|
-
expect(ray.contains(_1vector)).toBe(true);
|
|
96
|
-
expect(plane1copy.equals(_1plane)).toBe(true);
|
|
97
|
-
expect(plane2copy.equals(_0plane)).toBe(true);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
test('Ray intersection sphere', () => {
|
|
105
|
-
const ray = new Ray(new Vector3D(0, 0, 0), new Vector3D(0, 0, 1));
|
|
106
|
-
const sphereOrigin = new Vector3D(0, 0, 5);
|
|
107
|
-
const sphereRadius = 2;
|
|
108
|
-
const intersections = ray.intersectionSphere(sphereOrigin, sphereRadius)!;
|
|
109
|
-
|
|
110
|
-
expect(intersections).toBeInstanceOf(Array);
|
|
111
|
-
expect(intersections.length).toBe(2);
|
|
112
|
-
expect(intersections[0].equals(new Vector3D(0, 0, 3))).toBe(true);
|
|
113
|
-
expect(intersections[1].equals(new Vector3D(0, 0, 7))).toBe(true);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
describe('Ray from 2 points intersection with Sphere', () => {
|
|
119
|
-
test(`Ray from 2 points intersection with Sphere, try:`, () => {
|
|
120
|
-
for (let i = 0; i < 100; i++) {
|
|
121
|
-
const center = _3vector.randomUnit().scale(Math.random() * 10 + 1).clone();
|
|
122
|
-
const radius = Math.random() * 10 + 1;
|
|
123
|
-
const angle = Math.acos(_0vector.randomUnit().dot(_1vector.randomUnit()));
|
|
124
|
-
const _0clone = _0vector.scale(radius).add(center).clone();
|
|
125
|
-
const _1clone = _1vector.scale(radius).add(center).clone();
|
|
126
|
-
|
|
127
|
-
Ray.fromTwoPoints(_0vector, _1vector, _0ray);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const intersections = _0ray.intersectionSphere(center, radius)!;
|
|
131
|
-
expect(_3vector.equals(center)).toBe(true);
|
|
132
|
-
expect(intersections).toBeInstanceOf(Array);
|
|
133
|
-
|
|
134
|
-
expect(_0clone.equals(_0vector)).toBe(true);
|
|
135
|
-
expect(_1clone.equals(_1vector)).toBe(true);
|
|
136
|
-
|
|
137
|
-
expect(intersections.length).toBe(2);
|
|
138
|
-
|
|
139
|
-
_0vector.subtract(center).normalize().scale(radius).add(center);
|
|
140
|
-
_1vector.subtract(center).normalize().scale(radius).add(center);
|
|
141
|
-
|
|
142
|
-
expect(intersections.some((v) => v.equals(_0vector))).toBe(true);
|
|
143
|
-
expect(intersections.some((v) => v.equals(_1vector))).toBe(true);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const radius2 = radius * (1 + Math.random() * 10);
|
|
147
|
-
const intersections2 = _0ray.intersectionSphere(center, radius2)!;
|
|
148
|
-
expect(intersections2).toBeInstanceOf(Array);
|
|
149
|
-
expect(intersections2.length).toBe(2);
|
|
150
|
-
|
|
151
|
-
intersections2.forEach((v) => v.subtract(center).normalize());
|
|
152
|
-
|
|
153
|
-
const angle2 = Math.acos(intersections2[0].dot(intersections2[1]));
|
|
154
|
-
|
|
155
|
-
const x1 = angle / 2;
|
|
156
|
-
const D1 = Math.cos(x1) * radius;
|
|
157
|
-
const x2 = angle2 / 2;
|
|
158
|
-
const D2 = Math.cos(x2) * radius2;
|
|
159
|
-
|
|
160
|
-
expect(Math.abs(D1 - D2)).toBeLessThan(0.000001);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
test('Ray copy', () => {
|
|
168
|
-
const origin = new Vector3D(1, 2, 3);
|
|
169
|
-
const direction = new Vector3D(4, 5, 6);
|
|
170
|
-
const ray1 = new Ray(origin, direction);
|
|
171
|
-
const ray2 = new Ray(new Vector3D(), new Vector3D()).copy(ray1);
|
|
172
|
-
|
|
173
|
-
expect(ray2.origin.equals(origin)).toBe(true);
|
|
174
|
-
expect(ray2.direction.equals(direction)).toBe(true);
|
|
175
|
-
});
|
|
176
|
-
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Vector3D } from '../../Math/vector3d';
|
|
2
|
-
import { Quaternion } from '../../Math/quaternion';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const toRadians = (degrees: number) => degrees * (Math.PI / 180);
|
|
6
|
-
const toDegrees = (radians: number) => radians * (180 / Math.PI);
|
|
7
|
-
|
|
8
|
-
let _0vector: Vector3D;
|
|
9
|
-
let _1vector: Vector3D;
|
|
10
|
-
let _0quaternion: Quaternion;
|
|
11
|
-
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
_0vector = new Vector3D(0, 0, 0);
|
|
14
|
-
_1vector = new Vector3D(1, 1, 1);
|
|
15
|
-
_0quaternion = new Quaternion(0, 0, 0, 1);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
test('add', () => {
|
|
20
|
-
expect(_0vector.add(_1vector).equals(new Vector3D(1, 1, 1))).toBe(true);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
test('setFromLonLat - toLonLat 2', () => {
|
|
25
|
-
expect(_0vector.setFromLonLat(0, 0).toLonLat()).toEqual({ lon: 0, lat: 0 });
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
test(' applyQuaternion ', () => {
|
|
30
|
-
|
|
31
|
-
_0quaternion.setFromAxisAngle(new Vector3D(0, 0, 1), Math.PI / 2);
|
|
32
|
-
_0vector.setFromLonLat(toRadians(10), 0);
|
|
33
|
-
_0vector.applyQuaternion(_0quaternion);
|
|
34
|
-
const result = _0vector.toLonLat();
|
|
35
|
-
expect(result).toEqual({ lon: toRadians(100), lat: 0 });
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
test('setFromLonLat - toLonLat', () => {
|
|
40
|
-
const result = _0vector.setFromLonLat(0, 0).toLonLat();
|
|
41
|
-
expect(result.lon).toBeCloseTo(0, 1e-6);
|
|
42
|
-
expect(result.lat).toBeCloseTo(0, 1e-6);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
test('scale', () => {
|
|
47
|
-
const scale = 2;
|
|
48
|
-
const result = _0vector.set(1, 2, 3).scale(scale);
|
|
49
|
-
expect(result.equals(new Vector3D(2, 4, 6))).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
test('negate', () => {
|
|
55
|
-
_0vector.set(1, -2, 3).negate();
|
|
56
|
-
expect(_0vector.equals(new Vector3D(-1, 2, -3))).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
test('cross same and negated', () => {
|
|
62
|
-
|
|
63
|
-
const negated = _0vector.randomUnit().clone().negate();
|
|
64
|
-
const result = _0vector.clone().cross(negated);
|
|
65
|
-
const resul2 = _0vector.clone().cross(_0vector);
|
|
66
|
-
|
|
67
|
-
expect(result.equals(new Vector3D(0, 0, 0))).toBe(true);
|
|
68
|
-
expect(resul2.equals(new Vector3D(0, 0, 0))).toBe(true);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// console.log
|
|
73
|
-
// A Vector3D { x: 0.6389419688270773, y: -0.7692549385420794, z: 0 } B Vector3D { x: -0.6389419688270773, y: 0.7692549385420794, z: 0 } this.A Vector3D {
|
|
74
|
-
// x: -0.6002207824512262,
|
|
75
|
-
// y: -0.4133184680372552,
|
|
76
|
-
// z: 0.6847648182354102
|
|
77
|
-
// }
|
|
78
|
-
|
|
79
|
-
// at Arc.intersectionMedium(src / webglobeplugins / Math / arc.ts: 111: 17)
|
|
80
|
-
|
|
81
|
-
// console.log
|
|
82
|
-
// y < this._dot - 0.0655589757420102 0.0655589757420102 0.8489202601389976
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
test('negated dot', () => {
|
|
86
|
-
const A = _0vector.randomUnit().clone();
|
|
87
|
-
const B = _0vector.randomUnit();
|
|
88
|
-
|
|
89
|
-
const result = A.dot(B);
|
|
90
|
-
const result2 = A.dot(B.negate());
|
|
91
|
-
expect(result).toBe(-result2);
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
test('cross', () => {
|
|
99
|
-
const A = _0vector.randomUnit().clone();
|
|
100
|
-
const B = _0vector.randomUnit();
|
|
101
|
-
const result = A.cross(B);
|
|
102
|
-
expect(result.equals(new Vector3D(0, 0, 0))).toBe(false);
|
|
103
|
-
expect(result.length()).toBeCloseTo(A.length() * B.length() * Math.sin(A.angle(B)), 1e-6);
|
|
104
|
-
});
|
|
File without changes
|