本文へ移動

Wakusei Planets惑星

太陽・惑星・衛星を、線画、陰影つきの絵、表面の地図で描きます。実際の大きさ・傾き・自転つきで、任意の日時の衛星の位置も分かります。

「惑星」(わくせい) は、太陽のまわりを回る大きな星のことです。 名前について(英語)

目次

リファレンス · データ・線画・位置

Portrait型

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

A portrait scene: the bodies, back to front, and how they are arranged, sized, lit and drawn. Plain data: keep it, change it by making a new one, and encodeScene it for an address.

インポート

import type { Portrait } from "@johnmorrisdotca/wakusei-planets";

定義

interface Portrait {
    items: Item[];
    layout: "auto" | "manual";
    arrange: Arrange;
    scale: ScaleMode;
    moons: "auto" | "manual";
    look: Look;
    bg: Background;
    aspect: number;
    light: {
        az: number;
        el: number;
    };
    labels: boolean;
    orbits: boolean;
    shadows: boolean;
    date: string | undefined;
    camera: {
        x: number;
        y: number;
        h: number;
    };
}

メンバー

名前型説明
itemsItem[]

Back to front.

layout"auto" | "manual"

auto: the layout places and sizes every body. manual: the positions and sizes below are used as they are.

arrangeArrange
scaleScaleMode
moons"auto" | "manual"

auto: a planet's moons that are in the scene go round it in orbit order. manual: each body is placed by itself.

lookLook
bgBackground
aspectnumber

Width over height.

light{ az: number; el: number; }

Where the Sun is: az clockwise from the top of the picture, el toward the viewer (0 along the page, 90 straight at it), degrees.

labelsboolean
orbitsboolean
shadowsboolean
datestring | undefined

The body as the Earth sees it on this date (ISO), or undefined for a portrait.

camera{ x: number; y: number; h: number; }

The view in a manual layout: the centre and the half-height, in scene units. An automatic layout always fits.

例

import { addBody, defaultPortrait, type Portrait } from "@johnmorrisdotca/wakusei-planets";

const scene: Portrait = addBody(addBody(defaultPortrait(), "jupiter"), "io");
console.log(scene.items.length, scene.layout, scene.scale);
2 auto readable

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

ソースを見るGitHub で編集@johnmorrisdotca/wakusei-planets 0.24.0 のソースから作成しました。

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