@pirireis/webglobeplugins 0.9.6 → 0.9.7
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/package.json +5 -2
- package/Math/angle-calculation.js +0 -14
- package/Math/arc.ts +0 -76
- package/Math/bounds/line-bbox.js +0 -225
- package/Math/constants.ts +0 -11
- package/Math/frustum/camera.ts +0 -32
- package/Math/frustum/from-globeinfo.ts +0 -63
- package/Math/frustum/types.ts +0 -11
- package/Math/globe-util/horizon-plane.ts +0 -137
- package/Math/index.js +0 -0
- package/Math/juction/arc-plane.ts +0 -114
- package/Math/juction/line-sphere.ts +0 -30
- package/Math/juction/plane-plane.ts +0 -66
- package/Math/line.ts +0 -70
- package/Math/matrix4.ts +0 -0
- package/Math/methods.js +0 -237
- package/Math/plane.ts +0 -86
- package/Math/quaternion.ts +0 -120
- package/Math/roadmap.md +0 -10
- package/Math/types.ts +0 -45
- package/Math/utils.js +0 -3
- package/Math/vec3.ts +0 -155
- package/algorithms/search-binary.js +0 -14
- package/altitude-locator/adaptors.js +0 -0
- package/altitude-locator/draw-subset-obj.js +0 -27
- package/altitude-locator/keymethod.js +0 -0
- package/altitude-locator/plugin.js +0 -439
- package/altitude-locator/types.js +0 -26
- package/arrowfield/adaptor.js +0 -11
- package/arrowfield/index.js +0 -3
- package/arrowfield/plugin.js +0 -128
- package/bearing-line/index.js +0 -2
- package/bearing-line/plugin.js +0 -512
- package/circle-line-chain/chain-list-map.js +0 -221
- package/circle-line-chain/init.js +0 -0
- package/circle-line-chain/plugin.js +0 -469
- package/circle-line-chain/readme.md +0 -57
- package/circle-line-chain/util.js +0 -1
- package/compass-rose/compass-rose-padding-flat.js +0 -266
- package/compass-rose/compass-text-writer.js +0 -173
- package/compass-rose/index.js +0 -3
- package/compassrose/compassrose.js +0 -341
- package/compassrose/index.js +0 -2
- package/depth-locator/readme.md +0 -26
- package/globe-types.ts +0 -13
- package/heatwave/index.js +0 -4
- package/heatwave/isobar/objectarraylabels.js +0 -247
- package/heatwave/isobar/plugin.js +0 -340
- package/heatwave/isobar/quadtreecontours.js +0 -336
- package/heatwave/plugins/heatwaveglobeshell.js +0 -258
- package/jest.config.js +0 -6
- package/partialrings/buffer-manager.js +0 -89
- package/partialrings/goals.md +0 -17
- package/partialrings/index.js +0 -3
- package/partialrings/plugin.js +0 -160
- package/partialrings/program.js +0 -324
- package/pin/pin-object-array.js +0 -381
- package/pin/pin-point-totem.js +0 -77
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
- package/point-heat-map/index.js +0 -0
- package/point-heat-map/plugin-webworker.js +0 -151
- package/point-heat-map/point-to-heat-map-flow.js +0 -150
- package/point-heat-map/readme.md +0 -15
- package/point-tracks/key-methods.js +0 -3
- package/point-tracks/plugin.js +0 -394
- package/programs/arrowfield/index.js +0 -2
- package/programs/arrowfield/logic.js +0 -286
- package/programs/arrowfield/object.js +0 -89
- package/programs/data2legend/density-to-legend.js +0 -115
- package/programs/data2legend/point-to-density-texture.js +0 -114
- package/programs/float2legendwithratio/index.js +0 -3
- package/programs/float2legendwithratio/logic.js +0 -194
- package/programs/float2legendwithratio/object.js +0 -141
- package/programs/globe-util/is-globe-moved.js +0 -27
- package/programs/globeshell/index.js +0 -2
- package/programs/globeshell/noise/noises.js +0 -0
- package/programs/globeshell/wiggle/index.js +0 -6
- package/programs/globeshell/wiggle/logic.js +0 -371
- package/programs/globeshell/wiggle/object.js +0 -93
- package/programs/helpers/blender/index.js +0 -0
- package/programs/helpers/blender/program.js +0 -91
- package/programs/helpers/fadeaway/index.js +0 -3
- package/programs/helpers/fadeaway/logic.js +0 -76
- package/programs/helpers/fadeaway/object.js +0 -20
- package/programs/helpers/index.js +0 -2
- package/programs/index.js +0 -21
- package/programs/interface.ts +0 -7
- package/programs/line-on-globe/angled-line.js +0 -206
- package/programs/line-on-globe/circle-accurate-3d.js +0 -167
- package/programs/line-on-globe/circle-accurate-flat.js +0 -262
- package/programs/line-on-globe/circle-accurate.js +0 -202
- package/programs/line-on-globe/circle.js +0 -191
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
- package/programs/line-on-globe/index.js +0 -0
- package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
- package/programs/line-on-globe/linestrip.ts +0 -228
- package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
- package/programs/line-on-globe/to-the-surface.js +0 -129
- package/programs/line-on-globe/util.js +0 -8
- package/programs/picking/pickable-renderer.js +0 -216
- package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
- package/programs/point-on-globe/element-point-glow.js +0 -184
- package/programs/point-on-globe/square-pixel-point.js +0 -189
- package/programs/programcache.ts +0 -131
- package/programs/rings/distancering/circleflatprogram.js +0 -136
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
- package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
- package/programs/rings/distancering/index.js +0 -5
- package/programs/rings/distancering/paddyflatprogram.js +0 -146
- package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
- package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
- package/programs/rings/distancering/shader.js +0 -0
- package/programs/rings/index.js +0 -1
- package/programs/rings/partial-ring/piece-of-pie.js +0 -315
- package/programs/totems/camerauniformblock.d.ts +0 -48
- package/programs/totems/camerauniformblock.js +0 -197
- package/programs/totems/canvas-webglobe-info.js +0 -136
- package/programs/totems/gpu-selection-uniform-block.js +0 -132
- package/programs/totems/index.ts +0 -2
- package/programs/two-d/pixel-circle.js +0 -0
- package/programs/two-d/pixel-padding-for-compass.js +0 -174
- package/programs/util.js +0 -20
- package/programs/vectorfields/index.js +0 -3
- package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
- package/programs/vectorfields/logics/index.js +0 -5
- package/programs/vectorfields/logics/pixelbased.js +0 -161
- package/programs/vectorfields/logics/ubo.js +0 -64
- package/programs/vectorfields/pingpongbuffermanager.js +0 -80
- package/publish.bat +0 -60
- package/rangerings/enum.js +0 -3
- package/rangerings/index.js +0 -5
- package/rangerings/plugin.js +0 -649
- package/rangerings/rangeringangletext.js +0 -368
- package/rangerings/ring-account.js +0 -129
- package/shaders/fragment-toy/firework.js +0 -55
- package/shaders/fragment-toy/singularity.js +0 -59
- package/shape-on-terrain/arc/naive/plugin.ts +0 -304
- package/shape-on-terrain/goal.md +0 -12
- package/tests/Math/junction/arc-plane.test.ts +0 -133
- package/tests/Math/junction/plane-plane.test.ts +0 -82
- package/tests/Math/plane.test.ts +0 -43
- package/tests/Math/vec3.test.ts +0 -14
- package/timetracks/adaptors-line-strip.js +0 -80
- package/timetracks/adaptors.js +0 -133
- package/timetracks/index.js +0 -6
- package/timetracks/plugin-line-strip.js +0 -295
- package/timetracks/plugin.js +0 -304
- package/timetracks/program-line-strip.js +0 -688
- package/timetracks/program.js +0 -850
- package/timetracks/programpoint-line-strip.js +0 -175
- package/timetracks/programpoint.js +0 -168
- package/timetracks/readme.md +0 -1
- package/tsconfig.json +0 -22
- package/types.ts +0 -17
- package/util/account/bufferoffsetmanager.js +0 -209
- package/util/account/index.js +0 -6
- package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
- package/util/account/single-attribute-buffer-management/index.ts +0 -13
- package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
- package/util/account/single-attribute-buffer-management/types.ts +0 -39
- package/util/account/util.js +0 -22
- package/util/algorithms/index.js +0 -0
- package/util/algorithms/search-binary.js +0 -26
- package/util/check/get.js +0 -13
- package/util/check/index.js +0 -0
- package/util/check/typecheck.js +0 -39
- package/util/geometry/index.js +0 -53
- package/util/gl-util/buffer/attribute-loader.ts +0 -85
- package/util/gl-util/buffer/index.ts +0 -6
- package/util/gl-util/buffer/types.ts +0 -13
- package/util/gl-util/draw-options/methods.ts +0 -66
- package/util/gl-util/draw-options/types.ts +0 -28
- package/util/gl-util/uniform-block/manager.ts +0 -187
- package/util/gl-util/uniform-block/roadmap.md +0 -70
- package/util/gl-util/uniform-block/shader.js +0 -0
- package/util/gl-util/uniform-block/types.ts +0 -27
- package/util/heatwavedatamanager/datamanager.js +0 -168
- package/util/heatwavedatamanager/index.js +0 -3
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
- package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
- package/util/index.js +0 -13
- package/util/interpolation/index.js +0 -0
- package/util/interpolation/timetrack/index.js +0 -9
- package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
- package/util/interpolation/timetrack/web-worker-str.js +0 -180
- package/util/interpolation/timetrack/web-worker.js +0 -51
- package/util/jshelpers/data-filler.js +0 -19
- package/util/jshelpers/equality.js +0 -17
- package/util/jshelpers/index.js +0 -1
- package/util/jshelpers/timefilters.js +0 -32
- package/util/picking/fence.js +0 -46
- package/util/picking/picker-displayer.js +0 -177
- package/util/programs/draw-texture-on-canvas.js +0 -102
- package/util/programs/index.js +0 -1
- package/util/programs/shapesonglobe.js +0 -246
- package/util/programs/supersampletotextures.js +0 -142
- package/util/programs/texturetoglobe.js +0 -203
- package/util/shaderfunctions/geometrytransformations.ts +0 -388
- package/util/shaderfunctions/index.js +0 -2
- package/util/shaderfunctions/nodata.js +0 -10
- package/util/shaderfunctions/noisefunctions.js +0 -44
- package/util/surface-line-data/arc-bboxes.ts +0 -42
- package/util/surface-line-data/arcs-to-cuts.js +0 -74
- package/util/surface-line-data/cut-arc.js +0 -0
- package/util/surface-line-data/flow.ts +0 -52
- package/util/surface-line-data/rbush-manager.js +0 -0
- package/util/surface-line-data/types.ts +0 -27
- package/util/surface-line-data/web-worker.js +0 -0
- package/util/webglobe/gldefaultstates.js +0 -5
- package/util/webglobe/index.js +0 -2
- package/util/webglobe/rasteroverlay.js +0 -96
- package/util/webglobjectbuilders.ts +0 -456
- package/util/webglobjectbuilders1.js +0 -271
- package/waveparticles/adaptor.js +0 -16
- package/waveparticles/index.js +0 -3
- package/waveparticles/plugin.js +0 -313
- package/wind/imagetovectorfieldandmagnitude.js +0 -39
- package/wind/index.js +0 -5
- package/wind/plugin.js +0 -1057
- package/wind/vectorfieldimage.js +0 -27
- package/write-text/attached-text-writer.js +0 -105
- package/write-text/context-text.js +0 -125
- package/write-text/context-text3.js +0 -178
- package/write-text/index.js +0 -1
- package/write-text/writer-plugin.js +0 -7
package/Math/quaternion.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { Vec3, Quaternion } from './types';
|
|
2
|
-
import { vec3 } from './vec3';
|
|
3
|
-
import { EPSILON } from './constants';
|
|
4
|
-
|
|
5
|
-
export const quaternion = Object.freeze({
|
|
6
|
-
create(x = 0, y = 0, z = 0, w = 1): Quaternion {
|
|
7
|
-
return [x, y, z, w];
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
set(out: Quaternion, x: number, y: number, z: number, w: number) {
|
|
11
|
-
out[0] = x;
|
|
12
|
-
out[1] = y;
|
|
13
|
-
out[2] = z;
|
|
14
|
-
out[3] = w;
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
copy(out: Quaternion, a: Quaternion) {
|
|
18
|
-
out[0] = a[0];
|
|
19
|
-
out[1] = a[1];
|
|
20
|
-
out[2] = a[2];
|
|
21
|
-
out[3] = a[3];
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
clone(a: Quaternion): Quaternion {
|
|
25
|
-
return [a[0], a[1], a[2], a[3]];
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
multiply(out: Quaternion, a: Quaternion, b: Quaternion): Quaternion {
|
|
30
|
-
const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
|
|
31
|
-
const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
|
|
32
|
-
const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
|
|
33
|
-
const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
|
|
34
|
-
this.set(out, x, y, z, w);
|
|
35
|
-
return out;
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
randomUnit(out: Quaternion): Quaternion {
|
|
39
|
-
const u1 = Math.random();
|
|
40
|
-
const u2 = Math.random();
|
|
41
|
-
const u3 = Math.random();
|
|
42
|
-
const sqrt1MinusU1 = Math.sqrt(1 - u1);
|
|
43
|
-
const sqrtU1 = Math.sqrt(u1);
|
|
44
|
-
const x = sqrt1MinusU1 * Math.sin(2 * Math.PI * u2);
|
|
45
|
-
const y = sqrt1MinusU1 * Math.cos(2 * Math.PI * u2);
|
|
46
|
-
const z = sqrtU1 * Math.sin(2 * Math.PI * u3);
|
|
47
|
-
const w = sqrtU1 * Math.cos(2 * Math.PI * u3);
|
|
48
|
-
this.set(out, x, y, z, w);
|
|
49
|
-
this.normalize(out, out);
|
|
50
|
-
return out;
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
rotateQuaternion(out: Quaternion, a: Quaternion, b: Quaternion) {
|
|
54
|
-
const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
|
|
55
|
-
const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
|
|
56
|
-
const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
|
|
57
|
-
const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
|
|
58
|
-
this.set(out, x, y, z, w);
|
|
59
|
-
this.normalize(out, out);
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
lengthSquared(a: Quaternion): number {
|
|
63
|
-
return a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
length(a: Quaternion): number {
|
|
67
|
-
return Math.sqrt(this.lengthSquared(a));
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
normalize(out: Quaternion, input: Quaternion) {
|
|
71
|
-
const len = Math.sqrt(this.lengthSquared(input));
|
|
72
|
-
if (len < EPSILON) {
|
|
73
|
-
this.set(out, 0, 0, 0, 1);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
const invLen = 1 / len;
|
|
77
|
-
this.set(out, input[0] * invLen, input[1] * invLen, input[2] * invLen, input[3] * invLen);
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
fromUnitVectors(out: Quaternion, from: Vec3, to: Vec3) {
|
|
82
|
-
|
|
83
|
-
const d = vec3.dot(from, to) + 1;
|
|
84
|
-
if (d < EPSILON) {
|
|
85
|
-
if (Math.abs(from[0]) > Math.abs(from[2])) {
|
|
86
|
-
this.set(out, -from[1], from[0], 0, 0);
|
|
87
|
-
} else {
|
|
88
|
-
this.set(out, 0, -from[2], from[1], 0);
|
|
89
|
-
}
|
|
90
|
-
} else {
|
|
91
|
-
const x = from[1] * to[2] - from[2] * to[1];
|
|
92
|
-
const y = from[2] * to[0] - from[0] * to[2];
|
|
93
|
-
const z = from[0] * to[1] - from[1] * to[0];
|
|
94
|
-
this.set(out, x, y, z, d);
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
fromTwoQuaternions(out: Quaternion, from: Quaternion, to: Quaternion) {
|
|
100
|
-
const x = from[0] * to[3] + from[3] * to[0] + from[1] * to[2] - from[2] * to[1];
|
|
101
|
-
const y = from[1] * to[3] + from[3] * to[1] + from[2] * to[0] - from[0] * to[2];
|
|
102
|
-
const z = from[2] * to[3] + from[3] * to[2] + from[0] * to[1] - from[1] * to[0];
|
|
103
|
-
const w = from[3] * to[3] - from[0] * to[0] - from[1] * to[1] - from[2] * to[2];
|
|
104
|
-
this.set(out, x, y, z, w);
|
|
105
|
-
this.normalize(out, out);
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
conjugate(out: Quaternion, a: Quaternion) {
|
|
109
|
-
this.set(out, -a[0], -a[1], -a[2], a[3]);
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
fromAxisAngle(out: Quaternion, axis: Vec3, angle: number) {
|
|
113
|
-
const halfAngle = angle / 2;
|
|
114
|
-
const s = Math.sin(halfAngle);
|
|
115
|
-
this.set(out, axis[0] * s, axis[1] * s, axis[2] * s, Math.cos(halfAngle));
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
|
package/Math/roadmap.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
There is an arc on a unit sphere. The sphere center is at the origin. The arc is represented with start and points.
|
|
3
|
-
|
|
4
|
-
And there is a plane the intersects with the same sphere. Represented with vector and distance from origin.
|
|
5
|
-
|
|
6
|
-
I want to know the relative position of points to the plane. If they are at the same direction with the plane vector or not.
|
|
7
|
-
|
|
8
|
-
If two points are on the same side of the plane. If so, do they closer to origin then plane or not.
|
|
9
|
-
|
|
10
|
-
If two points are on different side of the plane, I want to know the intersection point of arc and plane.
|
package/Math/types.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
type Radians = number;
|
|
2
|
-
type Degrees = number;
|
|
3
|
-
type Meter = number;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type Vec3 = [number, number, number];
|
|
7
|
-
|
|
8
|
-
type Line = {
|
|
9
|
-
origin: Vec3;
|
|
10
|
-
direction: Vec3;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type Plane = {
|
|
14
|
-
normal: Vec3;
|
|
15
|
-
distance: number;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
type LongLat = [number, number]; // [longitude, latitude]
|
|
19
|
-
|
|
20
|
-
type Quaternion = [number, number, number, number];
|
|
21
|
-
|
|
22
|
-
type Arc = {
|
|
23
|
-
p0: Vec3;
|
|
24
|
-
p1: Vec3;
|
|
25
|
-
normal: Vec3;
|
|
26
|
-
coverPlane: Plane;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type Sphere = {
|
|
30
|
-
center: Vec3;
|
|
31
|
-
radius: number;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
Vec3,
|
|
36
|
-
Line,
|
|
37
|
-
Plane,
|
|
38
|
-
Quaternion,
|
|
39
|
-
Arc,
|
|
40
|
-
Sphere,
|
|
41
|
-
Radians,
|
|
42
|
-
Degrees,
|
|
43
|
-
Meter,
|
|
44
|
-
LongLat,
|
|
45
|
-
}
|
package/Math/utils.js
DELETED
package/Math/vec3.ts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { Vec3, LongLat, Quaternion } from './types';
|
|
2
|
-
import { EPSILON } from './constants';
|
|
3
|
-
|
|
4
|
-
export const vec3 = Object.freeze({
|
|
5
|
-
create(x = 0, y = 0, z = 1): Vec3 {
|
|
6
|
-
return [x, y, z];
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
set(out: Vec3, x: number, y: number, z: number) {
|
|
10
|
-
out[0] = x;
|
|
11
|
-
out[1] = y;
|
|
12
|
-
out[2] = z;
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
clone(a: Vec3): Vec3 {
|
|
16
|
-
return [a[0], a[1], a[2]];
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
copy(out: Vec3, a: Vec3): Vec3 {
|
|
20
|
-
out[0] = a[0];
|
|
21
|
-
out[1] = a[1];
|
|
22
|
-
out[2] = a[2];
|
|
23
|
-
return out;
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
add(out: Vec3, a: Vec3, b: Vec3): Vec3 {
|
|
27
|
-
out[0] = a[0] + b[0];
|
|
28
|
-
out[1] = a[1] + b[1];
|
|
29
|
-
out[2] = a[2] + b[2];
|
|
30
|
-
return out;
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
subtract(out: Vec3, a: Vec3, b: Vec3) {
|
|
34
|
-
out[0] = a[0] - b[0];
|
|
35
|
-
out[1] = a[1] - b[1];
|
|
36
|
-
out[2] = a[2] - b[2];
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
dot(a: Vec3, b: Vec3): number {
|
|
40
|
-
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
cross(out: Vec3, a: Vec3, b: Vec3) {
|
|
44
|
-
const x = a[1] * b[2] - a[2] * b[1];
|
|
45
|
-
const y = a[2] * b[0] - a[0] * b[2];
|
|
46
|
-
const z = a[0] * b[1] - a[1] * b[0];
|
|
47
|
-
out[0] = x;
|
|
48
|
-
out[1] = y;
|
|
49
|
-
out[2] = z;
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
multiplyScalar(out: Vec3, a: Vec3, b: number) {
|
|
54
|
-
out[0] = a[0] * b;
|
|
55
|
-
out[1] = a[1] * b;
|
|
56
|
-
out[2] = a[2] * b;
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
divideScalar(out: Vec3, a: Vec3, b: number) {
|
|
60
|
-
if (b === 0) {
|
|
61
|
-
throw new Error('Division by zero');
|
|
62
|
-
}
|
|
63
|
-
out[0] = a[0] / b;
|
|
64
|
-
out[1] = a[1] / b;
|
|
65
|
-
out[2] = a[2] / b;
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
lengthSquared(a: Vec3): number {
|
|
69
|
-
return a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
length(a: Vec3): number {
|
|
73
|
-
return Math.sqrt(this.lengthSquared(a));
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
normalize(outVec: Vec3, inVec: Vec3) {
|
|
77
|
-
const len = this.length(inVec);
|
|
78
|
-
if (len === 0) {
|
|
79
|
-
throw new Error('Cannot normalize a zero vector');
|
|
80
|
-
}
|
|
81
|
-
outVec[0] = inVec[0] / len;
|
|
82
|
-
outVec[1] = inVec[1] / len;
|
|
83
|
-
outVec[2] = inVec[2] / len;
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
distanceSquared(a: Vec3, b: Vec3): number {
|
|
88
|
-
const dx = a[0] - b[0];
|
|
89
|
-
const dy = a[1] - b[1];
|
|
90
|
-
const dz = a[2] - b[2];
|
|
91
|
-
return dx * dx + dy * dy + dz * dz;
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
distance(a: Vec3, b: Vec3): number {
|
|
96
|
-
return Math.sqrt(this.distanceSquared(a, b));
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
equals(a: Vec3, b: Vec3): boolean {
|
|
100
|
-
return (
|
|
101
|
-
Math.abs(a[0] - b[0]) < EPSILON &&
|
|
102
|
-
Math.abs(a[1] - b[1]) < EPSILON &&
|
|
103
|
-
Math.abs(a[2] - b[2]) < EPSILON
|
|
104
|
-
);
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
toUnitVectorLongLat(out: LongLat, a: Vec3) {
|
|
109
|
-
const len = this.length(a); // TODO Might drop length check
|
|
110
|
-
if (len === 0) {
|
|
111
|
-
throw new Error('Cannot convert a zero vector to unit vector');
|
|
112
|
-
}
|
|
113
|
-
out[0] = Math.atan2(a[1], a[0]); // Longitude
|
|
114
|
-
out[1] = Math.asin(a[2] / len); // Latitude
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
fromUnitVectorLongLat(out: Vec3, longLat: LongLat) {
|
|
118
|
-
const longitude = longLat[0];
|
|
119
|
-
const latitude = longLat[1];
|
|
120
|
-
const cosLat = Math.cos(latitude);
|
|
121
|
-
out[0] = cosLat * Math.cos(longitude);
|
|
122
|
-
out[1] = cosLat * Math.sin(longitude);
|
|
123
|
-
out[2] = Math.sin(latitude);
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
applyQuaternion(out: Vec3, a: Vec3, q: Quaternion) {
|
|
127
|
-
const x = a[0], y = a[1], z = a[2];
|
|
128
|
-
const qx = q[0], qy = q[1], qz = q[2], qw = q[3];
|
|
129
|
-
// Calculate the quaternion multiplication
|
|
130
|
-
const ix = qw * x + qy * z - qz * y;
|
|
131
|
-
const iy = qw * y + qz * x - qx * z;
|
|
132
|
-
const iz = qw * z + qx * y - qy * x;
|
|
133
|
-
const iw = -qx * x - qy * y - qz * z;
|
|
134
|
-
// Apply the quaternion to the vector
|
|
135
|
-
out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
|
|
136
|
-
out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
|
|
137
|
-
out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
randomUnit(out: Vec3) {
|
|
142
|
-
const theta = Math.random() * 2 * Math.PI;
|
|
143
|
-
const phi = Math.acos(2 * Math.random() - 1);
|
|
144
|
-
out[0] = Math.sin(phi) * Math.cos(theta);
|
|
145
|
-
out[1] = Math.sin(phi) * Math.sin(theta);
|
|
146
|
-
out[2] = Math.cos(phi);
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
str(a: Vec3): string {
|
|
151
|
-
return `Vec3(${a[0].toFixed(2)}, ${a[1].toFixed(2)}, ${a[2].toFixed(2)})`;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const findFirstIndexInRange = (container, value) => {
|
|
2
|
-
let start = 0;
|
|
3
|
-
let end = container.length - 1;
|
|
4
|
-
let mid = 0;
|
|
5
|
-
while (start <= end) {
|
|
6
|
-
mid = Math.floor((start + end) / 2);
|
|
7
|
-
if (container[mid] <= value && value <= container[mid + 1]) return mid;
|
|
8
|
-
if (container[mid] < value) start = mid + 1;
|
|
9
|
-
else end = mid - 1;
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { findFirstIndexInRange };
|
|
File without changes
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import "./types";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {DrawSubsetOptions} drawSubsetOptions
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// TODO: Draw all is an optional property for the target plugin, with this approach.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class DrawSubsetOptionRegistry {
|
|
11
|
-
constructor() {
|
|
12
|
-
this._drawSubsetOptions = new Map();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
register(key, drawSubsetOptions) {
|
|
16
|
-
this._drawSubsetOptions.set(key, drawSubsetOptions);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
unregister(key) {
|
|
20
|
-
this._drawSubsetOptions.delete(key);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
File without changes
|