.TH "ttypt/chaff.h" 3 "chaff" \" -*- nroff -*- .ad l .nh .SH NAME ttypt/chaff.h \- High-level N-dimensional procedural noise, analytical derivatives, periodic/torus sampling, rotated FBM, and curl-noise flow API\&. .SH SYNOPSIS .br .PP \fR#include \fP .br \fR#include \fP .br .SS "Data Structures" .in +1c .ti -1c .RI "struct \fBchaff_sample_2d_t\fP" .br .ti -1c .RI "struct \fBchaff_sample_3d_t\fP" .br .ti -1c .RI "struct \fBchaff_sample_4d_t\fP" .br .ti -1c .RI "struct \fBchaff_periodic_opts_t\fP" .br .ti -1c .RI "struct \fBchaff_fbm_opts_t\fP" .br .ti -1c .RI "struct \fBchaff_flow_desc_t\fP" .br .ti -1c .RI "struct \fBchaff_flow_2d_t\fP" .br .RI "2D divergence-free curl-noise velocity sample (vx, vy)\&. " .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBCHAFF_DEFAULT_VSHIFT\fP 8u" .br .ti -1c .RI "#define \fBCHAFF_DEFAULT_PERIOD_SHIFT\fP 16u" .br .ti -1c .RI "#define \fBCHAFF_DEFAULT_MIN_SHIFT\fP 2u" .br .ti -1c .RI "#define \fBCHAFF_DEFAULT_BASE_AMP\fP 1" .br .ti -1c .RI "#define \fBCHAFF_DEFAULT_OUT_SHIFT\fP 4u" .br .ti -1c .RI "#define \fBCHAFF_ROT_GOLD_COS_Q15\fP 27874 /***< cos(31\&.717 deg) * 32768 */" .br .ti -1c .RI "#define \fBCHAFF_ROT_SIN\fP CHAFF_ROT_GOLD_SIN_Q15" .br .RI "Default Q15 octave rotation sine constant (golden-ratio rotation)\&. " .in -1c .SS "Functions" .in +1c .ti -1c .RI "static \fBchaff_coord_t\fP \fBchaff_coord_scale\fP (\fBchaff_coord_t\fP c, int scale_power_of_two)" .br .ti -1c .RI "static uint8_t \fBchaff_nyquist_shift_q16\fP (const int32_t step_q16[], uint8_t dim)" .br .ti -1c .RI "static uint32_t \fBchaff_wavelength_weight_q16\fP (int32_t wavelength_q16, int32_t step_q16)" .br .ti -1c .RI "static uint32_t \fBchaff_octave_weight_q16\fP (uint8_t shift, int32_t step_q16)" .br .ti -1c .RI "static uint32_t \fBchaff_band_weight_q16\fP (uint8_t shift, int32_t fine_step_q16, int32_t coarse_step_q16)" .br .ti -1c .RI "static void \fBchaff_fill_lod\fP (const \fBchaff_field_t\fP *field, uint8_t min_shift, const \fBchaff_coord_t\fP origin[], const int32_t step_q16[], const uint16_t n[], int32_t *out, size_t stride, unsigned mode)" .br .ti -1c .RI "static void \fBchaff_band_range_for_step_q16\fP (const \fBchaff_field_t\fP *field, uint8_t min_shift, const int32_t step_q16[], uint8_t *out_lo, uint8_t *out_hi)" .br .ti -1c .RI "static uint32_t \fBchaff_lerp\fP (uint32_t v0, uint32_t v1, uint32_t f, unsigned x)" .br .ti -1c .RI "static void \fBchaff_eval_fade_and_deriv\fP (uint32_t t, uint8_t flags, uint64_t *out_u, uint64_t *out_du)" .br .ti -1c .RI "static \fBchaff_sample_2d_t\fP \fBchaff_sample_grad_2d\fP (const \fBchaff_field_t\fP *field, int16_t wx, int16_t wy)" .br .ti -1c .RI "static \fBchaff_sample_3d_t\fP \fBchaff_sample_grad_3d\fP (const \fBchaff_field_t\fP *field, int16_t x, int16_t y, int16_t z)" .br .ti -1c .RI "static void \fBchaff_fill_slice_3d\fP (const \fBchaff_field_t\fP *field, int16_t z, int16_t origin_x, int16_t origin_y, uint16_t width, uint16_t height, int32_t *out_val, int16_t *out_grad_x, int16_t *out_grad_y)" .br .ti -1c .RI "static \fBchaff_sample_4d_t\fP \fBchaff_sample_grad_4d\fP (const \fBchaff_field_t\fP *field, int16_t x, int16_t y, int16_t z, int16_t w)" .br .ti -1c .RI "static void \fBchaff_fill_slice_4d\fP (const \fBchaff_field_t\fP *field, int16_t z, int16_t w, int16_t origin_x, int16_t origin_y, uint16_t width, uint16_t height, int32_t *out_val, int16_t *out_grad_x, int16_t *out_grad_y, int16_t *out_grad_z, int16_t *out_grad_w)" .br .ti -1c .RI "static void \fBchaff_rot2d_q15\fP (int16_t *x, int16_t *y, int32_t cos_q15, int32_t sin_q15)" .br .ti -1c .RI "static void \fBchaff_rot2d_i32_q15\fP (int32_t *x, int32_t *y, int32_t cos_q15, int32_t sin_q15)" .br .ti -1c .RI "static void \fBchaff_rot2d_i32_q15_4x\fP (int32_t x[4], int32_t y[4], int32_t cos_q15, int32_t sin_q15)" .br .ti -1c .RI "static void \fBchaff_rotate_q15\fP (int16_t *x, int16_t *y)" .br .RI "Rotate 2D int16 coordinates in-place using the default Q15 golden-ratio rotation matrix\&. " .ti -1c .RI "static void \fBchaff_rotate_q15_inplace\fP (int16_t *x, int16_t *y)" .br .RI "Alias of \fBchaff_rotate_q15()\fP for rotating 2D int16 coordinates in-place\&. " .ti -1c .RI "static \fBchaff_sample_2d_t\fP \fBchaff_sample_rugged_2d_ex\fP (const \fBchaff_field_t\fP *field, int16_t wx, int16_t wy, int32_t cos_q15, int32_t sin_q15)" .br .ti -1c .RI "static \fBchaff_sample_2d_t\fP \fBchaff_sample_rugged_2d\fP (const \fBchaff_field_t\fP *field, int16_t wx, int16_t wy)" .br .RI "Sample rugged (slope-damped) 2D multi-octave noise with default damping parameters\&. " .ti -1c .RI "static int16_t \fBchaff_octave_amplitude_ex\fP (uint8_t shift, uint8_t min_shift, int16_t base_amp)" .br .ti -1c .RI "static int16_t \fBchaff_octave_amplitude\fP (uint8_t shift)" .br .RI "Compute default fractal amplitude scaling for octave \fRshift\fP\&. " .ti -1c .RI "static uint32_t \fBchaff_wpoint_periodic_2d_ex\fP (int32_t x, int32_t y, uint8_t shift, uint8_t period_shift, uint8_t vshift, uint32_t seed, unsigned fade_flags)" .br .ti -1c .RI "static uint32_t \fBchaff_wpoint_periodic_2d\fP (int32_t x, int32_t y, uint8_t shift, uint8_t period_shift, uint8_t vshift, uint32_t seed)" .br .RI "Sample a 2D periodic wrapping noise point using default options\&. " .ti -1c .RI "static void \fBchaff_wpoint_periodic_2d_4x\fP (const int32_t x[4], const int32_t y[4], uint8_t shift, uint8_t period_shift, uint8_t vshift, uint32_t seed, uint32_t out[4])" .br .ti -1c .RI "static uint32_t \fBchaff_sample_periodic_2d\fP (int32_t rx, int32_t ry, uint8_t shift, uint8_t period_shift, uint8_t vshift, uint32_t seed)" .br .ti -1c .RI "static uint32_t \fBchaff_sample_periodic_2d_opts\fP (const \fBchaff_periodic_opts_t\fP *opts, int32_t rx, int32_t ry)" .br .RI "Sample a 2D periodic noise value configured via \fBchaff_periodic_opts_t\fP\&. " .ti -1c .RI "static uint32_t \fBchaff_sample_torus_macro\fP (int32_t rx, int32_t ry, uint8_t shift, uint32_t seed)" .br .ti -1c .RI "static uint32_t \fBchaff_sample_mega_2d\fP (int32_t rx, int32_t ry, unsigned shift, unsigned seed)" .br .RI "Sample large-scale 2D macro noise at integer coordinates (\fRrx\fP, \fRry\fP)\&. " .ti -1c .RI "static int32_t \fBchaff_fbm_rotated_2d\fP (const \fBchaff_fbm_opts_t\fP *opts, int32_t x, int32_t y)" .br .ti -1c .RI "static void \fBchaff_fbm_rotated_2d_4x\fP (const \fBchaff_fbm_opts_t\fP *opts, const int32_t x[4], const int32_t y[4], int32_t out[4])" .br .ti -1c .RI "static int32_t \fBchaff_fbm_rotated_2d_ex\fP (int32_t x, int32_t y, uint8_t min_shift, uint8_t max_shift, uint8_t ridged_min_shift, uint8_t amp_min_shift, int16_t base_amp, uint32_t seed, uint32_t seed_salt, int32_t cos_q15, int32_t sin_q15, uint8_t vshift, unsigned fade_flags, uint8_t out_shift)" .br .ti -1c .RI "static int32_t \fBchaff_fbm_rotated_2d_step_q12_4\fP (int32_t x, int32_t y, int32_t step_q16, uint8_t min_shift, uint8_t max_shift, uint8_t ridged_min_shift, uint8_t amp_min_shift, int16_t base_amp, uint32_t seed, uint32_t seed_salt, int32_t cos_q15, int32_t sin_q15)" .br .ti -1c .RI "static void \fBchaff_fbm_rotated_2d_step_q12_4_4x\fP (const int32_t x[4], const int32_t y[4], int32_t step_q16, uint8_t min_shift, uint8_t max_shift, uint8_t ridged_min_shift, uint8_t amp_min_shift, int16_t base_amp, uint32_t seed, uint32_t seed_salt, int32_t cos_q15, int32_t sin_q15, int32_t out[4])" .br .ti -1c .RI "static void \fBchaff_grad_noise2d_4x\fP (const \fBchaff_field_t\fP *field, const int16_t wx[4], const int16_t wy[4], \fBchaff_sample_2d_t\fP out[4])" .br .ti -1c .RI "static int32_t \fBchaff_fbm_rotated_2d_q12_4\fP (int32_t x, int32_t y, uint8_t min_shift, uint8_t max_shift, uint8_t ridged_min_shift, uint8_t amp_min_shift, int16_t base_amp, uint32_t seed, uint32_t seed_salt, int32_t cos_q15, int32_t sin_q15)" .br .ti -1c .RI "static \fBchaff_flow_2d_t\fP \fBchaff_sample_flow_2d\fP (const \fBchaff_field_t\fP *psi_field, const \fBchaff_flow_desc_t\fP *desc, int16_t x, int16_t y, int16_t t)" .br .in -1c .SH "Detailed Description" .PP High-level N-dimensional procedural noise, analytical derivatives, periodic/torus sampling, rotated FBM, and curl-noise flow API\&. \fBttypt/chaff\&.h\fP — Canonical N-Dimensional Procedural Noise, Lattice Stepper, and Multi-Scale Band-Limited LOD API\&. .PP LICENSE: BSD-2-Clause Copyright (c) 2026, tty-pt .PP Direct include for libchaff\&. Provides: .IP "1." 4 Band-limited Nyquist multi-layer region generation (chaff_fill_lod)\&. .IP "2." 4 Analytical 2D/3D/4D spatial gradients and 2D slice stepping\&. .IP "3." 4 Parameterized 2D fixed-point domain rotation (chaff_rot2d_q15)\&. .IP "4." 4 Generic periodic 2D domain sampling (chaff_wpoint_periodic_2d) and monotonic fractal amplitude scaling (chaff_octave_amplitude_ex)\&. .IP "5." 4 Optional header-only GPU shader contract via <\fBttypt/chaff_glsl\&.h\fP>\&. .PP .PP Pure C99, integer-only core, zero floating point, zero game/domain constants\&. .SH "Macro Definition Documentation" .PP .SS "#define CHAFF_DEFAULT_BASE_AMP 1" Default base octave amplitude for fractal amplitude scaling\&. .SS "#define CHAFF_DEFAULT_MIN_SHIFT 2u" Default minimum octave shift for fractal amplitude scaling\&. .SS "#define CHAFF_DEFAULT_OUT_SHIFT 4u" Default fractional output shift for Q12\&.4 rotated FBM accumulators\&. .SS "#define CHAFF_DEFAULT_PERIOD_SHIFT 16u" Default periodic domain shift (2^16 = 65536 cells)\&. .SS "#define CHAFF_DEFAULT_VSHIFT 8u" Default octave value shift (vshift = 8 yields [0\&.\&.255] after >> 16)\&. .SS "#define CHAFF_ROT_GOLD_COS_Q15 27874 /***< cos(31\&.717 deg) * 32768 */" --- Parameterized 2D Fixed-Point Rotation & Anti-Resonance Skew ---------- .SH "Function Documentation" .PP .SS "void chaff_band_range_for_step_q16 (const \fBchaff_field_t\fP * field, uint8_t min_shift, const int32_t step_q16[], uint8_t * out_lo, uint8_t * out_hi)\fR [inline]\fP, \fR [static]\fP" Computes active layer index range [out_lo, out_hi) for a given Q16\&.16 sampling stride and explicit minimum shift cutoff\&. .SS "uint32_t chaff_band_weight_q16 (uint8_t shift, int32_t fine_step_q16, int32_t coarse_step_q16)\fR [inline]\fP, \fR [static]\fP" Complementary scale-space band-pass weight B(2^shift; fine_step, coarse_step) in Q16 [0\&.\&.65536]: B(lambda; Delta_fine, Delta_coarse) = L(lambda, Delta_fine) * (1 - L(lambda, Delta_coarse))\&. Satisfies exact partition of unity: L(lambda, Delta_coarse) + B(lambda; 0, Delta_coarse) == 1\&. .SS "\fBchaff_coord_t\fP chaff_coord_scale (\fBchaff_coord_t\fP c, int scale_power_of_two)\fR [inline]\fP, \fR [static]\fP" Scale fixed-point coordinate: multiplies or divides by 2^scale_power_of_two .SS "void chaff_eval_fade_and_deriv (uint32_t t, uint8_t flags, uint64_t * out_u, uint64_t * out_du)\fR [inline]\fP, \fR [static]\fP" Evaluates intra-cell fade u(t) and analytical derivative u'(t) in Q16 based on field->flags: .IP "\(bu" 2 CHAFF_FLAG_LINEAR: u(t) = t, u'(t) = 1\&.0 .IP "\(bu" 2 CHAFF_FLAG_FADE5: u(t) = t^3(6t^2-15t+10), u'(t) = 30 t^2 (1 - t)^2 .IP "\(bu" 2 Default / FADE: u(t) = t^2(3 - 2t), u'(t) = 6 t (1 - t) .PP .SS "int32_t chaff_fbm_rotated_2d (const \fBchaff_fbm_opts_t\fP * opts, int32_t x, int32_t y)\fR [inline]\fP, \fR [static]\fP" Struct-driven 2D rotated fractal octave accumulator .SS "void chaff_fbm_rotated_2d_4x (const \fBchaff_fbm_opts_t\fP * opts, const int32_t x[4], const int32_t y[4], int32_t out[4])\fR [inline]\fP, \fR [static]\fP" 4-wide SIMD struct-driven 2D rotated fractal octave accumulator\&. Bit-exact with 4 calls to chaff_fbm_rotated_2d(opts, x[i], y[i])\&. .SS "int32_t chaff_fbm_rotated_2d_ex (int32_t x, int32_t y, uint8_t min_shift, uint8_t max_shift, uint8_t ridged_min_shift, uint8_t amp_min_shift, int16_t base_amp, uint32_t seed, uint32_t seed_salt, int32_t cos_q15, int32_t sin_q15, uint8_t vshift, unsigned fade_flags, uint8_t out_shift)\fR [inline]\fP, \fR [static]\fP" Parameterized 2D rotated fractal octave accumulator with configurable vshift, fade_flags, and fixed-point fractional output shift (out_shift = 4 produces Q12\&.4)\&. .SS "int32_t chaff_fbm_rotated_2d_q12_4 (int32_t x, int32_t y, uint8_t min_shift, uint8_t max_shift, uint8_t ridged_min_shift, uint8_t amp_min_shift, int16_t base_amp, uint32_t seed, uint32_t seed_salt, int32_t cos_q15, int32_t sin_q15)\fR [inline]\fP, \fR [static]\fP" Generic 2D rotated fractal octave accumulator in Q12\&.4 fixed-point\&. Evaluates octaves from \fRmax_shift\fP down to \fRmin_shift\fP with C2 quintic fades (NOISE_FADE5), applying ridged multifractal folding on octaves >= \fRridged_min_shift\fP (pass 255 to disable) and rotating coordinates by \fR(cos_q15, sin_q15)\fP between octaves\&. .SS "int32_t chaff_fbm_rotated_2d_step_q12_4 (int32_t x, int32_t y, int32_t step_q16, uint8_t min_shift, uint8_t max_shift, uint8_t ridged_min_shift, uint8_t amp_min_shift, int16_t base_amp, uint32_t seed, uint32_t seed_salt, int32_t cos_q15, int32_t sin_q15)\fR [inline]\fP, \fR [static]\fP" Scale-filtered 2D rotated fractal octave accumulator in Q12\&.4 fixed-point with continuous Nyquist step_q16\&. .SS "void chaff_fbm_rotated_2d_step_q12_4_4x (const int32_t x[4], const int32_t y[4], int32_t step_q16, uint8_t min_shift, uint8_t max_shift, uint8_t ridged_min_shift, uint8_t amp_min_shift, int16_t base_amp, uint32_t seed, uint32_t seed_salt, int32_t cos_q15, int32_t sin_q15, int32_t out[4])\fR [inline]\fP, \fR [static]\fP" 4-wide SIMD scale-filtered 2D rotated fractal octave accumulator in Q12\&.4 fixed-point\&. Bit-exact with 4 calls to chaff_fbm_rotated_2d_step_q12_4\&. .SS "void chaff_fill_lod (const \fBchaff_field_t\fP * field, uint8_t min_shift, const \fBchaff_coord_t\fP origin[], const int32_t step_q16[], const uint16_t n[], int32_t * out, size_t stride, unsigned mode)\fR [inline]\fP, \fR [static]\fP" Band-limited multi-layer region generator\&. Automatically filters out octaves whose wavelength shift is below the maximum of: .IP "1." 4 The explicit \fRmin_shift\fP threshold supplied by the caller, and .IP "2." 4 The continuous Nyquist cutoff shift derived directly from \fRstep_q16\fP\&. .PP .SS "void chaff_fill_slice_3d (const \fBchaff_field_t\fP * field, int16_t z, int16_t origin_x, int16_t origin_y, uint16_t width, uint16_t height, int32_t * out_val, int16_t * out_grad_x, int16_t * out_grad_y)\fR [inline]\fP, \fR [static]\fP" Generic bulk 2D slice stepper across a 3D noise field (e\&.g\&. z = time)\&. For a fixed Z coordinate across an (X, Y) region: .IP "\(bu" 2 Pre-collapses the invariant Z axis once per 3D cell into a 2D quad in registers\&. .IP "\(bu" 2 Evaluates X and Y across the cell using pure integer multiply-adds\&. .IP "\(bu" 2 Produces 100% bit-exact identical values to chaff_sample_grad_3d\&. .IP "\(bu" 2 out_val, out_grad_x, and out_grad_y are optional (can be NULL)\&. .PP Maximum strip width in pixels buffered on stack during slice evaluation\&. .SS "void chaff_fill_slice_4d (const \fBchaff_field_t\fP * field, int16_t z, int16_t w, int16_t origin_x, int16_t origin_y, uint16_t width, uint16_t height, int32_t * out_val, int16_t * out_grad_x, int16_t * out_grad_y, int16_t * out_grad_z, int16_t * out_grad_w)\fR [inline]\fP, \fR [static]\fP" Generic bulk 2D slice stepper across a 4D noise field (e\&.g\&. z = altitude, w = time)\&. For fixed (Z, W) coordinates across an (X, Y) region: .IP "\(bu" 2 Pre-collapses the invariant W (16 -> 8) and Z (8 -> 4) axes once per 4D cell into a 2D quad in registers\&. .IP "\(bu" 2 Evaluates X and Y across the cell using pure integer multiply-adds at 2D cost\&. .IP "\(bu" 2 Produces 100% bit-exact identical values and 4D gradients to chaff_sample_grad_4d\&. .IP "\(bu" 2 out_val and out_grad_* are optional (can be NULL)\&. .PP .SS "void chaff_grad_noise2d_4x (const \fBchaff_field_t\fP * field, const int16_t wx[4], const int16_t wy[4], \fBchaff_sample_2d_t\fP out[4])\fR [inline]\fP, \fR [static]\fP" 4-wide batch 2D analytical gradient noise evaluator\&. Reuses cached 2D lattice corners across lanes sharing a cell (with SIMD 4-corner hash on miss)\&. Bit-exact with 4 calls to chaff_sample_grad_2d(field, wx[i], wy[i])\&. .SS "uint32_t chaff_lerp (uint32_t v0, uint32_t v1, uint32_t f, unsigned x)\fR [inline]\fP, \fR [static]\fP" Exact fixed-point linear interpolation: v0 + (((v1 - v0) * f) >> x) .SS "uint8_t chaff_nyquist_shift_q16 (const int32_t step_q16[], uint8_t dim)\fR [inline]\fP, \fR [static]\fP" Derives the Nyquist minimum wavelength shift directly from a Q16\&.16 sampling stride\&. By the Nyquist-Shannon sampling theorem, an octave with wavelength 2^shift requires a sampling period Delta <= 2^(shift - 1), so min_shift = floor(log2(2 * max_step))\&. .SS "int16_t chaff_octave_amplitude_ex (uint8_t shift, uint8_t min_shift, int16_t base_amp)\fR [inline]\fP, \fR [static]\fP" Parameterized 1/f continuous fractal amplitude scaling (zero switch-ladders): Higher shifts (longer wavelengths) strictly produce higher amplitudes: A(s) = base_amp * 2^((s - min_shift) / 2) using exact integer half-octave steps (1, 1\&.5, 2, 3, 4, 6, 8, \&.\&.\&.)\&. .SS "uint32_t chaff_octave_weight_q16 (uint8_t shift, int32_t step_q16)\fR [inline]\fP, \fR [static]\fP" Continuous C2 Nyquist low-pass weight L(2^shift, Delta) in Q16 [0\&.\&.65536] for dyadic octave \fRshift\fP\&. .SS "void chaff_rot2d_i32_q15 (int32_t * x, int32_t * y, int32_t cos_q15, int32_t sin_q15)\fR [inline]\fP, \fR [static]\fP" Parameterized 2D fixed-point Q15 rotation for int32_t coordinates .SS "void chaff_rot2d_i32_q15_4x (int32_t x[4], int32_t y[4], int32_t cos_q15, int32_t sin_q15)\fR [inline]\fP, \fR [static]\fP" 4-wide SIMD parameterized 2D fixed-point Q15 rotation for int32_t coordinates\&. Bit-exact with 4 calls to chaff_rot2d_i32_q15\&. .SS "void chaff_rot2d_q15 (int16_t * x, int16_t * y, int32_t cos_q15, int32_t sin_q15)\fR [inline]\fP, \fR [static]\fP" Parameterized 2D fixed-point Q15 rotation for int16_t coordinates .SS "\fBchaff_flow_2d_t\fP chaff_sample_flow_2d (const \fBchaff_field_t\fP * psi_field, const \fBchaff_flow_desc_t\fP * desc, int16_t x, int16_t y, int16_t t)\fR [inline]\fP, \fR [static]\fP" Evaluates a divergence-free 2D curl-flow vector field from a 3D streamfunction field Psi(x, y, t): v = v_base + curl(Psi) = (base_vx + dPsi/dy, base_vy - dPsi/dx)\&. Because div(curl(Psi)) = d^2Psi/dxdy - d^2Psi/dydx = 0 identically, the resulting velocity field is guaranteed divergence-free for any streamfunction Psi\&. .SS "\fBchaff_sample_2d_t\fP chaff_sample_grad_2d (const \fBchaff_field_t\fP * field, int16_t wx, int16_t wy)\fR [inline]\fP, \fR [static]\fP" Computes value and analytical surface normal slopes in a single pass\&. Evaluates the exact derivative of the configured fade curve\&. Costs zero additional corner hashes compared to standard evaluation\&. .SS "\fBchaff_sample_3d_t\fP chaff_sample_grad_3d (const \fBchaff_field_t\fP * field, int16_t x, int16_t y, int16_t z)\fR [inline]\fP, \fR [static]\fP" Generic 3D point query with analytical spatial gradient\&. Evaluates value N(x, y, z) and continuous spatial gradient (dN/dx, dN/dy, dN/dz) in a single 8-corner pass using the analytical fade derivative\&. Costs 8 corner hashes instead of 24 hashes from finite differences (3x speedup)\&. .SS "\fBchaff_sample_4d_t\fP chaff_sample_grad_4d (const \fBchaff_field_t\fP * field, int16_t x, int16_t y, int16_t z, int16_t w)\fR [inline]\fP, \fR [static]\fP" Generic 4D point query with analytical spatio-temporal gradient\&. Evaluates value N(x, y, z, w) and continuous 4D gradient (dN/dx, dN/dy, dN/dz, dN/dw) in a single 16-corner pass using the analytical fade derivative\&. Costs 16 corner hashes instead of 64 hashes from finite differences (4x speedup)\&. .SS "uint32_t chaff_sample_periodic_2d (int32_t rx, int32_t ry, uint8_t shift, uint8_t period_shift, uint8_t vshift, uint32_t seed)\fR [inline]\fP, \fR [static]\fP" Parameterized periodic 2D domain sampler with explicit period_shift and vshift\&. Clamps shift to period_shift - 1 so at least 2 lattice cells span the period\&. .SS "\fBchaff_sample_2d_t\fP chaff_sample_rugged_2d_ex (const \fBchaff_field_t\fP * field, int16_t wx, int16_t wy, int32_t cos_q15, int32_t sin_q15)\fR [inline]\fP, \fR [static]\fP" Parameterized rugged point evaluation: rotates octave coordinate systems by (cos_q15, sin_q15) per octave to break power-of-two Cartesian lattice resonance, and inverse-rotates the analytical gradients back into world space via the chain rule (R^l)^T\&. .SS "uint32_t chaff_sample_torus_macro (int32_t rx, int32_t ry, uint8_t shift, uint32_t seed)\fR [inline]\fP, \fR [static]\fP" Convenience wrapper for 16-bit periodic 2D domain (period = 2^16, vshift = 8) .SS "uint32_t chaff_wavelength_weight_q16 (int32_t wavelength_q16, int32_t step_q16)\fR [inline]\fP, \fR [static]\fP" Continuous C2 Nyquist low-pass transfer function L(lambda, Delta) in Q16 [0\&.\&.65536]: .IP "\(bu" 2 For step_q16 <= 0 (point sample): returns 65536 (1\&.0)\&. .IP "\(bu" 2 For wavelength <= 2 * step_q16 (sub-Nyquist): returns 0 (skip evaluation)\&. .IP "\(bu" 2 For wavelength >= 4 * step_q16 (fully resolved): returns 65536 (1\&.0)\&. .IP "\(bu" 2 For 2 * step_q16 < wavelength < 4 * step_q16: smooth C2 quintic transition\&. .PP .SS "void chaff_wpoint_periodic_2d_4x (const int32_t x[4], const int32_t y[4], uint8_t shift, uint8_t period_shift, uint8_t vshift, uint32_t seed, uint32_t out[4])\fR [inline]\fP, \fR [static]\fP" 4-wide SIMD continuous 2D periodic octave sampler (NOISE_FADE5)\&. Bit-exact with 4 calls to chaff_wpoint_periodic_2d(x[i], y[i], \&.\&.\&.)\&. .SS "uint32_t chaff_wpoint_periodic_2d_ex (int32_t x, int32_t y, uint8_t shift, uint8_t period_shift, uint8_t vshift, uint32_t seed, unsigned fade_flags)\fR [inline]\fP, \fR [static]\fP" Evaluates a continuous 2D periodic octave with domain period 2^period_shift and feature cell wavelength 2^shift (where shift <= period_shift)\&. .SH "Author" .PP Generated automatically by Doxygen for chaff from the source code\&.