Skip to main content

Function: heightAtLocalX()

heightAtLocalX(curvePoints, localX): number

Defined in: rendering/terrain/terrain-curve.ts:105

Finds a curve's surface height (local-space y) at a given local-space x, linearly interpolating between the two bracketing sampled points. curvePoints must be ordered by strictly increasing x (as returned by buildTerrainCurve).

Parameters

curvePoints

readonly TerrainCurvePoint[]

The dense curve to search. Must contain at least 1 point.

localX

number

The local-space x to find the height at.

Returns

number

The interpolated local-space y at localX.

Throws

An error if curvePoints is empty.