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
| Name | Type | Description |
|---|---|---|
level | number | A pyramid level. |
camera | TileCamera | 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 |
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)