本文へ移動

Chikyu Earth地球

世界の国の輪郭を線で描いた地球儀です。地球と同じ速さで回ります。宇宙から見たような地球と、好きな場所の目印も使えます。

「地球」(ちきゅう) は、私たちが住む星の名前です。 名前について(英語)

目次

リファレンス · リアルな地球の計算部分

tileLevel関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 { tileLevel } from "@johnmorrisdotca/chikyu-earth/realistic";

定義

function tileLevel(radiusPx: number, layer: TileLayer, baseWidth: number): number | undefined

引数

名前型説明
radiusPxnumber

The disc's radius in device pixels.

layerTileLayer

The levels the set has for this layer.

baseWidthnumber

The width of the picture the tiles are laid over, 4096 for the day map.

戻り値

number | undefined

A level in layer, or undefined when no tile is worth loading.

例

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 4

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/chikyu-earth 0.51.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。