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 realistic Earth's pure parts

tilesInViewfunction

The tiles of a level that are in view: those with a sampled point inside the box (a little over, so a tile slides in before its edge does), and those under a grid of points across the box. The antimeridian and the poles need nothing special: a tile is tested where it is on the sphere, and a longitude of 180 is the last column.

Import it

import { tilesInView } from "@johnmorrisdotca/chikyu-earth/realistic";

Definition

function tilesInView(level: number, camera: TileCamera, sun?: readonly [number, number, number]): VisibleTile[]

Parameters

NameTypeDescription
levelnumber

A pyramid level.

cameraTileCamera

The camera.

sun (optional)readonly [number, number, number] | undefined

The Sun's direction as the camera sees it (+x right, +y up, +z toward the viewer), to read each tile's ndl; left out, ndl is 1.

Returns

VisibleTile[]

The tiles in view, the nearest to the middle of the box first.

Examples

import { tilesInView } from "@johnmorrisdotca/chikyu-earth/realistic";

const tiles = tilesInView(4, { lon: 179.9, lat: 89, width: 800, height: 600, panX: 0, panY: 0, radius: 3000 });
console.log(tiles.length, tiles[0]);
48 { level: 4, col: 31, row: 0, d: 242.19606186369626, ndl: 1 }

What it prints (run when this page was built)

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