Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

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

NameTypeDescription
awaynumber

The camera's distance from the satellite, in the scene's units.

halfnumber

The tangent of half the field of view.

sharenumber

The share of the view's height that the radius should take (MODEL_RADIUS_SHARE).

realnumber

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.0536007941094272

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.51.1.