Taos API Reference
    Preparing search index...

    Class TerrainHeightSampler

    CPU-side terrain elevation lookup for one decoded tile, retained so other content (e.g. buildings) can be clamped to the ground. Keeps the quantized surface u/v/height arrays + triangle indices (the heights are otherwise discarded once baked into the mesh) and buckets the triangles into a uniform SAMPLER_GRID² grid over u/v, so heightAt is ~O(1) per query.

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    rect: Rectangle

    Accessors

    • get bytes(): number

      Retained-array byte footprint, for the cache budget.

      Returns number

    Methods

    • True when (lon, lat) in radians falls within this tile's rectangle.

      Parameters

      • lonRad: number
      • latRad: number

      Returns boolean

    • Ellipsoid-relative terrain height (meters) at (lon, lat) in radians, by locating the containing surface triangle and barycentrically interpolating its quantized heights. Returns null when the point is outside the tile or falls in a gap (no covering triangle).

      Parameters

      • lonRad: number
      • latRad: number

      Returns number | null

    • Bakes this tile's surface triangles into a caller-supplied frame, for building a physics collider from the streamed terrain. toWorld maps a geodetic position (lon, lat in radians, height in meters) to a world point; pass the same geodetic→ECEF→world path the mesh was baked with so the collider lines up with the rendered surface. Returns interleaved xyz positions (one triplet per surface vertex) plus the surface triangle indices — skirt geometry is already excluded, exactly what a collider wants.

      Parameters

      • toWorld: (
            lonRad: number,
            latRad: number,
            height: number,
        ) => { x: number; y: number; z: number }

      Returns { positions: Float32Array; indices: Uint32Array }