import type { Vec2, Vec2Like } from './types'; /** Create a Vec2 (zero vector by default). */ export declare function create(x?: number, y?: number): Vec2; /** Allocate a new Vec2 copy. Difference from copy: clone allocates, copy writes into an existing out. */ export declare function clone(a: Vec2Like): Vec2; /** out = a. Returns out. aliasing-safe (copy(v, v) is a no-op). */ export declare function copy(out: Vec2, a: Vec2Like): Vec2; /** Write the components and return out. */ export declare function set(out: Vec2, x: number, y: number): Vec2; /** * Approximate equality: every component differs by ≤ epsilon. NaN inputs always return false (matches IEEE 754). */ export declare function equals(a: Vec2Like, b: Vec2Like, epsilon?: number): boolean; /** out = a + b. aliasing-safe. */ export declare function add(out: Vec2, a: Vec2Like, b: Vec2Like): Vec2; /** out = a - b. aliasing-safe. */ export declare function sub(out: Vec2, a: Vec2Like, b: Vec2Like): Vec2; /** out = a * s. */ export declare function scale(out: Vec2, a: Vec2Like, s: number): Vec2; /** out = -a. The `0 - x` form avoids -0 (test toBe(0) uses Object.is and distinguishes ±0). */ export declare function negate(out: Vec2, a: Vec2Like): Vec2; /** Dot product a · b. */ export declare function dot(a: Vec2Like, b: Vec2Like): number; /** Squared length |a|² (avoids sqrt overhead; useful on hot paths comparing distances). */ export declare function lengthSq(a: Vec2Like): number; /** Euclidean length |a|. */ export declare function length(a: Vec2Like): number; /** Distance between two points |a - b|. */ export declare function distance(a: Vec2Like, b: Vec2Like): 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 * vec2.normalize(out, [3, 4]); // → (0.6, 0.8) * vec2.normalize(out, [0, 0]); // → (0, 0) zero vector falls back (no NaN; AC-06 no throw) * vec2.normalize(out, [NaN, 1]); // → (NaN, NaN) IEEE-754 propagation * ``` */ export declare function normalize(out: Vec2, a: Vec2Like): Vec2; /** out = lerp(a, b, t). t is not clamped (extrapolation semantics matches glam / wgpu-matrix). aliasing-safe. */ export declare function lerp(out: Vec2, a: Vec2Like, b: Vec2Like, t: number): Vec2; /** * 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` (1st-order decay, NOT Unity * `SmoothDamp`'s 2nd-order spring). `dt=0` → out=current; large `decayRate·dt` → out≈target. * Frame-rate independent by construction (one `dt` step = two composed `dt/2` steps). aliasing-safe. * See vec3.smoothDamp for the full contract. */ export declare function smoothDamp(out: Vec2, current: Vec2Like, target: Vec2Like, decayRate: number, dt: number): Vec2; /** * 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 default). Interpolates the control points * (`t=0` → `p1`, `t=1` → `p2`). See vec3.catmullRom for the full contract + whole-polyline * sampling. aliasing-safe. */ export declare function catmullRom(out: Vec2, p0: Vec2Like, p1: Vec2Like, p2: Vec2Like, p3: Vec2Like, t: number): Vec2; /** Component-wise min. */ export declare function min(out: Vec2, a: Vec2Like, b: Vec2Like): Vec2; /** Component-wise max. */ export declare function max(out: Vec2, a: Vec2Like, b: Vec2Like): Vec2; /** * out = perp(a) — 2D counter-clockwise 90° rotation: (x, y) → (-y, x). * * Derives from cross(a, b) reducing to a scalar determinant in 2D; this API serves hot paths * (collision / normals). * aliasing-safe: reads a's components into locals before writing out. */ export declare function perp(out: Vec2, a: Vec2Like): Vec2; //# sourceMappingURL=vec2.d.ts.map