/**
 * Heightmap shape, intended primarily for terrain.
 *
 * The shape is a closed solid bounded below by the plane perpendicular to
 * {@link orientation} (the "floor") and above by a height-field surface
 * defined by a {@link Sampler2D}. Heights are sampled with Catmull-Rom
 * filtering ({@link Sampler2D#sampleChannelCatmullRomUV}) — the *same* cubic
 * the terrain renderer uses (`sampleChannelBicubicUV` expands to the
 * identical Catmull-Rom weights, with the matching `u·width − 0.5` UV
 * convention), so the collision and render surfaces coincide at every point
 * they both sample.
 *
 * They differ only in *tessellation density*: the renderer lays out
 * `size × resolution` segments per side, while collision defaults to one
 * quad per sampler cell. {@link tessellation} closes that gap — set it > 1
 * to subdivide each sampler cell into N×N sub-cells so the contact surface
 * approaches render fidelity even when the sampler is deliberately coarse.
 *
 * Local frame layout:
 *   - The orientation vector defines the local "up" axis (unit).
 *   - An orthonormal basis (u, v, n=orientation) is built from it.
 *   - Footprint extends along the basis-u axis over [-size.x/2, +size.x/2]
 *     and along the basis-v axis over [-size.z/2, +size.z/2].
 *   - The surface height (along orientation) at heightmap-UV (u01, v01) is
 *     `sampler.sampleChannelCatmullRomUV(u01, v01, 0)`.
 *   - The solid volume occupies `h ∈ [0, sampledHeight(u01, v01)]` along the
 *     orientation axis, with `0` being the floor at body-local origin.
 *   - `size.y` is the maximum height value of the heightfield (used for the
 *     bounding box). Sampler values are NOT clamped to it.
 *
 * NON-CONVEX. {@link support} throws — GJK/EPA cannot be run against a
 * heightmap directly. The physics narrowphase must dispatch a dedicated
 * grid-traversal path when one of the colliders is a heightmap.
 *
 * @author Alex Goldring
 * @copyright Company Named Limited (c) 2026
 */
