Reference · The realistic Earth's pure parts
gridTilesInViewfunction
The tiles of one level of a source's own grid that are in view. Only the columns and rows under the box are tested, so a fine matrix (hundreds of columns) is not walked. A tile that misses the Earth is left out.
Import it
import { gridTilesInView } from "@johnmorrisdotca/chikyu-earth/realistic";
Definition
function gridTilesInView(level: MapGridLevel, extent: MapGrid["extent"], camera: TileCamera, sun?: readonly [number, number, number]): VisibleTile[]
Parameters
| Name | Type | Description |
|---|---|---|
level | MapGridLevel | A level of the source's grid. |
extent | { west: number; south: number; east: number; north: number; } | The Earth's extent, from the same grid. |
camera | TileCamera | The camera. |
sun (optional) | readonly [number, number, number] | undefined | The Sun's direction as the camera sees it, for each tile's |
Returns
VisibleTile[]
The tiles in view, the nearest to the middle of the box first.
Examples
import { gibsGrid } from "@johnmorrisdotca/chikyu-earth/door";
import { gridTilesInView } from "@johnmorrisdotca/chikyu-earth/realistic";
const grid = gibsGrid("250m");
console.log(gridTilesInView(grid.levels[6]!, grid.extent, { lon: 0, lat: 0, width: 800, height: 600, panX: 0, panY: 0, radius: 8000 }).length > 0);trueWhat it prints (run when this page was built)