本文へ移動

Hoshi Stars星

肉眼で見える星の名前・色・距離、88星座の線と境界、メシエ天体、そしてそれらを描くための7種類の図法を使えます。

「星」(ほし) は、夜空に光って見えるものです。 名前について(英語)

目次

リファレンス · 天の川 (明るさの地図と、描くための帯)

milkyWayTexture関数

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

The Milky Way painted as a texture for a WebGL sky (or a canvas): a picture twice as wide as it is high covering the whole sky, coloured from the brightness grid by a ramp. It is read with detail (1 by default, see MilkyWayDetailOptions), so the dust lanes (the Great Rift, the Coalsack, the Cygnus Rift) are sharper than the plain grid gives them. Made from the package's numbers alone: no photograph is read. Pure: it returns new pixels and keeps nothing but the grid it unpacks once.

Seen from inside a sphere, the sky runs the other way round from a map: give a sphere this texture with its across direction flipped (in three.js, texture.wrapS = RepeatWrapping and texture.repeat.x = -1), or turn the sphere inside out by scaling it by -1 across.

インポート

import { milkyWayTexture } from "@johnmorrisdotca/hoshi-stars/milky-way";

定義

function milkyWayTexture(options?: MilkyWayTextureOptions): MilkyWayTexturePixels

引数

名前型説明
options (省略可)MilkyWayTextureOptions

width (default 2048), frame (equatorial, the default, or galactic), detail (0 to 2, default 1) and ramp (default MILKY_WAY_NIGHT_RAMP).

戻り値

MilkyWayTexturePixels

The pixels.

例

import { milkyWayTexture } from "@johnmorrisdotca/hoshi-stars/milky-way";

const { width, height, data } = milkyWayTexture({ width: 2048 });
// a canvas: context.putImageData(new ImageData(data, width, height), 0, 0)
// three.js: new DataTexture(data, width, height) with flipY true, colorSpace SRGBColorSpace and needsUpdate true
console.log(width, height); // 2048 1024
2048 1024

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

ソースを見るGitHub で編集@johnmorrisdotca/hoshi-stars 0.47.0 のソースから作成しました。

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