import type { Vec3, Vec3Like } from './types'; export type { Vec3, Vec3Like }; /** Create a Vec3 (zero vector by default). */ export declare function create(x?: number, y?: number, z?: number): Vec3; /** Allocate a new Vec3 copy. */ export declare function clone(a: Vec3Like): Vec3; /** out = a. aliasing-safe (copy(v, v) is a no-op). */ export declare function copy(out: Vec3, a: Vec3Like): Vec3; /** Write the components and return out. */ export declare function set(out: Vec3, x: number, y: number, z: number): Vec3; /** * Approximate equality: every component differs by ≤ epsilon. NaN inputs always return false (IEEE 754). */ export declare function equals(a: Vec3Like, b: Vec3Like, epsilon?: number): boolean; /** out = a + b. aliasing-safe. */ export declare function add(out: Vec3, a: Vec3Like, b: Vec3Like): Vec3; /** out = a - b. aliasing-safe. */ export declare function sub(out: Vec3, a: Vec3Like, b: Vec3Like): Vec3; /** out = a * s. */ export declare function scale(out: Vec3, a: Vec3Like, s: number): Vec3; /** out = -a. */ export declare function negate(out: Vec3, a: Vec3Like): Vec3; /** Dot product a · b. */ export declare function dot(a: Vec3Like, b: Vec3Like): number; /** out = a × b (cross product). aliasing-safe (reads all 6 components into locals first). */ export declare function cross(out: Vec3, a: Vec3Like, b: Vec3Like): Vec3; /** Squared length |a|² (avoids sqrt overhead). */ export declare function lengthSq(a: Vec3Like): number; /** Euclidean length |a|. */ export declare function length(a: Vec3Like): number; /** Distance between two points |a - b|. */ export declare function distance(a: Vec3Like, b: Vec3Like): number; /** Squared distance between two points |a - b|² (avoids sqrt overhead). */ export declare function distanceSq(a: Vec3Like, b: Vec3Like): number; /** * out = a / |a| (unit-length). * * @degrade Zero vector (|a|² < EPS_NORMALIZE) silently falls back to the zero vector; * no NaN, no throw (gl-matrix style, AC-06 / D-P12). * @degrade NaN inputs → NaN outputs: when a component is NaN, lenSq=NaN; the `lenSq < EPS` * branch is false → goes through 1/sqrt(NaN)=NaN → output is all NaN (IEEE-754 NaN propagation; * still does not throw). * * @example * ```ts * vec3.normalize(out, [3, 0, 4]); // → (0.6, 0, 0.8) * vec3.normalize(out, [0, 0, 0]); // → (0, 0, 0) zero vector falls back (AC-06 no throw) * vec3.normalize(out, [NaN, 1, 0]); // → (NaN, NaN, NaN) IEEE-754 propagation * ``` */ export declare function normalize(out: Vec3, a: Vec3Like): Vec3; /** out = lerp(a, b, t). t is not clamped (extrapolation semantics). aliasing-safe. */ export declare function lerp(out: Vec3, a: Vec3Like, b: Vec3Like, t: number): Vec3; /** * out = frame-rate-INDEPENDENT exponential smoothing of `current` toward `target`: * `lerp(current, target, 1 − exp(−decayRate · dt))`. Semantics match Bevy * `StableInterpolate::smooth_nudge` / three.js `MathUtils.damp` — NOT Unity `Vector3.SmoothDamp` * (which is a 2nd-order critically-damped spring needing a velocity ref; this is 1st-order decay). * * `decayRate` is the exponential decay constant (1/s), meant to stay fixed while `dt` is per-frame; * a good anchor is `decayRate = ln(2)/halfLife`. `dt=0` → out=current (no move); large `decayRate·dt` * → out≈target; `decayRate=0` → out=current. Frame-rate independent by construction: one step of `dt` * equals two composed steps of `dt/2` — unlike the naive `lerp(current, target, rate·dt)`, which * behaves differently per frame rate and overshoots when `rate·dt > 1`. aliasing-safe. */ export declare function smoothDamp(out: Vec3, current: Vec3Like, target: Vec3Like, decayRate: number, dt: number): Vec3; /** * out = Catmull-Rom spline point on the segment between `p1` and `p2`, with `p0` / `p3` the * neighbor control points setting the endpoint tangents (tension 0.5 — the Bevy * `CubicCardinalSpline::new_catmull_rom` / Three.js explicit `catmullrom` mode). * This is uniform; Three.js defaults to centripetal. Interpolates * the control points: `t=0` → `p1`, `t=1` → `p2`. Unlike `lerp` (a straight segment), this is * the smooth cubic through the points — use it for camera paths, animation ease paths, or * procedural curve geometry. To sample a whole polyline, loop the segments with a sliding * 4-point window `[pts[i-1], pts[i], pts[i+1], pts[i+2]]` (clamp/duplicate ends). `t` is not * clamped (extrapolation follows the same cubic). aliasing-safe. */ export declare function catmullRom(out: Vec3, p0: Vec3Like, p1: Vec3Like, p2: Vec3Like, p3: Vec3Like, t: number): Vec3; /** Component-wise min. */ export declare function min(out: Vec3, a: Vec3Like, b: Vec3Like): Vec3; /** Component-wise max. */ export declare function max(out: Vec3, a: Vec3Like, b: Vec3Like): Vec3; //# sourceMappingURL=vec3.d.ts.map