@johnmorrisdotca/uchusen-rockets 0.1.0 → 0.2.1

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/NOTICE.md +2 -2
  3. package/README.md +1 -1
  4. package/dist/assets/falcon-9-block-5-apart.painted.svg +1 -1
  5. package/dist/assets/falcon-9-block-5-apart.svg +1 -1
  6. package/dist/assets/falcon-9-block-5-apart.thick.svg +1 -1
  7. package/dist/assets/falcon-9-block-5-dragon-2-apart.painted.svg +1 -1
  8. package/dist/assets/falcon-9-block-5-dragon-2-apart.svg +1 -1
  9. package/dist/assets/falcon-9-block-5-dragon-2-apart.thick.svg +1 -1
  10. package/dist/assets/falcon-9-block-5-dragon-2-second-stage.glb +0 -0
  11. package/dist/assets/falcon-9-block-5-dragon-2-second-stage.painted.svg +1 -1
  12. package/dist/assets/falcon-9-block-5-dragon-2-second-stage.svg +1 -1
  13. package/dist/assets/falcon-9-block-5-dragon-2-second-stage.thick.svg +1 -1
  14. package/dist/assets/falcon-9-block-5-dragon-2.glb +0 -0
  15. package/dist/assets/falcon-9-block-5-second-stage.glb +0 -0
  16. package/dist/assets/falcon-9-block-5-second-stage.painted.svg +1 -1
  17. package/dist/assets/falcon-9-block-5-second-stage.svg +1 -1
  18. package/dist/assets/falcon-9-block-5-second-stage.thick.svg +1 -1
  19. package/dist/assets/falcon-9-block-5.glb +0 -0
  20. package/dist/assets/falcon-9-ft-apart.painted.svg +1 -1
  21. package/dist/assets/falcon-9-ft-apart.svg +1 -1
  22. package/dist/assets/falcon-9-ft-apart.thick.svg +1 -1
  23. package/dist/assets/falcon-9-ft-second-stage.glb +0 -0
  24. package/dist/assets/falcon-9-ft-second-stage.painted.svg +1 -1
  25. package/dist/assets/falcon-9-ft-second-stage.svg +1 -1
  26. package/dist/assets/falcon-9-ft-second-stage.thick.svg +1 -1
  27. package/dist/assets/falcon-9-ft.glb +0 -0
  28. package/dist/assets/falcon-9-v1.1-apart.painted.svg +1 -1
  29. package/dist/assets/falcon-9-v1.1-apart.svg +1 -1
  30. package/dist/assets/falcon-9-v1.1-apart.thick.svg +1 -1
  31. package/dist/assets/falcon-9-v1.1-second-stage.glb +0 -0
  32. package/dist/assets/falcon-9-v1.1-second-stage.painted.svg +1 -1
  33. package/dist/assets/falcon-9-v1.1-second-stage.svg +1 -1
  34. package/dist/assets/falcon-9-v1.1-second-stage.thick.svg +1 -1
  35. package/dist/assets/falcon-9-v1.1.glb +0 -0
  36. package/dist/data/falcon.d.ts +3 -1
  37. package/dist/data/falcon.js +2 -0
  38. package/dist/data/sources.d.ts +8 -0
  39. package/dist/data/sources.js +1 -0
  40. package/dist/element/scene.d.ts +17 -2
  41. package/dist/element/scene.js +142 -19
  42. package/dist/element.d.ts +15 -3
  43. package/dist/element.js +112 -20
  44. package/dist/framing.d.ts +10 -0
  45. package/dist/framing.js +4 -0
  46. package/dist/index.d.ts +3 -2
  47. package/dist/index.js +2 -1
  48. package/dist/model/falcon.d.ts +1 -0
  49. package/dist/model/falcon.js +5 -3
  50. package/dist/model/registry.js +1 -1
  51. package/dist/parts.d.ts +2 -1
  52. package/dist/pixels.d.ts +8 -0
  53. package/dist/pixels.js +14 -0
  54. package/package.json +2 -1
