import { d } from './index'; /** * Aspect ratio (width / height) from a viewport size, guarded: `x / max(y, 1e-6)`. * * The guard exists because a canvas can report a zero height for one frame during init/resize; * unguarded, that frame renders NaN. 1e-6 is far below any real pixel height, so the guard is * unreachable for every valid viewport — it only replaces division by exactly-or-near zero. */ export declare const aspectOf: import('typegpu').TgpuFn<(viewport: d.Vec2f) => d.F32>; /** * Floored modulo of a scalar: `x - m * floor(x / m)`. Unlike WGSL's `%` (truncated, keeps the * sign of the dividend) this always returns a value in [0, m) for positive `m`, which is what * tiling wants for negative coordinates. */ export declare const flooredMod1: import('typegpu').TgpuFn<(x: d.F32, m: d.F32) => d.F32>; /** * Per-component floored modulo of a vec2 — the tiling primitive. Body is the exact math from * `shaders/HexGrid/index.ts`'s local copy (component-wise, not vector ops) so adopting it emits * an identical body. */ export declare const flooredMod2: import('typegpu').TgpuFn<(p: d.Vec2f, m: d.Vec2f) => d.Vec2f>; /** * Sign-preserving guarded divide: `n / den`, with `den` pushed out to at least 1e-5 in magnitude * on whichever side of zero it already sits. * * Preserving the sign matters — clamping to `max(den, eps)` would flip the quotient's sign for * small negative denominators, which reads as a discontinuity through zero rather than a large * value. 1e-5 is the epsilon the fleet's hand-rolled copies use: small enough that any * geometrically meaningful denominator passes through untouched, large enough that the quotient * stays inside f32 range for UV-scale numerators. * * The parameter is named `den`, not `d` — `d` is the data-schema namespace in kit scope. */ export declare const safeDiv: import('typegpu').TgpuFn<(n: d.F32, den: d.F32) => d.F32>; /** * Rotate a 2D point about the origin by a precomputed cos/sin pair. Takes the pair rather than an * angle so callers that rotate many points (or that already resolved the angle on the CPU) compute * the trig once; for a constant angle it folds to two literals. */ export declare const rotate2: import('typegpu').TgpuFn<(p: d.Vec2f, cosA: d.F32, sinA: d.F32) => d.Vec2f>; /** * Aspect-corrected screen UV, **no Y flip**: `(uv.x * aspect, uv.y)`, with the guarded aspect. * * This is the framing that makes a pattern's cells square: X is stretched into the same units as Y, * so the domain runs `[0, aspect] × [0, 1]` and the canvas centre sits at `(aspect * 0.5, 0.5)`. * * The flip choice is in the name, not an argument — see {@link aspectCorrectedUVFlipY} and the * D-1 note in this file's header. */ export declare const aspectCorrectedUV: import('typegpu').TgpuFn<(uv: d.Vec2f, viewport: d.Vec2f) => d.Vec2f>; /** * Aspect-corrected screen UV **with the Y flip**: `(uv.x * aspect, 1 - uv.y)`, guarded aspect. * * Y-flipping puts the pattern's origin at the bottom-left rather than the top-left, so a row index * of 0 is the bottom row. Sibling generators genuinely disagree about this (Grid and DotGrid flip, * HexGrid and Truchet do not) and both looks are shipped, which is why neither is the default. */ export declare const aspectCorrectedUVFlipY: import('typegpu').TgpuFn<(uv: d.Vec2f, viewport: d.Vec2f) => d.Vec2f>; /** * Recover the authored Y of a position prop: `(p.x, 1 - p.y)`. * * `transformPosition` stores a position as `(x, 1 - y)` so the design editor's top-left origin * round-trips, which means every shader reading a position prop has to undo the flip. This is that * undo, named — the bare `1.0 - center.y` is the single most-copied line in the gradient fleet. */ export declare const unflipPosition: import('typegpu').TgpuFn<(p: d.Vec2f) => d.Vec2f>; /** * A `transformPosition`-stored centre, moved into aspect-corrected space: `(pos.x * aspect, 1 - pos.y)`. * * Combines {@link unflipPosition} with the D-1 center-scaled rule in one step, because that pair is * what a centred generator actually needs. `aspect` is passed in rather than derived so a caller * that scales several centres (MultiPointGradient's five control points) divides once. */ export declare const aspectCentrePosition: import('typegpu').TgpuFn<(pos: d.Vec2f, aspect: d.F32) => d.Vec2f>; /** * Vector from a `transformPosition`-stored centre to a screen UV, both in aspect-corrected space: * `(uv.x * aspect - center.x * aspect, uv.y - (1 - center.y))`. Guarded aspect. * * This is the canonical D-1 delta — the centre is scaled, NOT the UV alone. It is the opening of * every centred field (radial/conic/diamond gradients, spirals): everything downstream is a * function of this delta. */ export declare const aspectCenteredDelta: import('typegpu').TgpuFn<(uv: d.Vec2f, center: d.Vec2f, viewport: d.Vec2f) => d.Vec2f>; /** * Vector from the canvas centre to a screen UV in aspect-corrected space: * `(uv.x * aspect - aspect * 0.5, uv.y - 0.5)`. * * The fixed-centre case of {@link aspectCenteredDelta} (equivalent to passing a centre of * `(0.5, 0.5)`), for the patterns that pivot on the canvas centre and have no centre prop. It takes * `aspect` rather than the viewport because these callers need `aspect` again afterwards — to * un-correct the rotated result, or to size the lattice. */ export declare const canvasCentredDelta: import('typegpu').TgpuFn<(uv: d.Vec2f, aspect: d.F32) => d.Vec2f>; /** * Rotate an ALREADY aspect-corrected UV about the canvas centre `(aspect * 0.5, 0.5)`, by a * precomputed cos/sin pair. * * Rotating about the centre rather than the origin is what makes a `rotation` prop read as "spin * the pattern in place" instead of "swing it off screen". Callers own the sign: negate the angle * before taking cos/sin if positive rotation should read clockwise. * * The centre is derived from `aspect`, so this must be handed a UV in the * {@link aspectCorrectedUV} / {@link aspectCorrectedUVFlipY} framing — not a raw `[0,1]²` UV. */ export declare const rotateAboutCanvasCentre: import('typegpu').TgpuFn<(p: d.Vec2f, aspect: d.F32, cosA: d.F32, sinA: d.F32) => d.Vec2f>; /** * Signed projection of a point onto a direction given as a cos/sin pair: `p.x * cosA + p.y * sinA`. * * The scalar coordinate every directional pattern is a function of — stripe phase, linear-gradient * parameter, chevron axis. One number instead of a rotated vector, so the perpendicular component * is never computed for patterns that do not use it. */ export declare const directionalProjection: import('typegpu').TgpuFn<(p: d.Vec2f, cosA: d.F32, sinA: d.F32) => d.F32>; /** * Cartesian → polar: `(length(p), atan2(p.y, p.x))`. The angle is in radians on `[-π, π]`, zero at * the 3-o'clock position, increasing counter-clockwise in a Y-up frame. * * Returns both components because the callers that want one usually want the other one step later * (a spiral is radius plus angle; a conic band is angle alone). Divide the angle by * `constants.TAU` to get a `[-0.5, 0.5]` turn fraction. */ export declare const toPolar: import('typegpu').TgpuFn<(p: d.Vec2f) => d.Vec2f>; /** * Polar → cartesian: `(r * cos(theta), r * sin(theta))`. The inverse of {@link toPolar}, exact for * any `r >= 0` and `theta` in `[-π, π]`. */ export declare const fromPolar: import('typegpu').TgpuFn<(r: d.F32, theta: d.F32) => d.Vec2f>; //# sourceMappingURL=geom.d.ts.map