@johnmorrisdotca/wakusei-planets 0.56.0 → 0.58.0
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/CHANGELOG.md +8 -0
- package/README.md +5 -3
- package/dist/element.d.ts +7 -0
- package/dist/element.js +16 -4
- package/dist/landing-sites.d.ts +120 -0
- package/dist/landing-sites.js +339 -0
- package/dist/scene/glsl.d.ts +2 -2
- package/dist/scene/glsl.js +5 -2
- package/dist/scene/name-label.d.ts +11 -1
- package/dist/scene/name-label.js +8 -5
- package/dist/scene/painter.d.ts +7 -1
- package/dist/scene/painter.js +18 -2
- package/dist/scene/place-layer.d.ts +7 -3
- package/dist/scene/place-layer.js +93 -6
- package/dist/scene/round.d.ts +43 -0
- package/dist/scene/round.js +91 -0
- package/dist/space/element.d.ts +7 -0
- package/dist/space/element.js +16 -4
- package/dist/space/scene.js +13 -4
- package/package.json +7 -1
package/dist/space/scene.js
CHANGED
|
@@ -4,6 +4,7 @@ import { createMoonDots } from "./all-moons.js";
|
|
|
4
4
|
import { BELT_IDS, BELTS, OORT } from "../belts/index.js";
|
|
5
5
|
import { toTerrestrialTime } from "../clock.js";
|
|
6
6
|
import { moonOffset, orientation } from "../scene/orient.js";
|
|
7
|
+
import { edgeStretch, roundShape, squashPoint } from "../scene/round.js";
|
|
7
8
|
import {} from "../scene/painter.js";
|
|
8
9
|
import "../bodies/all.js";
|
|
9
10
|
import { turn } from "../vec.js";
|
|
@@ -745,10 +746,13 @@ export function createSpaceItem(model, deps) {
|
|
|
745
746
|
model.heightPx = size.height;
|
|
746
747
|
// how many pixels across each body is: for the pictures it needs and for what is chosen
|
|
747
748
|
const half = Math.tan((fovNow / 2) * RAD);
|
|
749
|
+
// a body is drawn round wherever it is in the picture, and wider across the farther out it is (the picture's plane is that much farther from the camera there): its radius on the screen is that of one in the middle times `1 / cos` of how far off the line of sight it is
|
|
750
|
+
const eyeAt = [camera.position.x, camera.position.y, camera.position.z];
|
|
751
|
+
const lookAt = [-e2[8], -e2[9], -e2[10]];
|
|
748
752
|
const radiusPxOf = (id) => {
|
|
749
753
|
const d = Math.hypot(pos[id][0] - camera.position.x, pos[id][1] - camera.position.y, pos[id][2] - camera.position.z);
|
|
750
754
|
const r = radiusOf(id);
|
|
751
|
-
return d <= r * 1.001 ? 1e5 : ((size.height / 2) * (r / Math.sqrt(d * d - r * r))) / half;
|
|
755
|
+
return d <= r * 1.001 ? 1e5 : (((size.height / 2) * (r / Math.sqrt(d * d - r * r))) / half) * edgeStretch(eyeAt, lookAt, pos[id]);
|
|
752
756
|
};
|
|
753
757
|
const px = {};
|
|
754
758
|
for (const id of SPACE_BODIES)
|
|
@@ -794,7 +798,10 @@ export function createSpaceItem(model, deps) {
|
|
|
794
798
|
const r = shown.object.scale.x;
|
|
795
799
|
const d = Math.hypot(at.x - camera.position.x, at.y - camera.position.y, at.z - camera.position.z);
|
|
796
800
|
const { pole, meridian } = orientation(model.focus, model.time);
|
|
797
|
-
|
|
801
|
+
const centre = [at.x, at.y, at.z];
|
|
802
|
+
// what is laid over the body is put where the drawn (round) body's surface is
|
|
803
|
+
const shape = roundShape(eyeAt, lookAt, centre, r);
|
|
804
|
+
deps.onSurface({ id: model.focus, centre, radius: r, pole, meridian, eye: eyeAt, project: (v) => labelFor(squashPoint(v, centre, shape)), width: size.width, height: size.height, radiusPx: d <= r * 1.001 ? 1e5 : (((size.height / 2) * (r / Math.sqrt(d * d - r * r))) / half) * edgeStretch(eyeAt, lookAt, centre) });
|
|
798
805
|
}
|
|
799
806
|
}
|
|
800
807
|
if (points !== undefined && deps.book !== undefined) {
|
|
@@ -1208,7 +1215,7 @@ export function createSpaceItem(model, deps) {
|
|
|
1208
1215
|
drawing.object.visible = true;
|
|
1209
1216
|
drawing.object.position.set(at[0], at[1], at[2]);
|
|
1210
1217
|
drawing.object.scale.setScalar(drawn);
|
|
1211
|
-
const moonPx = away <= drawn * 1.001 ? 1e5 : ((size.height / 2) * (drawn / Math.sqrt(away * away - drawn * drawn))) / half;
|
|
1218
|
+
const moonPx = away <= drawn * 1.001 ? 1e5 : (((size.height / 2) * (drawn / Math.sqrt(away * away - drawn * drawn))) / half) * edgeStretch(eyeAt, lookAt, at);
|
|
1212
1219
|
drawing.update({ toSun: model.light === "lit" ? unit([camera.position.x - at[0], camera.position.y - at[1], camera.position.z - at[2]]) : toSunOf(id), ms: model.time, radiusPx: moonPx, view: { camera, width: size.width, height: size.height } });
|
|
1213
1220
|
const spot = labelFor(at);
|
|
1214
1221
|
if (spot) {
|
|
@@ -1319,7 +1326,9 @@ export function createSpaceItem(model, deps) {
|
|
|
1319
1326
|
const r = earth.object.scale.x;
|
|
1320
1327
|
const d = Math.hypot(at.x - camera.position.x, at.y - camera.position.y, at.z - camera.position.z);
|
|
1321
1328
|
const { pole, meridian } = orientation("earth", model.time);
|
|
1322
|
-
|
|
1329
|
+
const centre = [at.x, at.y, at.z];
|
|
1330
|
+
const shape = roundShape(eyeAt, lookAt, centre, r);
|
|
1331
|
+
deps.onEarth({ id: "earth", centre, radius: r, pole, meridian, eye: eyeAt, project: (v) => labelFor(squashPoint(v, centre, shape)), width: size.width, height: size.height, radiusPx: d <= r * 1.001 ? 1e5 : (((size.height / 2) * (r / Math.sqrt(d * d - r * r))) / half) * edgeStretch(eyeAt, lookAt, centre), sun: model.light === "lit" ? null : toSunOf("earth") });
|
|
1323
1332
|
}
|
|
1324
1333
|
}
|
|
1325
1334
|
if (deps.onSight && (deps.wantSight?.() ?? true)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/wakusei-planets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.0",
|
|
4
4
|
"description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"planets",
|
|
@@ -214,6 +214,11 @@
|
|
|
214
214
|
"import": "./dist/comets.js",
|
|
215
215
|
"default": "./dist/comets.js"
|
|
216
216
|
},
|
|
217
|
+
"./landing-sites": {
|
|
218
|
+
"types": "./dist/landing-sites.d.ts",
|
|
219
|
+
"import": "./dist/landing-sites.js",
|
|
220
|
+
"default": "./dist/landing-sites.js"
|
|
221
|
+
},
|
|
217
222
|
"./places": {
|
|
218
223
|
"types": "./dist/places.d.ts",
|
|
219
224
|
"import": "./dist/places.js",
|
|
@@ -637,6 +642,7 @@
|
|
|
637
642
|
"@angular/platform-browser": "^22.2.4",
|
|
638
643
|
"@eslint/js": "^9.0.0",
|
|
639
644
|
"@johnmorrisdotca/chikyu-earth": "^0.36.0",
|
|
645
|
+
"@johnmorrisdotca/hata": "^1.9.0",
|
|
640
646
|
"@playwright/test": "1.64.0",
|
|
641
647
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
642
648
|
"@types/node": "^24.0.0",
|