package/dist/index.d.ts CHANGED
@@ -10,13 +10,14 @@ export type { Joint, PartKind, PartRecord } from "./parts.ts";
10
10
  export { PART_ENTRIES, partEntry } from "./model/registry.ts";
11
11
  export { check } from "./fit.ts";
12
12
  export type { Description, FitCode, FitIssue, FitReport, SlotPart } from "./fit.ts";
13
- export { axesOf, cleanView, DEFAULT_VIEW, directionOf, FOV_DEG, frameFor, PICTURE_H, PICTURE_W, VIEW_NAMES, VIEWS } from "./framing.ts";
14
- export type { Angle, Framing, Vec3, ViewName } from "./framing.ts";
13
+ export { axesOf, cleanView, DEFAULT_VIEW, directionOf, FOV_DEG, frameFor, PICTURE_H, PICTURE_W, turnedBy, VIEW_NAMES, VIEWS } from "./framing.ts";
14
+ export type { Angle, Framing, Vec3, ViewChoice, ViewName } from "./framing.ts";
15
15
  export { cleanLook, DEFAULT_LOOK, LOOK_NAMES, LOOKS } from "./looks.ts";
16
16
  export type { Look, LookName } from "./looks.ts";
17
17
  export { cleanShow, placesFor, showsOf } from "./layout.ts";
18
18
  export type { Place, ShowName } from "./layout.ts";
19
19
  export { CROSSFADE_MS, DRAWING_HOLD_MS, REDUCED_FADE_MS, revealDelay } from "./crossfade.ts";
20
+ export { MAX_PIXELS, MAX_RATIO, MAX_SIDE, pixelRatioFor } from "./pixels.ts";
20
21
  export { tiltMode, tiltTurn } from "./tilt.ts";
21
22
  export type { Reading, TiltMode } from "./tilt.ts";
22
23
  export { MATERIALS } from "./model/materials.ts";
package/dist/index.js CHANGED
@@ -5,9 +5,10 @@ export { SOURCES } from "./data/sources.js";
5
5
  export { creditLine, MODEL_CREDITS } from "./data/credits.js";
6
6
  export { PART_ENTRIES, partEntry } from "./model/registry.js";
7
7
  export { check } from "./fit.js";
8
- export { axesOf, cleanView, DEFAULT_VIEW, directionOf, FOV_DEG, frameFor, PICTURE_H, PICTURE_W, VIEW_NAMES, VIEWS } from "./framing.js";
8
+ export { axesOf, cleanView, DEFAULT_VIEW, directionOf, FOV_DEG, frameFor, PICTURE_H, PICTURE_W, turnedBy, VIEW_NAMES, VIEWS } from "./framing.js";
9
9
  export { cleanLook, DEFAULT_LOOK, LOOK_NAMES, LOOKS } from "./looks.js";
10
10
  export { cleanShow, placesFor, showsOf } from "./layout.js";
11
11
  export { CROSSFADE_MS, DRAWING_HOLD_MS, REDUCED_FADE_MS, revealDelay } from "./crossfade.js";
12
+ export { MAX_PIXELS, MAX_RATIO, MAX_SIDE, pixelRatioFor } from "./pixels.js";
12
13
  export { tiltMode, tiltTurn } from "./tilt.js";
13
14
  export { MATERIALS } from "./model/materials.js";
@@ -18,6 +18,7 @@ export interface FalconDraw {
18
18
  joint: number;
19
19
  radius: number;
20
20
  nozzle: number;
21
+ exit: number;
21
22
  };
