CityFrame型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Where the Earth is on the screen at one draw: the box, the Earth's radius in pixels, and a way to find a place on it.
インポート
import type { CityFrame } from "@johnmorrisdotca/chikyu-earth/realistic";
定義
interface CityFrame {
width: number;
height: number;
radius: number;
project(lon: number, lat: number, out: {
x: number;
y: number;
}): number;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
width | number | |
height | number | |
radius | number | 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 { CityFrame } from "@johnmorrisdotca/chikyu-earth/realistic";
const frame: CityFrame = { width: 400, height: 400, radius: 150, project: (lon, lat, out) => { out.x = 200 + lon; out.y = 200 - lat; return 1; } };
console.log(frame.radius);150出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。