Reference · The Sun, Moon and planets: pure parts
modelRadiusfunction
The radius to draw a model at so that it is share of the height of the view across its radius, seen from away with the half field of view half (the tangent of half the field, as the view uses it): the model grows with the distance, so it reads
at any distance the camera keeps. Never under real, its true size, so a camera that comes in close still sees it as big as it is.
Import it
import { modelRadius } from "@johnmorrisdotca/chikyu-earth/space";
Definition
function modelRadius(away: number, half: number, share: number, real: number): number
Parameters
| Name | Type | Description |
|---|---|---|
away | number | The camera's distance from the satellite, in the scene's units. |
half | number | The tangent of half the field of view. |
share | number | The share of the view's height that the radius should take ( |
real | number | The model's true radius, in the same units. |
Returns
number
The radius to draw it at.
Examples
import { MODEL_RADIUS_SHARE, modelRadius } from "@johnmorrisdotca/chikyu-earth/space";
console.log(modelRadius(0.5, Math.tan((35 / 2) * (Math.PI / 180)), MODEL_RADIUS_SHARE, 1e-8));0.0536007941094272What it prints (run when this page was built)