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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。