本文へ移動

Chikyu Earth地球

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

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

目次

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

CountryFrame型

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

Where the Earth is on the screen at one draw: the frame the city names use, and the Earth's disc (its middle and radius in CSS pixels), which no name may leave.

インポート

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

定義

interface CountryFrame extends CityFrame {
    disc?: {
        x: number;
        y: number;
        radius: number;
    };
}

メンバー

名前型説明
disc (省略可){ x: number; y: number; radius: number; } | undefined
widthnumber
heightnumber
radiusnumber

The Earth's radius on the screen, in CSS pixels.

project(lon: number, lat: number, out: { x: number; y: number; }): number

Writes where a place falls in the box and answers how squarely it faces the viewer: the cosine of the angle between the ground's upward and the line to the viewer, above 0 in sight, 1 at the middle of the disc.

例

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

const frame: CountryFrame = { width: 400, height: 400, radius: 150, disc: { x: 200, y: 200, radius: 150 }, project: (lon, lat, out) => { out.x = 200 + lon; out.y = 200 - lat; return 1; } };
console.log(frame.disc?.radius);
150

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

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

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