Large worlds · function

toRenderSpace

A world position in render space, as single precision.

Explained in Coordinates and units.

function toRenderSpace(worldX: number, worldY: number, worldZ: number, origin: Float64Array, out: Float32Array): void
import { toRenderSpace } from '@driftengine/core';

Parameters

ParameterTypeDescription
worldXnumber
worldYnumber
worldZnumber
originFloat64Array
outFloat32Array

In depth

The subtraction happens in double precision and only the result narrows, which is the whole point: subtracting two large doubles and then narrowing keeps the precision, where narrowing first and subtracting loses it before the subtraction can help.