Reference · The Sun, Moon and planets: pure parts
aboveModelSharefunction
The share of the view's height that a model's radius takes when the camera is distanceKm above the satellite (a ride above it). A satellite is a few metres across, so the model is drawn larger than it is, but a
model that stays a share of the picture at any height becomes a block thousands of kilometres across from far up. So the model keeps a fixed size in the world, about 16 km in radius, which is the share ABOVE_MODEL_SHARE
at ABOVE_MODEL_KM: it is never larger than that, falls as one over the height above it, and from MODEL_FADE_FROM_KM is let down smoothly (a smooth step) to nothing at MODEL_FADE_TO_KM, where the satellite is its ordinary mark.
Pure, so a test can ask it at any height.
Import it
import { aboveModelShare } from "@johnmorrisdotca/chikyu-earth/space";
Definition
function aboveModelShare(distanceKm: number, lowest?: number): number
Parameters
| Name | Type | Description |
|---|---|---|
distanceKm | number | The camera's distance from the satellite, in kilometres. |
lowest (optional) | number | The share at the lowest height, |
Returns
number
The share, from 0 to 0.17.
Examples
import { aboveModelShare } from "@johnmorrisdotca/chikyu-earth/space";
console.log(aboveModelShare(150), aboveModelShare(1000) < aboveModelShare(150), aboveModelShare(6000));0.17 true 0What it prints (run when this page was built)