Reference · The Sun, Moon and planets: pure parts
modelMatrixfunction
The 4 by 4 matrix, row by row (what three.js's Matrix4.set takes), that puts a model of radius 1 at a place, turned to the satellite's axes and scaled: its columns are the axes times the scale, then the place.
Import it
import { modelMatrix } from "@johnmorrisdotca/chikyu-earth/space";
Definition
function modelMatrix(place: Vec3, axes: { x: Vec3; y: Vec3; z: Vec3; }, scale: number): number[]
Parameters
| Name | Type | Description |
|---|---|---|
place | Vec3 | Where the model's middle goes, in the scene's units. |
axes | { x: Vec3; y: Vec3; z: Vec3; } | The satellite's axes ( |
scale | number | The model's radius in the scene's units. |
Returns
number[]
Sixteen numbers, row by row.
Examples
import { modelMatrix, satelliteAxes } from "@johnmorrisdotca/chikyu-earth/space";
const axes = satelliteAxes([1.066, 0, 0], [0, 0, -7.66])!;
console.log(modelMatrix([1.066, 0, 0], axes, 0.01));[
0, -0, 0.01, 1.066,
0, 0.01, 0, 0,
-0.01, 0, 0, 0,
0, 0, 0, 1
]What it prints (run when this page was built)