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

earthHidesfunction

Whether the Earth hides a satellite. The Earth is the unit sphere at the origin. True when the line from the camera to the satellite meets that sphere before it arrives. A graze at the limb is not hidden (the line only touches the sphere), and neither is a satellite in front of the Earth. This is not the test for a satellite behind the camera.

Import it

import { earthHides } from "@johnmorrisdotca/chikyu-earth/space";

Definition

function earthHides(camera: { x: number; y: number; z: number; }, satellite: { x: number; y: number; z: number; }): boolean

Parameters

NameTypeDescription
camera{ x: number; y: number; z: number; }

The camera, in the same units as the sphere (Earth radii).

satellite{ x: number; y: number; z: number; }

The satellite, in those units.

Returns

boolean

True when the globe is in the way.

Examples

import { earthHides } from "@johnmorrisdotca/chikyu-earth/space";

const camera = { x: 0, y: 0, z: 4 };
console.log(earthHides(camera, { x: 0, y: 0, z: 1.2 }));
console.log(earthHides(camera, { x: 0, y: 0, z: -1.2 }));
false
true

What it prints (run when this page was built)

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