22
23
  fairing: {
23
24
  height: number;
@@ -1,5 +1,6 @@
1
1
  // Falcon 9, Falcon Heavy, Dragon and Grasshopper from tables of numbers. Heights and diameters are the sourced figures where there are any. How a part is drawn is not a published figure: Block 5, Dragon 2, Dragon 1, Falcon Heavy
2
2
  // and Grasshopper take their proportions from their licensed models at the sourced sizes (see NOTICE.md), and the older Falcons from the sourced totals and the documented differences.
3
+ import { MVAC_EXIT_DIAMETER } from "../data/falcon.js";
3
4
  import { deg } from "../framing.js";
4
5
  import { pointOf, radial, strut } from "./pieces.js";
5
6
  import { gridFin } from "./starship.js";
@@ -16,7 +17,8 @@ const R = 1.85;
16
17
  /** Each part's height is the sourced figure where there is one; the others share out what the sourced whole leaves, so the parts add up to it. */
17
18
  const falconOf = (first, interstage, secondHeight, joint, fairing, fairingRadius, engines, legs, fins) => ({
18
19
  first: { height: first, interstage, radius: R, engines, legs, fins },
19
- second: { height: secondHeight, joint, radius: R, nozzle: joint * 0.9 },
20
+ // the v1.0's Merlin 1C Vacuum has no sourced width, so its nozzle keeps its drawn proportion
21
+ second: { height: secondHeight, joint, radius: R, nozzle: joint * 0.9, exit: engines === "grid" ? R * 0.62 : (MVAC_EXIT_DIAMETER.value ?? 0) / 2 },
20
22
  fairing: { height: fairing, radius: fairingRadius },
21
23
  });
22
24
  export const FALCON_DRAWS = {
@@ -62,11 +64,11 @@ function firstStage(d, withTop) {
62
64
  return pieces;
63
65
  }
64
66
  function secondStage(d) {
65
- const { height, joint, radius: r, nozzle } = d;
67
+ const { height, joint, radius: r, nozzle, exit } = d;
66
68
  const pieces = [];
67
69
  pieces.push({ kind: "lathe", material: "white", segs: 48, body: true, outline: true, profile: [[r * 0.6, joint - 0.5], [r, joint], [r, height]], rings: [joint + 0.5, height - 0.05], welds: [(joint + height) / 2] });
68
70
  pieces.push({ kind: "lathe", material: "soot", segs: 36, under: true, only: "mesh", profile: [[0, joint - 0.5], [r * 0.6, joint - 0.5]] });
69
- pieces.push(...merlin([0, 0], 0, r * 0.62, nozzle * 1.06));
71
+ pieces.push(...merlin([0, 0], 0, exit, nozzle * 1.06));
70
72
  return pieces;
71
73
  }
72
74
  function fairing(d, jointRadius) {
@@ -14,7 +14,7 @@ const PAINTED = {
14
14
  "starship-v1-flight1-ship": { file: "starship-v1-flight1-ship.glb", credit: "clarence365-s24b7" },
15
15
  "starship-2019-ship": { file: "starship-2019-ship.glb", credit: "martiandays-2019" },
16
16
  "falcon-9-block-5-first-stage": { file: "falcon-9-block-5-first-stage.glb", credit: "stanley-falcon-9" },
17
- "falcon-9-block-5-second-stage": { file: "falcon-9-block-5-second-stage.glb", credit: "stanley-falcon-9" },
17
+ "falcon-9-block-5-second-stage": { file: "falcon-9-block-5-second-stage.glb", credit: "stanley-falcon-9", ownNozzle: true },
18
18
  "falcon-9-block-5-fairing": { file: "falcon-9-block-5-fairing.glb", credit: "stanley-falcon-9" },
19
19
  "dragon-dragon-2-capsule": { file: "dragon-dragon-2-capsule.glb", credit: "kubaha-dragon-2" },
20
20
  "dragon-dragon-2-trunk": { file: "dragon-dragon-2-trunk.glb", credit: "kubaha-dragon-2" },
package/dist/parts.d.ts CHANGED
@@ -34,10 +34,11 @@ export interface PartRecord {
34
34
  x: number;
35
35
  z: number;
36
36
  };
37
- /** The painted look's mesh, when a licensed model gives one: its file under assets/models/ and whose it is. Otherwise this package's own code paints it. */
37
+ /** The painted look's mesh, when a licensed model gives one: its file under assets/models/ and whose it is. Otherwise this package's own code paints it. `ownNozzle`: the model has none, so this package's own shows with it unless the part is nested in the stage below. */
38
38
  painted: {
39
39
  file: string;
40
40
  credit: CreditId;
41
+ ownNozzle?: true;
41
42
  } | null;
42
43
  /** What a reader should be told about where its shape came from. */
43
44
  drawnFrom: string;
@@ -0,0 +1,8 @@
1
+ /** The most the backing store may hold, in pixels (a 620 x 827 view at a ratio of 2 is 2 million). */
2
+ export declare const MAX_PIXELS = 6000000;
3
+ /** The longest side the backing store may have. */
4
+ export declare const MAX_SIDE = 4096;
5
+ /** The sharpest ratio ever used, however dense the screen. */
6
+ export declare const MAX_RATIO = 2;
7
+ /** The device pixel ratio to draw a `width` x `height` view at: the screen's own, held to 2, to 4096 pixels a side and to 6 million in all. At least 0.25, and 1 for a nonsense value. */
8
+ export declare function pixelRatioFor(width: number, height: number, deviceRatio: number): number;
package/dist/pixels.js ADDED
@@ -0,0 +1,14 @@
1
+ // How sharp the 3D canvas may be. The backing store is width x height x ratio squared, and a view as big as a 5K screen at a ratio of 2 would ask the graphics card for 15 million pixels, every frame. Pure.
2
+ /** The most the backing store may hold, in pixels (a 620 x 827 view at a ratio of 2 is 2 million). */
3
+ export const MAX_PIXELS = 6_000_000;
4
+ /** The longest side the backing store may have. */
5
+ export const MAX_SIDE = 4096;
6
+ /** The sharpest ratio ever used, however dense the screen. */
7
+ export const MAX_RATIO = 2;
8
+ /** The device pixel ratio to draw a `width` x `height` view at: the screen's own, held to 2, to 4096 pixels a side and to 6 million in all. At least 0.25, and 1 for a nonsense value. */
9
+ export function pixelRatioFor(width, height, deviceRatio) {
10
+ const w = Math.max(1, width);
11
+ const h = Math.max(1, height);
12
+ const wanted = Number.isFinite(deviceRatio) && deviceRatio > 0 ? Math.min(deviceRatio, MAX_RATIO) : 1;
13
+ return Math.max(0.25, Math.min(wanted, MAX_SIDE / Math.max(w, h), Math.sqrt(MAX_PIXELS / (w * h))));
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/uchusen-rockets",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Uchusen Rockets 宇宙船: line drawings and 3D views of rockets, as a web component. Every variant with its own sourced sizes, a typed way to assemble a rocket from parts, stack and separate. No logos. three.js is a peer dependency.",
5
5
  "keywords": ["rocket", "rockets", "spaceship", "starship", "super-heavy", "falcon-9", "dragon", "spaceflight", "line-drawing", "svg", "3d", "3d-models", "glb", "gltf", "three", "threejs", "webgl", "web-component", "custom-element", "react", "typescript", "data"],
6
6
  "homepage": "https://johnmorrisdotca.github.io/uchusen-rockets/",
@@ -47,6 +47,7 @@
47
47
  "@gltf-transform/core": "4.5.1",
48
48
  "@gltf-transform/extensions": "4.5.1",
49
49
  "@gltf-transform/functions": "4.5.1",
50
+ "@johnmorrisdotca/kazoku-ui": "0.2.1",
50
51
  "@playwright/test": "1.64.0",
51
52
  "@types/node": "24.10.1",
52
53
  "@types/react": "19.2.7",