Reference · The realistic Earth's pure parts
tileLevelfunction
The first level to load for a disc: the smallest one whose texels are about a device pixel on the screen, else the finest there is, and none when the whole-Earth picture
(baseWidth across) is already that sharp.
Import it
import { tileLevel } from "@johnmorrisdotca/chikyu-earth/realistic";
Definition
function tileLevel(radiusPx: number, layer: TileLayer, baseWidth: number): number | undefined
Parameters
| Name | Type | Description |
|---|---|---|
radiusPx | number | The disc's radius in device pixels. |
layer | TileLayer | The levels the set has for this layer. |
baseWidth | number | The width of the picture the tiles are laid over, 4096 for the day map. |
Returns
number | undefined
A level in layer, or undefined when no tile is worth loading.
Examples
import { tileLevel, type TileLayer } from "@johnmorrisdotca/chikyu-earth/realistic";
const day: TileLayer = { tileSize: 512, levels: [{ level: 3, width: 8192 }, { level: 4, width: 16384 }] };
console.log(tileLevel(600, day, 4096), tileLevel(1500, day, 4096), tileLevel(9000, day, 4096));undefined 3 4What it prints (run when this page was built)