@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/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function bearingRealAngle(long, lat, endLong, endLat) {
|
|
2
|
-
const rLong = Radians * long;
|
|
3
|
-
const rLat = Radians * lat;
|
|
4
|
-
const rEndLong = Radians * endLong;
|
|
5
|
-
const rEndLat = Radians * endLat;
|
|
6
|
-
const delta_long = rEndLong - rLong;
|
|
7
|
-
const x = Math.sin(delta_long) * Math.cos(rEndLat);
|
|
8
|
-
const y = Math.cos(rLat) * Math.sin(rEndLat) - Math.sin(rLat) * Math.cos(rEndLat) * Math.cos(delta_long);
|
|
9
|
-
let initialBearing = Math.atan2(x, y) / Radians;
|
|
10
|
-
initialBearing = (initialBearing + 360) % 360;
|
|
11
|
-
return initialBearing;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { bearingRealAngle };
|
package/Math/arc.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Vec3, Plane, Arc } from "./types";
|
|
2
|
-
|
|
3
|
-
import { vec3 } from "./vec3";
|
|
4
|
-
import { EPSILON } from "./constants";
|
|
5
|
-
|
|
6
|
-
const _0vector = /*@__PURE__*/ vec3.create(0, 0, 0);
|
|
7
|
-
const _1vector = /*@__PURE__*/ vec3.create(1, 1, 1);
|
|
8
|
-
|
|
9
|
-
export const arc = Object.freeze({
|
|
10
|
-
create(p0: Vec3, p1: Vec3): Arc {
|
|
11
|
-
const normal = vec3.create(0, 0, 0);
|
|
12
|
-
vec3.cross(normal, p0, p1);
|
|
13
|
-
const coverPlaneNormal = [p0[0] + p1[0], p0[1] + p1[1], p0[2] + p1[2]] as Vec3;
|
|
14
|
-
vec3.normalize(coverPlaneNormal, coverPlaneNormal);
|
|
15
|
-
const dot = vec3.dot(coverPlaneNormal, p0);
|
|
16
|
-
return {
|
|
17
|
-
p0: vec3.clone(p0),
|
|
18
|
-
p1: vec3.clone(p1),
|
|
19
|
-
normal: vec3.clone(normal),
|
|
20
|
-
coverPlane: {
|
|
21
|
-
normal: coverPlaneNormal,
|
|
22
|
-
distance: dot
|
|
23
|
-
} as Plane
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
set(out: Arc, p0: Vec3, p1: Vec3) {
|
|
28
|
-
vec3.copy(out.p0, p0);
|
|
29
|
-
vec3.copy(out.p1, p1);
|
|
30
|
-
vec3.cross(out.normal, p0, p1);
|
|
31
|
-
const coverPlaneNormal = [p0[0] + p1[0], p0[1] + p1[1], p0[2] + p1[2]] as Vec3;
|
|
32
|
-
vec3.normalize(coverPlaneNormal, coverPlaneNormal);
|
|
33
|
-
out.coverPlane.normal = coverPlaneNormal;
|
|
34
|
-
out.coverPlane.distance = vec3.dot(coverPlaneNormal, p0);
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
copy(out: Arc, a: Arc) {
|
|
39
|
-
vec3.copy(out.p0, a.p0);
|
|
40
|
-
vec3.copy(out.p1, a.p1);
|
|
41
|
-
vec3.copy(out.normal, a.normal);
|
|
42
|
-
out.coverPlane.normal = vec3.clone(a.coverPlane.normal);
|
|
43
|
-
out.coverPlane.distance = a.coverPlane.distance;
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
clone(a: Arc): Arc {
|
|
47
|
-
return {
|
|
48
|
-
p0: vec3.clone(a.p0),
|
|
49
|
-
p1: vec3.clone(a.p1),
|
|
50
|
-
normal: vec3.clone(a.normal),
|
|
51
|
-
coverPlane: {
|
|
52
|
-
normal: vec3.clone(a.coverPlane.normal),
|
|
53
|
-
distance: a.coverPlane.distance
|
|
54
|
-
} as Plane
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
isPointOn(arc: Arc, point: Vec3): boolean {
|
|
61
|
-
const alignment = Math.abs(vec3.dot(point, arc.normal)) < EPSILON;
|
|
62
|
-
const distance = Math.abs(vec3.lengthSquared(point) - 1) < EPSILON;
|
|
63
|
-
const cover = vec3.dot(arc.coverPlane.normal, point) >= arc.coverPlane.distance;
|
|
64
|
-
return alignment || distance || cover;
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
equals(a: Arc, b: Arc): boolean {
|
|
69
|
-
return vec3.equals(a.p0, b.p0) && vec3.equals(a.p1, b.p1)
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
populatePoints(out: Float32Array, arc: Arc, count: number) {
|
|
73
|
-
// rotate p0 around normal vector with a quaternion
|
|
74
|
-
// calculate angle
|
|
75
|
-
}
|
|
76
|
-
});
|
package/Math/bounds/line-bbox.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
function isClose(a, b, rtol = 1e-5, atol = 1e-8) {
|
|
2
|
-
// JavaScript equivalent of NumPy's isclose
|
|
3
|
-
return Math.abs(a - b) <= (atol + rtol * Math.abs(b));
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
function mod(n, m) {
|
|
7
|
-
// Proper modulo operation that handles negative numbers
|
|
8
|
-
return ((n % m) + m) % m;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function calculateInitialBearing(phi1, lambda1, phi2, lambda2) {
|
|
12
|
-
// Calculates the initial bearing (forward azimuth) from point 1 to point 2
|
|
13
|
-
if (isClose(Math.cos(phi1), 0)) { // Starting from a pole
|
|
14
|
-
if (phi1 > 0) { // North pole
|
|
15
|
-
return Math.PI; // Bearing is South
|
|
16
|
-
} else { // South pole
|
|
17
|
-
return 0; // Bearing is North
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const deltaLambda = lambda2 - lambda1;
|
|
22
|
-
const y = Math.sin(deltaLambda) * Math.cos(phi2);
|
|
23
|
-
const x = Math.cos(phi1) * Math.sin(phi2) - Math.sin(phi1) * Math.cos(phi2) * Math.cos(deltaLambda);
|
|
24
|
-
const theta = Math.atan2(y, x);
|
|
25
|
-
return theta;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function getGreatCircleArcBBox(phi1Rad, lambda1Rad, phi2Rad, lambda2Rad) {
|
|
29
|
-
// Calculates the bounding box around the great circle arc between two points
|
|
30
|
-
// on a spherical surface, handling edge cases like poles and antimeridian crossing.
|
|
31
|
-
// Args: Latitudes and longitudes in radians
|
|
32
|
-
// Returns: [phiMin, phiMax, lambdaMin, lambdaMax] in radians
|
|
33
|
-
|
|
34
|
-
// === Edge Case: Same Points ===
|
|
35
|
-
if (isClose(phi1Rad, phi2Rad) && isClose(lambda1Rad, lambda2Rad)) {
|
|
36
|
-
return [phi1Rad, phi1Rad, lambda1Rad, lambda1Rad];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// === Edge Case: Antipodal Points ===
|
|
40
|
-
const deltaLambdaNorm = mod(lambda1Rad - lambda2Rad + Math.PI, 2 * Math.PI) - Math.PI;
|
|
41
|
-
if (isClose(phi1Rad, -phi2Rad) && isClose(Math.abs(deltaLambdaNorm), Math.PI)) {
|
|
42
|
-
// Path covers all longitudes and passes through poles
|
|
43
|
-
return [-Math.PI / 2, Math.PI / 2, -Math.PI, Math.PI];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// === Longitude Bounds ===
|
|
47
|
-
let lambda1Adj = lambda1Rad;
|
|
48
|
-
let lambda2Adj = lambda2Rad;
|
|
49
|
-
|
|
50
|
-
// Handle antimeridian crossing
|
|
51
|
-
let deltaLambda = lambda2Rad - lambda1Rad;
|
|
52
|
-
if (deltaLambda > Math.PI) {
|
|
53
|
-
deltaLambda -= 2 * Math.PI;
|
|
54
|
-
} else if (deltaLambda <= -Math.PI) {
|
|
55
|
-
deltaLambda += 2 * Math.PI;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const crossesAntimeridian = Math.abs(lambda2Rad - lambda1Rad) > Math.PI;
|
|
59
|
-
|
|
60
|
-
if (crossesAntimeridian) {
|
|
61
|
-
// Add 2*pi to the smaller longitude
|
|
62
|
-
if (lambda1Rad < lambda2Rad) {
|
|
63
|
-
lambda1Adj += 2 * Math.PI;
|
|
64
|
-
} else {
|
|
65
|
-
lambda2Adj += 2 * Math.PI;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const lambdaMin = Math.min(lambda1Adj, lambda2Adj);
|
|
70
|
-
const lambdaMax = Math.max(lambda1Adj, lambda2Adj);
|
|
71
|
-
|
|
72
|
-
// === Latitude Bounds ===
|
|
73
|
-
let phiMin = Math.min(phi1Rad, phi2Rad);
|
|
74
|
-
let phiMax = Math.max(phi1Rad, phi2Rad);
|
|
75
|
-
|
|
76
|
-
// === Vertex Check ===
|
|
77
|
-
// Check the maximum/minimum latitude reached by the great circle
|
|
78
|
-
const theta12 = calculateInitialBearing(phi1Rad, lambda1Rad, phi2Rad, lambda2Rad);
|
|
79
|
-
const theta21 = calculateInitialBearing(phi2Rad, lambda2Rad, phi1Rad, lambda1Rad);
|
|
80
|
-
|
|
81
|
-
const cosPhi1 = Math.cos(phi1Rad);
|
|
82
|
-
if (!isClose(cosPhi1, 0)) { // Starting point is not a pole
|
|
83
|
-
// Compute the absolute latitude of the vertex
|
|
84
|
-
const argAcos = Math.abs(Math.sin(theta12) * cosPhi1);
|
|
85
|
-
const phiVtxAbs = Math.acos(Math.min(Math.max(argAcos, -1.0), 1.0));
|
|
86
|
-
|
|
87
|
-
// Check if the path crosses the northern vertex
|
|
88
|
-
if (isClose(theta12, 0) && phiVtxAbs > phiMax) { // Starting due north
|
|
89
|
-
phiMax = phiVtxAbs;
|
|
90
|
-
} else if (isClose(Math.abs(theta12), Math.PI) && -phiVtxAbs < phiMin) { // Starting due south
|
|
91
|
-
phiMin = -phiVtxAbs;
|
|
92
|
-
} else {
|
|
93
|
-
// General case: Check if the path crosses the vertex
|
|
94
|
-
const finalBearingAtP2 = mod(theta21 + Math.PI + Math.PI, 2 * Math.PI) - Math.PI;
|
|
95
|
-
|
|
96
|
-
// Northern vertex check
|
|
97
|
-
if ((-Math.PI / 2 < theta12 && theta12 < Math.PI / 2) &&
|
|
98
|
-
!(finalBearingAtP2 >= -Math.PI / 2 && finalBearingAtP2 <= Math.PI / 2)) {
|
|
99
|
-
if (phiVtxAbs > phiMax) {
|
|
100
|
-
phiMax = phiVtxAbs;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Southern vertex check
|
|
105
|
-
if (!(theta12 >= -Math.PI / 2 && theta12 <= Math.PI / 2) &&
|
|
106
|
-
(-Math.PI / 2 < finalBearingAtP2 && finalBearingAtP2 < Math.PI / 2)) {
|
|
107
|
-
if (-phiVtxAbs < phiMin) {
|
|
108
|
-
phiMin = -phiVtxAbs;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return [phiMin, phiMax, lambdaMin, lambdaMax];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// --- Example Usage ---
|
|
121
|
-
function degreesToRadians(deg) {
|
|
122
|
-
return deg * Math.PI / 180;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function radiansToDegrees(rad) {
|
|
126
|
-
return rad * 180 / Math.PI;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
export { getGreatCircleArcBBox };
|
|
131
|
-
|
|
132
|
-
// Test Case 1: London to Tokyo
|
|
133
|
-
const lat1Deg = 51.5, lon1Deg = -0.1;
|
|
134
|
-
const lat2Deg = 35.7, lon2Deg = 139.7;
|
|
135
|
-
|
|
136
|
-
const phi1 = degreesToRadians(lat1Deg);
|
|
137
|
-
const lambda1 = degreesToRadians(lon1Deg);
|
|
138
|
-
const phi2 = degreesToRadians(lat2Deg);
|
|
139
|
-
const lambda2 = degreesToRadians(lon2Deg);
|
|
140
|
-
|
|
141
|
-
const [phiMinRad, phiMaxRad, lambdaMinRad, lambdaMaxRad] = getGreatCircleArcBBox(phi1, lambda1, phi2, lambda2);
|
|
142
|
-
|
|
143
|
-
const phiMinDeg = radiansToDegrees(phiMinRad);
|
|
144
|
-
const phiMaxDeg = radiansToDegrees(phiMaxRad);
|
|
145
|
-
const lambdaMinDeg = radiansToDegrees(lambdaMinRad);
|
|
146
|
-
const lambdaMaxDeg = radiansToDegrees(lambdaMaxRad);
|
|
147
|
-
|
|
148
|
-
console.log("Input Points (Radians):");
|
|
149
|
-
console.log(` P1: Latitude=${lat1Deg}, Longitude=${lon1Deg}`);
|
|
150
|
-
console.log(` P2: Latitude=${lat2Deg}, Longitude=${lon2Deg}`);
|
|
151
|
-
console.log(` P1: Latitude=${phi1.toFixed(4)}, Longitude=${lambda1.toFixed(4)}`);
|
|
152
|
-
console.log(` P2: Latitude=${phi2.toFixed(4)}, Longitude=${lambda2.toFixed(4)}`);
|
|
153
|
-
console.log("-".repeat(20));
|
|
154
|
-
console.log("Bounding Box (Radians):");
|
|
155
|
-
// console phys://console.log(` Minimum Latitude (phi_min): ${phiMinRad.toFixed(4)}`);
|
|
156
|
-
console.log(` Maximum Latitude (phi_max): ${phiMaxRad.toFixed(4)}`);
|
|
157
|
-
console.log(` Minimum Longitude (lambda_min): ${lambdaMinRad.toFixed(4)}`);
|
|
158
|
-
console.log(` Maximum Longitude (lambda_max): ${lambdaMaxRad.toFixed(4)}`);
|
|
159
|
-
console.log("-".repeat(20));
|
|
160
|
-
console.log("Bounding Box (Degrees):");
|
|
161
|
-
console.log(` Minimum Latitude: ${phiMinDeg.toFixed(2)}°`);
|
|
162
|
-
console.log(` Maximum Latitude: ${phiMaxDeg.toFixed(2)}°`);
|
|
163
|
-
console.log(` Minimum Longitude: ${lambdaMinDeg.toFixed(2)}°`);
|
|
164
|
-
console.log(` Maximum Longitude: ${lambdaMaxDeg.toFixed(2)}°`);
|
|
165
|
-
|
|
166
|
-
// --- Antimeridian Crossing Test ---
|
|
167
|
-
console.log("\n" + "=".repeat(30));
|
|
168
|
-
console.log("Antimeridian Crossing Test");
|
|
169
|
-
const lat1DegAm = -18, lon1DegAm = 178;
|
|
170
|
-
const lat2DegAm = -14, lon2DegAm = -172;
|
|
171
|
-
|
|
172
|
-
const phi1Am = degreesToRadians(lat1DegAm);
|
|
173
|
-
const lambda1Am = degreesToRadians(lon1DegAm);
|
|
174
|
-
const phi2Am = degreesToRadians(lat2DegAm);
|
|
175
|
-
const lambda2Am = degreesToRadians(lon2DegAm);
|
|
176
|
-
|
|
177
|
-
const [phiMinRadAm, phiMaxRadAm, lambdaMinRadAm, lambdaMaxRadAm] = getGreatCircleArcBBox(phi1Am, lambda1Am, phi2Am, lambda2Am);
|
|
178
|
-
|
|
179
|
-
const phiMinDegAm = radiansToDegrees(phiMinRadAm);
|
|
180
|
-
const phiMaxDegAm = radiansToDegrees(phiMaxRadAm);
|
|
181
|
-
const lambdaMinDegAm = radiansToDegrees(lambdaMinRadAm);
|
|
182
|
-
const lambdaMaxDegAm = radiansToDegrees(lambdaMaxRadAm);
|
|
183
|
-
|
|
184
|
-
console.log(`Input Points (Degrees): P1=(${lat1DegAm}, ${lon1DegAm}), P2=(${lat2DegAm}, ${lon2DegAm})`);
|
|
185
|
-
console.log("Bounding Box (Radians):");
|
|
186
|
-
console.log(` phi_min=${phiMinRadAm.toFixed(4)}, phi_max=${phiMaxRadAm.toFixed(4)}`);
|
|
187
|
-
console.log(` lambda_min=${lambdaMinRadAm.toFixed(4)}, lambda_max=${lambdaMaxRadAm.toFixed(4)}`);
|
|
188
|
-
console.log("Bounding Box (Degrees):");
|
|
189
|
-
console.log(` Min Latitude: ${phiMinDegAm.toFixed(2)}°`);
|
|
190
|
-
console.log(` Max Latitude: ${phiMaxDegAm.toFixed(2)}°`);
|
|
191
|
-
console.log(` Min Longitude: ${lambdaMinDegAm.toFixed(2)}° (178° expected)`);
|
|
192
|
-
console.log(` Max Longitude: ${lambdaMaxDegAm.toFixed(2)}° (188° expected, which is -172° + 360°)`);
|
|
193
|
-
|
|
194
|
-
// --- Polar Crossing Test ---
|
|
195
|
-
console.log("\n" + "=".repeat(30));
|
|
196
|
-
console.log("Polar Crossing Test");
|
|
197
|
-
const lat1DegP = 80, lon1DegP = 20;
|
|
198
|
-
const lat2DegP = 80, lon2DegP = -100;
|
|
199
|
-
|
|
200
|
-
const phi1P = degreesToRadians(lat1DegP);
|
|
201
|
-
const lambda1P = degreesToRadians(lon1DegP);
|
|
202
|
-
const phi2P = degreesToRadians(lat2DegP);
|
|
203
|
-
const lambda2P = degreesToRadians(lon2DegP);
|
|
204
|
-
|
|
205
|
-
const [phiMinRadP, phiMaxRadP, lambdaMinRadP, lambdaMaxRadP] = getGreatCircleArcBBox(phi1P, lambda1P, phi2P, lambda2P);
|
|
206
|
-
|
|
207
|
-
const phiMinDegP = radiansToDegrees(phiMinRadP);
|
|
208
|
-
const phiMaxDegP = radiansToDegrees(phiMaxRadP);
|
|
209
|
-
const lambdaMinDegP = radiansToDegrees(lambdaMinRadP);
|
|
210
|
-
const lambdaMaxDegP = radiansToDegrees(lambdaMaxRadP);
|
|
211
|
-
|
|
212
|
-
console.log(`Input Points (Degrees): P1=(${lat1DegP}, ${lon1DegP}), P2=(${lat2DegP}, ${lon2DegP})`);
|
|
213
|
-
console.log("Bounding Box (Radians):");
|
|
214
|
-
console.log(` phi_min=${phiMinRadP.toFixed(4)}, phi_max=${phiMaxRadP.toFixed(4)}`);
|
|
215
|
-
console.log(` lambda_min=${lambdaMinRadP.toFixed(4)}, lambda_max=${lambdaMaxRadP.toFixed(4)}`);
|
|
216
|
-
console.log("Bounding Box (Degrees):");
|
|
217
|
-
console.log(` Min Latitude: ${phiMinDegP.toFixed(2)}°`);
|
|
218
|
-
console.log(` Max Latitude: ${phiMaxDegP.toFixed(2)}° (Should be close to North Pole > 80°)`);
|
|
219
|
-
console.log(` Min Longitude: ${lambdaMinDegP.toFixed(2)}°`);
|
|
220
|
-
console.log(` Max Longitude: ${lambdaMaxDegP.toFixed(2)}°`);
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
// --- line points intersection with bbox ---
|
|
225
|
-
|
package/Math/constants.ts
DELETED
package/Math/frustum/camera.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// import { WORLD_RADIUS_3D } from '../constants';
|
|
2
|
-
// import { Plane } from '../plane';
|
|
3
|
-
// import { Vector3D } from '../vector3d';
|
|
4
|
-
// import { Quaternion } from '../quaternion';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// function cameraFrustum(
|
|
8
|
-
|
|
9
|
-
// globe: any,
|
|
10
|
-
// out: {
|
|
11
|
-
// near: Plane,
|
|
12
|
-
// far: Plane,
|
|
13
|
-
// left: Plane,
|
|
14
|
-
// right: Plane,
|
|
15
|
-
// top: Plane,
|
|
16
|
-
// bottom: Plane
|
|
17
|
-
// },
|
|
18
|
-
// fieldOfView: number = 50 // in degrees
|
|
19
|
-
|
|
20
|
-
// ): void {
|
|
21
|
-
|
|
22
|
-
// const lookinfo = globe.api_GetCurrentLookInfo();
|
|
23
|
-
|
|
24
|
-
// lookinfo.CenterLong *= Math.PI / 180; // convert degrees to radians
|
|
25
|
-
// lookinfo.CenterLat *= Math.PI / 180; // convert degrees to radians
|
|
26
|
-
|
|
27
|
-
// const lookAtPosition = Vector3D.fromLongLatRadians(lookinfo.CenterLong, lookinfo.CenterLat);
|
|
28
|
-
|
|
29
|
-
// const cameraPosition = new Vector3D(globe.Fp.x, globe.Fp.y, globe.Fp.z).divideByScaler(WORLD_RADIUS_3D);
|
|
30
|
-
|
|
31
|
-
// return
|
|
32
|
-
// }
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// import { Plane } from "../plane";
|
|
2
|
-
// import { Vector3D } from "../vector3d";
|
|
3
|
-
// import { WORLD_RADIUS_3D } from "../constants";
|
|
4
|
-
// import { Quaternion } from "../quaternion";
|
|
5
|
-
|
|
6
|
-
// import { FrustumPlanes } from "./types";
|
|
7
|
-
|
|
8
|
-
// const _quaternion = new Quaternion();
|
|
9
|
-
|
|
10
|
-
// export function getFrustum(globe: any, fieldOfView: number = 50 * Math.PI / 180,
|
|
11
|
-
// out: FrustumPlanes): void {
|
|
12
|
-
|
|
13
|
-
// const lookinfo = globe.api_GetCurrentLookInfo();
|
|
14
|
-
// lookinfo.CenterLong *= Math.PI / 180; // convert degrees to radians
|
|
15
|
-
// lookinfo.CenterLat *= Math.PI / 180; // convert degrees to radians
|
|
16
|
-
// lookinfo.NorthAng *= Math.PI / 180; // convert degrees to radians
|
|
17
|
-
|
|
18
|
-
// const lookAtPosition = Vector3D.fromLongLatRadians(lookinfo.CenterLong, lookinfo.CenterLat);
|
|
19
|
-
// const cameraPosition = new Vector3D(globe.Fp.x, globe.Fp.y, globe.Fp.z).divideByScaler(WORLD_RADIUS_3D);
|
|
20
|
-
// const lookFromCamera = lookAtPosition.clone().subtract(cameraPosition).normalize();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// const cameraZ = new Vector3D(globe.Fu.x, globe.Fu.y, globe.Fu.z);
|
|
24
|
-
// const cameraY = cameraZ.clone().cross(lookFromCamera).normalize();
|
|
25
|
-
|
|
26
|
-
// const bottomNormal = cameraZ.clone().applyQuaternion(
|
|
27
|
-
// _quaternion.setFromAxisAngle(cameraY, -fieldOfView)
|
|
28
|
-
// ).normalize();
|
|
29
|
-
|
|
30
|
-
// const topNormal = cameraZ.clone().applyQuaternion(
|
|
31
|
-
// _quaternion.setFromAxisAngle(cameraY, fieldOfView)
|
|
32
|
-
// ).negate().normalize();
|
|
33
|
-
// const leftNormal = cameraY.clone().applyQuaternion(
|
|
34
|
-
// _quaternion.setFromAxisAngle(cameraZ, fieldOfView)
|
|
35
|
-
// ).negate().normalize();
|
|
36
|
-
|
|
37
|
-
// const rightNormal = cameraY.clone().applyQuaternion(
|
|
38
|
-
// _quaternion.setFromAxisAngle(cameraZ, -fieldOfView)
|
|
39
|
-
// ).normalize();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// out.top.set(topNormal, topNormal.dot(cameraPosition));
|
|
43
|
-
// out.bottom.set(bottomNormal, bottomNormal.dot(cameraPosition));
|
|
44
|
-
// out.left.set(leftNormal, leftNormal.dot(cameraPosition));
|
|
45
|
-
// out.right.set(rightNormal, rightNormal.dot(cameraPosition));
|
|
46
|
-
// out.far.set(cameraPosition.normalize(), 0.01);
|
|
47
|
-
// out.near = null; // Near plane is not calculated in this function, set to null
|
|
48
|
-
// vectorInfo(globe, [out]);
|
|
49
|
-
|
|
50
|
-
// }
|
|
51
|
-
|
|
52
|
-
// let interval = 0;
|
|
53
|
-
|
|
54
|
-
// const vectorInfo = (globe, args: null | Array<any>) => {
|
|
55
|
-
// interval++;
|
|
56
|
-
// if (interval % 100 === 0) {
|
|
57
|
-
// console.log("Fp:", globe.Fp.x / WORLD_RADIUS_3D, globe.Fp.y / WORLD_RADIUS_3D, globe.Fp.z / WORLD_RADIUS_3D);
|
|
58
|
-
// console.log("Fu:", globe.Fu.x, globe.Fu.y, globe.Fu.z);
|
|
59
|
-
|
|
60
|
-
// if (args) console.log(...args)
|
|
61
|
-
// interval = 0;
|
|
62
|
-
// }
|
|
63
|
-
// }
|
package/Math/frustum/types.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// TODO: REMOVE
|
|
2
|
-
|
|
3
|
-
// // import { Vector3D, Quaternion, Plane, Ray, Matrix4 } from 'your-3d-math-library'; // <-- ADAPT THIS IMPORT
|
|
4
|
-
|
|
5
|
-
// import { Vector3D } from '../vector3d';
|
|
6
|
-
// import { Plane } from '../plane';
|
|
7
|
-
// import { Line } from '../line';
|
|
8
|
-
// import { Matrix4 } from '../matrix4';
|
|
9
|
-
// import { Quaternion } from '../quaternion';
|
|
10
|
-
|
|
11
|
-
// // --- Assume these static helper variables exist within your class ---
|
|
12
|
-
// const _lookFromOrigin = new Vector3D();
|
|
13
|
-
// const _cameraPosition = new Vector3D();
|
|
14
|
-
// const _finalForward = new Vector3D();
|
|
15
|
-
// const _approxUp = new Vector3D();
|
|
16
|
-
// const _finalRight = new Vector3D();
|
|
17
|
-
// const _finalUp = new Vector3D();
|
|
18
|
-
// const _tempVec = new Vector3D(); // General purpose helper
|
|
19
|
-
// const _initialBottomRayDir = new Vector3D();
|
|
20
|
-
// const _qOrient = new Quaternion();
|
|
21
|
-
// const _rollQuaternion = new Quaternion();
|
|
22
|
-
// const _rotationMatrix = new Matrix4();
|
|
23
|
-
// const _fieldOfViewBottomRay = new Line(new Vector3D(), new Vector3D());
|
|
24
|
-
// const _origin3d = new Vector3D(0, 0, 0); // Globe Center
|
|
25
|
-
|
|
26
|
-
// // --- Assume these constants exist ---
|
|
27
|
-
// const WORLD_RADIUS_3D = 6371000; // Example: Earth radius
|
|
28
|
-
// const FIELD_OF_VIEW = (25 * Math.PI) / 180; // Example: 25 degrees half-FOV in radians
|
|
29
|
-
|
|
30
|
-
// // // --- Assume Plane class has these methods ---
|
|
31
|
-
// // interface Plane {
|
|
32
|
-
// // setFromNormalAndPoint(normal: Vector3D, point: Vector3D): this;
|
|
33
|
-
// // set(normal: Vector3D, constant: number): this;
|
|
34
|
-
// // // ... other plane methods
|
|
35
|
-
// // }
|
|
36
|
-
|
|
37
|
-
// // // --- Assume Ray class has these methods ---
|
|
38
|
-
// // interface Ray {
|
|
39
|
-
// // origin: Vector3D;
|
|
40
|
-
// // direction: Vector3D;
|
|
41
|
-
// // intersectionSphere(center: Vector3D, radius: number): Vector3D[] | null; // Or similar
|
|
42
|
-
// // // ... other ray methods
|
|
43
|
-
// // }
|
|
44
|
-
|
|
45
|
-
// // // --- Assume Vector3D has setFromLongLat ---
|
|
46
|
-
// // interface Vector3D {
|
|
47
|
-
// // setFromLongLat(lon: number, lat: number): this;
|
|
48
|
-
// // // ... other vector methods
|
|
49
|
-
// // }
|
|
50
|
-
// // // --- END OF ASSUMPTIONS ---
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// /**
|
|
54
|
-
// * Calculates a culling plane representing the bottom edge of the camera's field of view.
|
|
55
|
-
// * @param globe - The globe object, expected to have api_GetCurrentLookInfo and Fp properties.
|
|
56
|
-
// * @param out - The Plane object to store the result.
|
|
57
|
-
// * @param fieldOfView - The vertical half-angle of the field of view in radians.
|
|
58
|
-
// * @returns The calculated Plane.
|
|
59
|
-
// */
|
|
60
|
-
// function calculateHorizonPlane(globe: any, out: Plane, fieldOfView: number = FIELD_OF_VIEW): Plane {
|
|
61
|
-
|
|
62
|
-
// const cameraLookInfo = globe.api_GetCurrentLookInfo();
|
|
63
|
-
// cameraLookInfo.CenterLong *= Math.PI / 180;
|
|
64
|
-
// cameraLookInfo.CenterLat *= Math.PI / 180;
|
|
65
|
-
// // cameraLookInfo.Tilt *= Math.PI / 180; // Tilt is now implicitly handled
|
|
66
|
-
// cameraLookInfo.NorthAng *= Math.PI / 180;
|
|
67
|
-
|
|
68
|
-
// // Set _lookFromOrigin based on camera target (Lon/Lat)
|
|
69
|
-
// (_lookFromOrigin as any).setFromLongLat(cameraLookInfo.CenterLong, cameraLookInfo.CenterLat); // Cast to any if setFromLongLat is custom
|
|
70
|
-
|
|
71
|
-
// // 1. Calculate _cameraPosition and _finalForward (_lookFromCamera)
|
|
72
|
-
// _cameraPosition.set(globe.Fp.x, globe.Fp.y, globe.Fp.z); // Using your X negation
|
|
73
|
-
// _cameraPosition.divideScalar(WORLD_RADIUS_3D); // Scale to unit sphere
|
|
74
|
-
|
|
75
|
-
// Vector3D.subVectors(_lookFromOrigin, _cameraPosition, _finalForward).normalize();
|
|
76
|
-
|
|
77
|
-
// // 2. Calculate Q_orient (Final Camera Orientation Quaternion)
|
|
78
|
-
|
|
79
|
-
// // Use the vector from origin to camera as an initial 'up' reference
|
|
80
|
-
// _approxUp.copy(_cameraPosition).normalize();
|
|
81
|
-
|
|
82
|
-
// // Calculate Right vector using cross product
|
|
83
|
-
// Vector3D.crossVectors(_finalForward, _approxUp, _finalRight).normalize();
|
|
84
|
-
|
|
85
|
-
// // Handle edge case: If looking straight along (or opposite to) _approxUp
|
|
86
|
-
// if (_finalRight.lengthSq() < 0.0001) {
|
|
87
|
-
// // If vectors are parallel, _approxUp is not good.
|
|
88
|
-
// // Choose a different 'up', e.g., if _approxUp is near Z, use Y.
|
|
89
|
-
// if (Math.abs(_approxUp.z) > 0.9) {
|
|
90
|
-
// _approxUp.set(0, 1, 0);
|
|
91
|
-
// } else {
|
|
92
|
-
// _approxUp.set(0, 0, 1);
|
|
93
|
-
// }
|
|
94
|
-
// Vector3D.crossVectors(_finalForward, _approxUp, _finalRight).normalize();
|
|
95
|
-
// }
|
|
96
|
-
|
|
97
|
-
// // Calculate the 'true' Up vector, orthogonal to Right and Forward
|
|
98
|
-
// Vector3D.crossVectors(_finalRight, _finalForward, _finalUp).normalize();
|
|
99
|
-
|
|
100
|
-
// // Apply NorthAng (Roll) around the Forward axis
|
|
101
|
-
// _rollQuaternion.setFromAxisAngle(_finalForward, cameraLookInfo.NorthAng);
|
|
102
|
-
// _finalUp.applyQuaternion(_rollQuaternion);
|
|
103
|
-
// _finalRight.applyQuaternion(_rollQuaternion); // Must rotate Right as well!
|
|
104
|
-
|
|
105
|
-
// // Create Q_orient from the final basis vectors (Right, Up, -Forward)
|
|
106
|
-
// // This assumes a Matrix4.makeBasis(x, y, z) exists and builds a rotation matrix.
|
|
107
|
-
// // It also assumes local camera looks down -Z, hence negating _finalForward for the Z basis.
|
|
108
|
-
// _tempVec.copy(_finalForward).negate();
|
|
109
|
-
// _rotationMatrix.makeBasis(_finalRight, _finalUp, _tempVec); // <-- ADAPT: Ensure your library has makeBasis or equivalent
|
|
110
|
-
// _qOrient.setFromRotationMatrix(_rotationMatrix); // <-- ADAPT: Ensure this function exists
|
|
111
|
-
|
|
112
|
-
// // 3. Calculate Initial Bottom Ray (Local: -Z forward, Y up, X right)
|
|
113
|
-
// // Rotates (0, 0, -1) around (1, 0, 0) by fieldOfView
|
|
114
|
-
// _initialBottomRayDir.set(0, -Math.sin(fieldOfView), -Math.cos(fieldOfView));
|
|
115
|
-
|
|
116
|
-
// // 4. Calculate Final Bottom Ray (World)
|
|
117
|
-
// _fieldOfViewBottomRay.direction.copy(_initialBottomRayDir).applyQuaternion(_qOrient).normalize();
|
|
118
|
-
// _fieldOfViewBottomRay.origin.copy(_cameraPosition);
|
|
119
|
-
|
|
120
|
-
// // 5. Intersection and Plane
|
|
121
|
-
// const intersection = (_fieldOfViewBottomRay as any).intersectionSphere(_origin3d, 1); // Cast to any if method isn't standard
|
|
122
|
-
|
|
123
|
-
// if (intersection && intersection.length > 0) {
|
|
124
|
-
// // If ray intersects, use the closest point for the plane
|
|
125
|
-
// out.setFromNormalAndPoint(_lookFromOrigin, intersection[0]);
|
|
126
|
-
// } else {
|
|
127
|
-
// // If ray does not intersect (FOV covers globe or misses)
|
|
128
|
-
// // WARNING: This sets a plane through the globe's center.
|
|
129
|
-
// // This might not be the desired behavior for culling.
|
|
130
|
-
// // Consider what should happen if the whole globe *is* visible.
|
|
131
|
-
// out.set(_lookFromOrigin, 0.0);
|
|
132
|
-
// }
|
|
133
|
-
|
|
134
|
-
// return out;
|
|
135
|
-
// }
|
|
136
|
-
|
|
137
|
-
// export { calculateHorizonPlane };
|
package/Math/index.js
DELETED
|
File without changes
|