本文へ移動

Chikyu Earth地球

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

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

目次

リファレンス · 太陽、月、惑星: 計算部分

earthHides関数

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

Whether the Earth hides a satellite. The Earth is the unit sphere at the origin. True when the line from the camera to the satellite meets that sphere before it arrives. A graze at the limb is not hidden (the line only touches the sphere), and neither is a satellite in front of the Earth. This is not the test for a satellite behind the camera.

インポート

import { earthHides } from "@johnmorrisdotca/chikyu-earth/space";

定義

function earthHides(camera: { x: number; y: number; z: number; }, satellite: { x: number; y: number; z: number; }): boolean

引数

名前型説明
camera{ x: number; y: number; z: number; }

The camera, in the same units as the sphere (Earth radii).

satellite{ x: number; y: number; z: number; }

The satellite, in those units.

戻り値

boolean

True when the globe is in the way.

例

import { earthHides } from "@johnmorrisdotca/chikyu-earth/space";

const camera = { x: 0, y: 0, z: 4 };
console.log(earthHides(camera, { x: 0, y: 0, z: 1.2 }));
console.log(earthHides(camera, { x: 0, y: 0, z: -1.2 }));
false
true

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

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

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