export class HeightMapShape3D extends AbstractShape3D {
    /**
     * Convenience constructor.
     * @param {Sampler2D} sampler
     * @param {number} size_x footprint extent along basis-u
     * @param {number} size_y maximum heightmap height (along orientation)
     * @param {number} size_z footprint extent along basis-v
     * @param {Vector3} [orientation] defaults to +Y
     * @param {number} [tessellation] collision sub-cells per sampler cell per
     *   axis; non-negative integer, defaults to 1 (one quad per sampler cell).
     *   See {@link HeightMapShape3D#tessellation}.
     * @returns {HeightMapShape3D}
     */
    static from(sampler: Sampler2D, size_x: number, size_y: number, size_z: number, orientation?: Vector3, tessellation?: number): HeightMapShape3D;
    /**
     * Unit vector defining the local "up" axis (the direction the
     * heightmap's surface faces). Default is +Y.
     * @readonly
     * @type {Vector3}
     */
    readonly orientation: Vector3;
    /**
     * Bounding-box extents in the heightmap-local (u, height, v) frame.
     *   size.x — footprint extent along basis-u (perpendicular to orientation)
     *   size.y — maximum heightmap height (extent along orientation)
     *   size.z — footprint extent along basis-v (perpendicular to orientation)
     * @readonly
     * @type {Vector3}
     */
    readonly size: Vector3;
    /**
     * Sampler holding height values. Float32 backing recommended so the
     * Terrain system's height texture plugs in directly. Single-channel
     * sampler is the common case; only channel 0 is read.
     * @type {Sampler2D | null}
     */
    sampler: Sampler2D | null;
    /**
     * Collision tessellation factor: the narrowphase splits each sampler
     * cell into `tessellation × tessellation` sub-cells before emitting
     * collision triangles, sampling the same Catmull-Rom filter at the
     * finer sub-cell corners. `1` (the default) is one quad per sampler
     * cell — the legacy behaviour. Larger values let a coarse sampler's
     * contact surface approach the rendered mesh's fidelity.
     *
     * Non-negative integer (validated by {@link HeightMapShape3D.from});
     * cost is O(N²) per cell, so the caller owns the fidelity/cost
     * trade-off. `0` yields no collision triangles — the degenerate empty
     * case, mirroring a zero footprint size. Affects only triangle
     * enumeration — the continuous queries ({@link sample_height_at_uv},
     * {@link signed_distance_at_point}, {@link nearest_point_on_surface})
     * read the smooth filter directly and are unaffected.
     * @type {number}
     */
    tessellation: number;
    /**
     * Cached orthonormal basis [u_x,u_y,u_z, v_x,v_y,v_z, n_x,n_y,n_z]
     * built from {@link orientation}. Updated lazily by {@link _ensure_basis}.
     * @private
     * @type {Float64Array}
     */
    private _basis;
    _basis_orientation_x: number;
    _basis_orientation_y: number;
    _basis_orientation_z: number;
    /**
     * Recompute the orthonormal basis (u, v, n) if {@link orientation} changed.
     *
     * Construction chosen so that the default orientation +Y produces the
     * intuitive mapping `u = +X, v = +Z, n = +Y` — i.e. size.x runs along
     * body X, size.z along body Z. We project body +X onto the plane
     * perpendicular to n (the orientation), with a fall-back to projecting
     * body +Z when n is too close to colinear with +X.
     * @private
     */
    private _ensure_basis;
    /**
     * Sample the surface height at heightmap UV coordinates.
     * Uses Catmull-Rom filtering to match the terrain system's geometry construction.
     * @param {number} u01 horizontal UV, in [0, 1]
     * @param {number} v01 vertical UV, in [0, 1]
     * @returns {number} height along orientation axis
     */
    sample_height_at_uv(u01: number, v01: number): number;
    /**
     * Project a body-local position to the surface and sample the height there.
     * The returned height is in the orientation-axis direction.
     * Positions outside the footprint sample the clamped UV (sampler clamps).
     * @param {number} px body-local x
     * @param {number} py body-local y
     * @param {number} pz body-local z
     * @returns {number}
     */
    sample_height_at_position(px: number, py: number, pz: number): number;
    compute_bounding_box(result: any): void;
    contains_point(point: any): boolean;
    /**
     * Approximate signed distance: difference between the point's height
     * (along orientation) and the surface height sampled at the point's
     * footprint UV. POSITIVE = above surface, NEGATIVE = below.
     *
     * Locally correct when the surface is flat; biased when the surface
     * has significant slope. Sufficient for cling/raycast queries that
     * walk down to the surface.
     */
    signed_distance_at_point(point: any): number;
    /**
     * Project a reference point onto the surface along the orientation axis.
     * The footprint UV is clamped, so points outside the footprint produce
     * the nearest edge-of-footprint surface sample (approximate).
     */
    nearest_point_on_surface(result: any, reference: any): void;
    /**
     * Heightmaps are non-convex; GJK/EPA cannot work against them directly.
     * The physics narrowphase must dispatch a grid-traversal path that
     * decomposes the heightmap into per-cell triangle pairs and tests each
     * against the other shape (analogous to Bullet's btHeightfieldTerrainShape
     * × btConcaveShape interface).
     *
     * This throws rather than returning a degenerate result so the call
     * site is forced to handle heightmaps explicitly.
     */
    support(result: any, result_offset: any, direction_x: any, direction_y: any, direction_z: any): void;
    sample_random_point_in_volume(result: any, result_offset: any, random: any): void;
    /**
     * @param {HeightMapShape3D} other
     * @returns {boolean}
     */
    equals(other: HeightMapShape3D): boolean;
    /**
     * Fast type-check marker, matching the pattern on every other concrete
     * AbstractShape3D subclass. The physics narrowphase reads this to dispatch
     * the heightmap-vs-X grid-traversal path.
     * @readonly
     * @type {boolean}
     */
    readonly isHeightMapShape3D: boolean;
}
import { AbstractShape3D } from "./AbstractShape3D.js";
import { Vector3 } from "../../Vector3.js";
//# sourceMappingURL=HeightMapShape3D.d.ts.map