@johnmorrisdotca/wakusei-planets 0.34.0 → 0.36.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 +27 -0
- package/NOTICE.md +64 -0
- package/README.md +21 -3
- package/dist/approaches.d.ts +276 -0
- package/dist/approaches.js +255 -0
- package/dist/asteroids.d.ts +397 -0
- package/dist/asteroids.js +338 -0
- package/dist/comets.d.ts +316 -0
- package/dist/comets.js +404 -0
- package/dist/craft/bepicolombo.d.ts +1 -0
- package/dist/craft/bepicolombo.js +923 -0
- package/dist/craft/europaclipper.d.ts +1 -0
- package/dist/craft/europaclipper.js +342 -0
- package/dist/craft/hayabusa2.d.ts +1 -0
- package/dist/craft/hayabusa2.js +73 -0
- package/dist/craft/juice.d.ts +1 -0
- package/dist/craft/juice.js +40 -0
- package/dist/craft/lucy.d.ts +1 -0
- package/dist/craft/lucy.js +42 -0
- package/dist/craft/osirisapex.d.ts +1 -0
- package/dist/craft/osirisapex.js +69 -0
- package/dist/craft/psyche.d.ts +1 -0
- package/dist/craft/psyche.js +30 -0
- package/dist/craft/solarorbiter.d.ts +1 -0
- package/dist/craft/solarorbiter.js +94 -0
- package/dist/data/approaches.d.ts +17 -0
- package/dist/data/approaches.js +4192 -0
- package/dist/data/asteroids.d.ts +3 -0
- package/dist/data/asteroids.js +107 -0
- package/dist/data/comets.d.ts +2 -0
- package/dist/data/comets.js +36 -0
- package/dist/data/orbiters.d.ts +368 -0
- package/dist/data/orbiters.js +370 -0
- package/dist/data/places-67p.d.ts +27 -0
- package/dist/data/places-67p.js +2 -0
- package/dist/data/places-ariel.d.ts +602 -0
- package/dist/data/places-ariel.js +27 -0
- package/dist/data/places-bennu.d.ts +25 -0
- package/dist/data/places-bennu.js +2 -0
- package/dist/data/places-callisto.d.ts +3547 -0
- package/dist/data/places-callisto.js +155 -0
- package/dist/data/places-ceres.d.ts +3436 -0
- package/dist/data/places-ceres.js +150 -0
- package/dist/data/places-charon.d.ts +349 -0
- package/dist/data/places-charon.js +16 -0
- package/dist/data/places-dimorphos.d.ts +23 -0
- package/dist/data/places-dimorphos.js +2 -0
- package/dist/data/places-dione.d.ts +2258 -0
- package/dist/data/places-dione.js +99 -0
- package/dist/data/places-enceladus.d.ts +2009 -0
- package/dist/data/places-enceladus.js +88 -0
- package/dist/data/places-eros.d.ts +26 -0
- package/dist/data/places-eros.js +2 -0
- package/dist/data/places-europa.d.ts +2977 -0
- package/dist/data/places-europa.js +130 -0
- package/dist/data/places-ganymede.d.ts +4518 -0
- package/dist/data/places-ganymede.js +197 -0
- package/dist/data/places-iapetus.d.ts +1616 -0
- package/dist/data/places-iapetus.js +71 -0
- package/dist/data/places-io.d.ts +6012 -0
- package/dist/data/places-io.js +262 -0
- package/dist/data/places-jupiter.d.ts +46 -0
- package/dist/data/places-jupiter.js +3 -0
- package/dist/data/places-mars.d.ts +20701 -0
- package/dist/data/places-mars.js +942 -0
- package/dist/data/places-mercury.d.ts +9256 -0
- package/dist/data/places-mercury.js +403 -0
- package/dist/data/places-mimas.d.ts +968 -0
- package/dist/data/places-mimas.js +43 -0
- package/dist/data/places-miranda.d.ts +419 -0
- package/dist/data/places-miranda.js +19 -0
- package/dist/data/places-moon.d.ts +18849 -0
- package/dist/data/places-moon.js +861 -0
- package/dist/data/places-oberon.d.ts +235 -0
- package/dist/data/places-oberon.js +11 -0
- package/dist/data/places-pluto.d.ts +1687 -0
- package/dist/data/places-pluto.js +74 -0
- package/dist/data/places-rhea.d.ts +3317 -0
- package/dist/data/places-rhea.js +145 -0
- package/dist/data/places-ryugu.d.ts +87 -0
- package/dist/data/places-ryugu.js +5 -0
- package/dist/data/places-saturn.d.ts +25 -0
- package/dist/data/places-saturn.js +2 -0
- package/dist/data/places-tempel-1.d.ts +25 -0
- package/dist/data/places-tempel-1.js +2 -0
- package/dist/data/places-tethys.d.ts +1222 -0
- package/dist/data/places-tethys.js +54 -0
- package/dist/data/places-titan.d.ts +7031 -0
- package/dist/data/places-titan.js +306 -0
- package/dist/data/places-titania.d.ts +418 -0
- package/dist/data/places-titania.js +19 -0
- package/dist/data/places-triton.d.ts +1457 -0
- package/dist/data/places-triton.js +64 -0
- package/dist/data/places-umbriel.d.ts +303 -0
- package/dist/data/places-umbriel.js +14 -0
- package/dist/data/places-venus.d.ts +9290 -0
- package/dist/data/places-venus.js +405 -0
- package/dist/data/places-vesta.d.ts +2444 -0
- package/dist/data/places-vesta.js +107 -0
- package/dist/data/roadster.d.ts +8 -0
- package/dist/data/roadster.js +686 -0
- package/dist/element.js +17 -3
- package/dist/orbiter-facts.d.ts +480 -0
- package/dist/orbiter-facts.js +189 -0
- package/dist/orbiters.d.ts +256 -0
- package/dist/orbiters.js +275 -0
- package/dist/places/67p.d.ts +13 -0
- package/dist/places/67p.js +14 -0
- package/dist/places/ariel.d.ts +13 -0
- package/dist/places/ariel.js +14 -0
- package/dist/places/bennu.d.ts +13 -0
- package/dist/places/bennu.js +14 -0
- package/dist/places/callisto.d.ts +13 -0
- package/dist/places/callisto.js +14 -0
- package/dist/places/ceres.d.ts +13 -0
- package/dist/places/ceres.js +14 -0
- package/dist/places/charon.d.ts +13 -0
- package/dist/places/charon.js +14 -0
- package/dist/places/dimorphos.d.ts +13 -0
- package/dist/places/dimorphos.js +14 -0
- package/dist/places/dione.d.ts +13 -0
- package/dist/places/dione.js +14 -0
- package/dist/places/enceladus.d.ts +13 -0
- package/dist/places/enceladus.js +14 -0
- package/dist/places/eros.d.ts +13 -0
- package/dist/places/eros.js +14 -0
- package/dist/places/europa.d.ts +13 -0
- package/dist/places/europa.js +14 -0
- package/dist/places/ganymede.d.ts +13 -0
- package/dist/places/ganymede.js +14 -0
- package/dist/places/iapetus.d.ts +13 -0
- package/dist/places/iapetus.js +14 -0
- package/dist/places/io.d.ts +13 -0
- package/dist/places/io.js +14 -0
- package/dist/places/jupiter.d.ts +13 -0
- package/dist/places/jupiter.js +14 -0
- package/dist/places/mars.d.ts +12 -0
- package/dist/places/mars.js +13 -0
- package/dist/places/mercury.d.ts +13 -0
- package/dist/places/mercury.js +14 -0
- package/dist/places/mimas.d.ts +13 -0
- package/dist/places/mimas.js +14 -0
- package/dist/places/miranda.d.ts +13 -0
- package/dist/places/miranda.js +14 -0
- package/dist/places/moon.d.ts +12 -0
- package/dist/places/moon.js +13 -0
- package/dist/places/oberon.d.ts +13 -0
- package/dist/places/oberon.js +14 -0
- package/dist/places/pluto.d.ts +13 -0
- package/dist/places/pluto.js +14 -0
- package/dist/places/rhea.d.ts +13 -0
- package/dist/places/rhea.js +14 -0
- package/dist/places/ryugu.d.ts +13 -0
- package/dist/places/ryugu.js +14 -0
- package/dist/places/saturn.d.ts +13 -0
- package/dist/places/saturn.js +14 -0
- package/dist/places/tempel-1.d.ts +13 -0
- package/dist/places/tempel-1.js +14 -0
- package/dist/places/tethys.d.ts +13 -0
- package/dist/places/tethys.js +14 -0
- package/dist/places/titan.d.ts +13 -0
- package/dist/places/titan.js +14 -0
- package/dist/places/titania.d.ts +13 -0
- package/dist/places/titania.js +14 -0
- package/dist/places/triton.d.ts +13 -0
- package/dist/places/triton.js +14 -0
- package/dist/places/umbriel.d.ts +13 -0
- package/dist/places/umbriel.js +14 -0
- package/dist/places/venus.d.ts +13 -0
- package/dist/places/venus.js +14 -0
- package/dist/places/vesta.d.ts +13 -0
- package/dist/places/vesta.js +14 -0
- package/dist/places.d.ts +354 -0
- package/dist/places.js +357 -0
- package/dist/plan/element.d.ts +52 -0
- package/dist/plan/element.js +258 -0
- package/dist/plan/index.d.ts +2 -0
- package/dist/plan/index.js +2 -0
- package/dist/plan/layout.d.ts +230 -0
- package/dist/plan/layout.js +229 -0
- package/dist/plan/svg.d.ts +125 -0
- package/dist/plan/svg.js +185 -0
- package/dist/roadster.d.ts +415 -0
- package/dist/roadster.js +496 -0
- package/dist/scene/body.js +10 -9
- package/dist/scene/painter.d.ts +1 -1
- package/dist/scene/painter.js +23 -7
- package/dist/scene/textures.d.ts +2 -2
- package/dist/space/beside.d.ts +4 -1
- package/dist/space/beside.js +47 -6
- package/dist/space/covered.d.ts +102 -0
- package/dist/space/covered.js +98 -0
- package/dist/space/element.d.ts +101 -5
- package/dist/space/element.js +474 -30
- package/dist/space/frame.d.ts +14 -0
- package/dist/space/frame.js +16 -0
- package/dist/space/index.d.ts +4 -1
- package/dist/space/index.js +4 -1
- package/dist/space/regions.d.ts +111 -0
- package/dist/space/regions.js +84 -0
- package/dist/space/scale.d.ts +2 -1
- package/dist/space/scale.js +13 -2
- package/dist/space/scene.d.ts +109 -8
- package/dist/space/scene.js +313 -37
- package/dist/space/travel.d.ts +256 -0
- package/dist/space/travel.js +597 -0
- package/dist/spacecraft-facts.d.ts +4 -4
- package/dist/spacecraft-facts.js +158 -3
- package/dist/spacecraft.d.ts +69 -2
- package/dist/spacecraft.js +45 -2
- package/dist/textures/mimas-1024.webp +0 -0
- package/dist/textures/mimas-512.webp +0 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +208 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { type Vec3 } from "../vec.ts";
|
|
2
|
+
/**
|
|
3
|
+
* How a move is made. The names and their order are the same as `Transition` in `glide.ts` (the list the space view's `transition` takes), so one value serves both: `turn-travel` (the default: turn or back
|
|
4
|
+
* up until the destination is in the picture, approach it directly, settle), `direct` (a straight glide with a slow launch, turning evenly on the way), `look-back` (the same straight glide, watching the body
|
|
5
|
+
* being left and turning to the destination over the last part), `auto` (`turn-travel`, which already goes straight at a destination that is in view) and `cut` (the last view at once).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import type { TravelKind } from "@johnmorrisdotca/wakusei-planets/space";
|
|
10
|
+
*
|
|
11
|
+
* const kind: TravelKind = "turn-travel";
|
|
12
|
+
* console.log(kind);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type TravelKind = "turn-travel" | "direct" | "look-back" | "auto" | "cut";
|
|
16
|
+
/**
|
|
17
|
+
* How near a move may come to a body, in that body's radii above its surface: 1, so a body passed is never more than 60 degrees across. A move that starts or ends nearer than one and a half times that keeps two thirds of the nearer distance.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { TRAVEL_CLEARANCE } from "@johnmorrisdotca/wakusei-planets/space";
|
|
22
|
+
*
|
|
23
|
+
* console.log(TRAVEL_CLEARANCE);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const TRAVEL_CLEARANCE = 1;
|
|
27
|
+
/**
|
|
28
|
+
* A camera: where it is, the unit vectors it looks along and has up in the picture, and its vertical field of view in degrees. The same four as `besideMoon` and `ridePose` give.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import type { TravelView } from "@johnmorrisdotca/wakusei-planets/space";
|
|
33
|
+
*
|
|
34
|
+
* const view: TravelView = { position: [0, 0, 4.1], forward: [0, 0, -1], up: [0, 1, 0], fov: 35 };
|
|
35
|
+
* console.log(view.fov);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export interface TravelView {
|
|
39
|
+
position: Vec3;
|
|
40
|
+
forward: Vec3;
|
|
41
|
+
up: Vec3;
|
|
42
|
+
fov: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A body of a move: where it is when the move starts (`from`) and when it ends (`to`, the same place when left out), and its radius, all in the scene's unit for the scale in use. Places are given at the two
|
|
46
|
+
* ends, not as a function, so the input is plain data and the same input always gives the same camera; between the ends a body goes in a straight line, which over the seconds of a move is its orbit to well
|
|
47
|
+
* under a pixel. `reach` marks a view of a region round the body (the radius of the outermost orbit in the picture).
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import type { TravelBody } from "@johnmorrisdotca/wakusei-planets/space";
|
|
52
|
+
*
|
|
53
|
+
* const moon: TravelBody = { from: [60.3, 0, 0], to: [60.3, 0, 0.01], radius: 0.273 };
|
|
54
|
+
* console.log(moon.radius);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export interface TravelBody {
|
|
58
|
+
from: Vec3;
|
|
59
|
+
to?: Vec3;
|
|
60
|
+
radius: number;
|
|
61
|
+
/** Set for a view of a region round this body, from `regionView`: how far out the region goes. The move is then a straight pull back or push in. */
|
|
62
|
+
reach?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* What `travelPose` and `travelPlan` are asked: the camera now (`start`) and the framed view to end in (`end`, worked out for the destination's place at the end of the move), the body being left and the
|
|
66
|
+
* destination, the planet when both are of one planet's family, any other body to keep clear of, and the picture's width over its height.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import type { TravelInput } from "@johnmorrisdotca/wakusei-planets/space";
|
|
71
|
+
*
|
|
72
|
+
* const input: TravelInput = {
|
|
73
|
+
* start: { position: [0, 0, 4.1], forward: [0, 0, -1], up: [0, 1, 0], fov: 35 },
|
|
74
|
+
* end: { position: [300, 0, 1], forward: [1, 0, -0.2], up: [0, 1, 0], fov: 35 },
|
|
75
|
+
* leaving: { from: [0, 0, 0], radius: 1 },
|
|
76
|
+
* destination: { from: [303, 0, 0.4], radius: 0.5 },
|
|
77
|
+
* aspect: 16 / 9,
|
|
78
|
+
* };
|
|
79
|
+
* console.log(input.aspect.toFixed(2));
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export interface TravelInput {
|
|
83
|
+
start: TravelView;
|
|
84
|
+
end: TravelView;
|
|
85
|
+
/** The body the camera is at when the move starts. */
|
|
86
|
+
leaving: TravelBody;
|
|
87
|
+
/** The body the move goes to. For a view of a region, the body at its middle, with `reach`. */
|
|
88
|
+
destination: TravelBody;
|
|
89
|
+
/** The planet, when both ends are of one planet's family (two of its moons, or the planet and one of its moons; pass the planet itself then): the camera circles it and it stays in the picture the whole way. */
|
|
90
|
+
around?: TravelBody;
|
|
91
|
+
/** Any other body the path could pass: the Sun, the planets, the Moon, the dwarf planets and the small bodies of the view, as they go by their `to`. They are only kept clear of. */
|
|
92
|
+
others?: readonly TravelBody[];
|
|
93
|
+
/** The picture's width over its height. */
|
|
94
|
+
aspect: number;
|
|
95
|
+
/** How to move: `turn-travel` when left out. */
|
|
96
|
+
kind?: TravelKind;
|
|
97
|
+
/** True for a reader who asked for reduced motion: the move is a `cut` whatever `kind` says. */
|
|
98
|
+
reduced?: boolean;
|
|
99
|
+
/** Scales the suggested length of the move: 2 is twice as slow. 1 when left out. */
|
|
100
|
+
pace?: number;
|
|
101
|
+
/** How near the path may come to a body, in its radii above its surface: `TRAVEL_CLEARANCE` when left out. */
|
|
102
|
+
clearance?: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Where a body is in the picture at one moment: `inside` when its centre (the place of its marker) is within the frame, `x` and `y` from -1 at the left and bottom edges to 1 at the right and top, and `radius`,
|
|
106
|
+
* its angular radius in degrees. A body behind the camera is not inside, and its `x` and `y` say which side it is off.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import type { TravelSight } from "@johnmorrisdotca/wakusei-planets/space";
|
|
111
|
+
*
|
|
112
|
+
* const marker = (sight: TravelSight): string => (sight.inside ? `${(50 + 50 * sight.x).toFixed(0)}% across` : "off the picture");
|
|
113
|
+
* console.log(marker({ inside: true, x: 0.2, y: 0, radius: 0.01 }));
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export interface TravelSight {
|
|
117
|
+
inside: boolean;
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
radius: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The camera at one moment of a move, with the stage the move is in and where the two bodies (and the planet circled, when one was given) are in the picture, so a page can mark a body too small to see.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* import type { TravelSample } from "@johnmorrisdotca/wakusei-planets/space";
|
|
128
|
+
*
|
|
129
|
+
* const say = (sample: TravelSample): string => `${sample.stage}: destination ${sample.destination.inside ? "in" : "out of"} the picture`;
|
|
130
|
+
* console.log(typeof say);
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export interface TravelSample extends TravelView {
|
|
134
|
+
stage: "turn" | "travel" | "arrive";
|
|
135
|
+
leaving: TravelSight;
|
|
136
|
+
destination: TravelSight;
|
|
137
|
+
around?: TravelSight;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* What `travelPlan` works out: the way the move is made, the share of its time each stage takes (they add up to 1), how long it should last in milliseconds (from how far the picture turns and how many times
|
|
141
|
+
* over the distances change, never under 1200 or over 9000 before `pace`; a page may use any length of its own), the angle the look direction turns through in degrees, and how each stage is eased.
|
|
142
|
+
* `route` is the worked-out path for `travelPose`: hand the plan back to it to save working it out at every frame.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* import type { TravelPlan } from "@johnmorrisdotca/wakusei-planets/space";
|
|
147
|
+
*
|
|
148
|
+
* const seconds = (plan: TravelPlan): string => (plan.duration / 1000).toFixed(1);
|
|
149
|
+
* console.log(typeof seconds);
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export interface TravelPlan {
|
|
153
|
+
/** What the move really is: `auto` reads `turn-travel`, and a reduced move reads `cut`. */
|
|
154
|
+
kind: Exclude<TravelKind, "auto">;
|
|
155
|
+
/** `pivot` (turn beside the body left, then go), `circle` (round the planet of one family), `line` (one straight line), `cut`. */
|
|
156
|
+
path: "pivot" | "circle" | "line" | "cut";
|
|
157
|
+
stages: {
|
|
158
|
+
turn: number;
|
|
159
|
+
travel: number;
|
|
160
|
+
arrive: number;
|
|
161
|
+
};
|
|
162
|
+
duration: number;
|
|
163
|
+
/** The angle between the first and the last look directions, in degrees: the least any move must turn. */
|
|
164
|
+
turn: number;
|
|
165
|
+
/** Turning follows a smooth step of its stage's time; distance grows geometrically out of the start and shrinks geometrically into the end, under a smooth step of the time. */
|
|
166
|
+
easing: {
|
|
167
|
+
turn: "smooth-step";
|
|
168
|
+
distance: "geometric";
|
|
169
|
+
};
|
|
170
|
+
/** The angle the camera turns round the destination as it arrives, in degrees: 0 when the whole turn is made before the way on. */
|
|
171
|
+
settle: number;
|
|
172
|
+
/** The path itself, for `travelPose`. */
|
|
173
|
+
route: unknown;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The plan of a move: its stages and the share of the time each takes, how long it should last, and how it is eased. The length is a suggestion from how far the picture changes (16 milliseconds a degree
|
|
177
|
+
* turned, 320 for each time the distance changes by a factor of e, between 1.2 and 9 seconds, times `pace`); a page may use its own, since `travelPose` takes the moment as a share of the move.
|
|
178
|
+
*
|
|
179
|
+
* @param input - The two views, the bodies and the picture's shape.
|
|
180
|
+
* @returns The plan. Hand it to `travelPose` as its third argument to save working the path out at every frame.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* import { travelPlan } from "@johnmorrisdotca/wakusei-planets/space";
|
|
185
|
+
*
|
|
186
|
+
* const plan = travelPlan({
|
|
187
|
+
* start: { position: [0, 0, 4.1], forward: [0, 0, -1], up: [0, 1, 0], fov: 35 },
|
|
188
|
+
* end: { position: [297.6, 0, 0], forward: [1, 0, 0], up: [0, 1, 0], fov: 35 },
|
|
189
|
+
* leaving: { from: [0, 0, 0], radius: 1 },
|
|
190
|
+
* destination: { from: [300, 0, 0], radius: 0.6 },
|
|
191
|
+
* aspect: 16 / 9,
|
|
192
|
+
* });
|
|
193
|
+
* console.log(plan.path, plan.duration, plan.stages.turn.toFixed(2));
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
export declare function travelPlan(input: TravelInput): TravelPlan;
|
|
197
|
+
/**
|
|
198
|
+
* The camera at the moment `t` of a move, from 0 (the first view) to 1 (the last view), with where the two bodies are in the picture. The same input and moment always give the same camera. The default move,
|
|
199
|
+
* `turn-travel`, never shows an empty picture between two framed views: the body being left (or the planet circled) is held in the picture through the turn, and the destination from the end of the turn on,
|
|
200
|
+
* where it only grows; the look direction turns one way only; no place is nearer a body than `TRAVEL_CLEARANCE`. `direct` and `look-back` are a straight eased glide and promise only the clearance. `cut`, or
|
|
201
|
+
* `reduced`, gives the last view for every `t` above 0.
|
|
202
|
+
*
|
|
203
|
+
* The bodies' places are taken at the two ends of the move (`from` and `to`): work out `end` for the destination's place at the end, and start a new move if the clock's speed changes on the way.
|
|
204
|
+
*
|
|
205
|
+
* @param input - The two views, the bodies and the picture's shape.
|
|
206
|
+
* @param t - The moment, as a share of the move from 0 to 1.
|
|
207
|
+
* @param plan - The plan from `travelPlan(input)`, to save working it out again.
|
|
208
|
+
* @returns The camera, the stage, and where the bodies are in the picture.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* import { travelPlan, travelPose, type TravelInput } from "@johnmorrisdotca/wakusei-planets/space";
|
|
213
|
+
*
|
|
214
|
+
* const input: TravelInput = {
|
|
215
|
+
* start: { position: [0, 0, 4.1], forward: [0, 0, -1], up: [0, 1, 0], fov: 35 },
|
|
216
|
+
* end: { position: [297.6, 0, 0], forward: [1, 0, 0], up: [0, 1, 0], fov: 35 },
|
|
217
|
+
* leaving: { from: [0, 0, 0], radius: 1 },
|
|
218
|
+
* destination: { from: [300, 0, 0], radius: 0.6 },
|
|
219
|
+
* aspect: 16 / 9,
|
|
220
|
+
* };
|
|
221
|
+
* const plan = travelPlan(input);
|
|
222
|
+
* for (const t of [0, 0.25, 0.5, 0.75, 1]) {
|
|
223
|
+
* const camera = travelPose(input, t, plan);
|
|
224
|
+
* console.log(camera.stage, camera.leaving.inside || camera.destination.inside);
|
|
225
|
+
* }
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
export declare function travelPose(input: TravelInput, t: number, plan?: TravelPlan): TravelSample;
|
|
229
|
+
/**
|
|
230
|
+
* A framed view of a whole body to arrive at, from the side the move comes from, so the approach is straight and nothing has to be turned back: the camera stands on the line towards `from`, moved round
|
|
231
|
+
* towards the Sun where that side would show less than about three fifths of the body lit (never more than 75 degrees off the Sun's direction), at `fit` radii away (4.1, and as much again as a tall picture is
|
|
232
|
+
* taller than wide), looking at the body with `north` up.
|
|
233
|
+
*
|
|
234
|
+
* @param input - The body's place and radius, where the move comes from, the Sun's place (left out for the Sun itself), the picture's shape, and optionally `fov`, `fit` and `north`.
|
|
235
|
+
* @returns The view, and `lit`, the share of the disc that is lit from there (1 when no Sun is given).
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* import { travelArrival } from "@johnmorrisdotca/wakusei-planets/space";
|
|
240
|
+
*
|
|
241
|
+
* const view = travelArrival({ body: [300, 0, 0], radius: 0.6, from: [0, 0, 0], sun: [100, 0, 150], aspect: 16 / 9 });
|
|
242
|
+
* console.log(view.position.map((n) => n.toFixed(1)).join(", "), view.lit.toFixed(2));
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
export declare function travelArrival(input: {
|
|
246
|
+
body: Vec3;
|
|
247
|
+
radius: number;
|
|
248
|
+
from: Vec3;
|
|
249
|
+
sun?: Vec3;
|
|
250
|
+
aspect: number;
|
|
251
|
+
fov?: number;
|
|
252
|
+
fit?: number;
|
|
253
|
+
north?: Vec3;
|
|
254
|
+
}): TravelView & {
|
|
255
|
+
lit: number;
|
|
256
|
+
};
|