No description in source JSDoc. (CubicBezier) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. Returns: } Distance to multiple Bezier curves (smooth union) Parameters: (number[]) — No description in source JSDoc. (CubicBezier[]) — No description in source JSDoc. (number) — No description in source JSDoc. Smooth minimum of two distances (for blending) Parameters: (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — Smoothness factor Distance to curves with smooth blending Parameters: (number[]) — No description in source JSDoc. (CubicBezier[]) — No description in source JSDoc. (number) — No description in source JSDoc. Prepare curve data for GPU upload Format: 4 vec4s per curve = 64 bytes [p0.xyz, 0] [p1.xyz, 0] [p2.xyz, 0] [p3.xyz, radius] Parameters: (CubicBezier[]) — No description in source JSDoc. Pre sample curves into line segments for GPU More efficient for many queries Parameters: (CubicBezier[]) — No description in source JSDoc. (number) — No description in source JSDoc. Returns: } <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


alphaBlend(backdrop, source, opacity = 1)

premultipliedAlphaBlend(backdrop, source, opacity = 1)

blendModeChannel(backdrop, source, mode = 'normal')

blendRgb(backdrop, source, mode = 'normal')

blendCompositeStraight(backdrop, source, mode = 'normal', opacity = 1)

coverageAlpha(coveredSamples, sampleCount = 1)

ditherAlpha(alpha, x = 0, y = 0, frame = 0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


bufferRangeReport(data, byteOffset = 0, byteLength = 0, options = {})

bufferRead(data, type, byteOffset, options = {})

bufferWrite(data, type, byteOffset, value, options = {})

bufferReadUtf8(data, byteOffset, byteLength, options = {})

bufferWriteUtf8(data, byteOffset, text, options = {})

createBufferCursor(dataOrByteLength, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: BufferMath.js reusable byte views, endian safe DataView reads/writes, UTF 8 helpers, and cursors. Classes Method Signature Summary Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


channelCenterFromIndex(index, options = {})

channelIndexFromCenterReport(centerHz, options = {})

wifi24ChannelReport(channelNumber, options = {})

channelBandMembershipReport(channel, bands = [], options = {})

channelGuardBandReport(aChannel, bChannel, options = {})

channelHopsetReport(channels = [], options = {})

channelInterferenceReport(candidateChannel, interferers = [], options = {})

channelPlanReport(candidates = [], interferers = [], options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ChannelMath.js reusable channel geometry, spacing, hopset, and planning reports. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


fnv1a32(data, seed = FNV1A32OFFSETBASIS)

fnv1a64(data, seed = FNV1A64OFFSETBASIS)

fnv1aStringCodeUnit32(data, options = {})

fnv1aStringCodePointHead32(data, options = {})

fnv1aLowByteString32(data, options = {})

fnv1aTaggedFloat32Sequence32(values, options = {})

fnv1aTaggedUint32Sequence32(values, options = {})

legacyAvalancheMixUint32Hash32(hash, value, multiplier = 0x9e3779b1)

fnv1aUint32Sequence32(values, options = {})

fnv1aInt32Sequence32(values, options = {})

legacyFnv1aByteSequenceHash32(data, options = {})

legacyFnv1aNumberSequenceHash32(values, seed = FNV1A32OFFSETBASIS)

legacyFnv1aStringHash32(data, seed = FNV1A32OFFSETBASIS)

legacyDjb2XorStringHash32(data, seed = 5381)

legacyUnsignedStringHash31(data, seed = 0)

legacyScaledNumberSequenceHash32(values, options = {})

bufferHash(data, algorithm = CHECKSUMALGORITHMS.crc32)

rollingHash32(data, windowSize, options = {})

async contentHashBytes(data, algorithm = CHECKSUMALGORITHMS.sha256)

async contentHashHex(data, algorithm = CHECKSUMALGORITHMS.sha256)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ChecksumMath.js reusable byte checksums, non crypto hashes, rolling hashes, and digest wrappers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


compressionRunLengthReport(values, options = {})

compressionDeltaReport(values, options = {})

compressionPaletteReport(values, options = {})

compressionVarintReport(values, options = {})

compressionEntropyPlan(data, options = {})

compressionHuffmanLengthReport(values, options = {})

compressionRangeModelReport(values, options = {})

compressionDictionaryMatchReport(values, options = {})

compressionPrimitivePlan(values, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: CompressionMath.js pure compression primitive reports and planning helpers. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


renoSlowStartIncreaseBytes(acknowledgedBytes, smssBytes = CONGESTIONDEFAULTMAXDATAGRAMBYTES)

renoCongestionAvoidanceIncreaseBytes(congestionWindowBytes, smssBytes = CONGESTIONDEFAULTMAXDATAGRAMBYTES)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: CongestionMath.js reusable congestion window, pacing, Reno, QUIC, and CUBIC report helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


constraintNormalizeAngle(angle, options = {})

constraintAngularLimitReport(angle, lowerLimit, upperLimit, options = {})

constraintAxisStateReport(value, options = {})

constraintConeLimitReport(swingY, swingZ, limitY, limitZ, options = {})

constraintSwingTwistLimitReport(rotation, twistAxis = [1, 0, 0], options = {})

constraintMotorTargetErrorReport(current, target, options = {})

constraintJointProjectionErrorReport(frameA = {}, frameB = {}, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ConstraintMath.js pure joint limit, drive, spring, and projection reports. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


domRectNormalize(rect = {}, options = {})

domMatrixTransformPoint(point, matrixInit = IDENTITYCOLUMNMAJOR4)

domRectTransformBounds(rect, matrixInit = IDENTITYCOLUMNMAJOR4, options = {})

domQuadBoundsReport(quad = {}, options = {})

domQuadTransformBounds(quad = {}, matrixInit = IDENTITYCOLUMNMAJOR4, options = {})

canvasBackingStoreReport(cssWidth, cssHeight, devicePixelRatio = 1, options = {})

domScrollCoordinateReport(point = {}, viewport = {}, options = {})

canvasPointerCssPoint(event = {}, rect = {}, options = {})

canvasPointerWorldPoint(event = {}, rect = {}, matrixInit = IDENTITYCOLUMNMAJOR4, options = {})

canvasPointerDevicePoint(event = {}, rect = {}, canvasOrScale = {}, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: DOMGeometryMath.js DOMPoint, DOMRect, DOMMatrix, and canvas coordinate helpers. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


mat4PerspectiveRad(fovRad, aspect, near, far)

mat4PerspectiveRadWebGPU(fovRad, aspect, near, far)

mat4PerspectiveDeg(fovDeg, aspect, near, far)

mat4PerspectiveDegWebGPU(fovDeg, aspect, near, far)

mat4Orthographic(left, right, bottom, top, near, far)

mat4OrthographicWebGPU(left, right, bottom, top, near, far)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: EngineMath basic 3D vector and matrix helpers shared across engine and tests Pure math, no rendering or platform side effects. Functions Re exports , , , , , , , , , <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


filterKernelReport(kernel, options = {})

normalizeFilterKernel(kernel, targetSum = 1, options = {})

boxFilterKernel1D(radius = 1, options = {})

gaussianFilterKernel1D(radius = 1, sigma = null)

gaussianFilterKernel2D(radius = 1, sigma = null)

filterSignalFIR(signal, kernel, options = {})

filterSignalMedian(signal, windowSize = 3)

filterSignalTemporalSmooth(signal, alpha = 0.5)

filterSignalNoiseReduce(signal, options = {})

filterImageConvolutionRgba(image, kernelSpec, options = {})

filterImageMorphologyRgba(image, operator = 'dilate', radius = 1, options = {})

filterImageDilateRgba(image, radius = 1, options = {})

filterImageErodeRgba(image, radius = 1, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: FilterMath.js reusable filter kernel, signal FIR, and CPU RGBA convolution helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


formatMimeFromExtension(pathOrExtension, fallback = DEFAULTMIMETYPE)

formatAcceptMatchReport(file, accept, options = {})

formatAcceptHeaderReport(acceptHeader, offeredMimeTypes, options = {})

semanticVersionRangeReport(version, range = '')

formatCompatibilityReport(candidate, requirements = {}, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: FormatMath.js reusable signatures, MIME helpers, SemVer, text ranges, token cursors, and chunk tables. Classes Method Signature Summary Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


frameDifferenceReport(referenceFrame, candidateFrame, options = {})

frameMotionMagnitudeMap(referenceFrame, candidateFrame, options = {})

frameResidualImage(referenceFrame, candidateFrame, options = {})

frameSceneChangeReport(referenceFrame, candidateFrame, options = {})

frameKeyframeScoreReport(referenceFrame, candidateFrame, options = {})

frameSequenceDifferenceReport(frames, options = {})

runtimeFrameDeltaSeconds(timestampMs, previousTimestampMs, maxDeltaSeconds = 0.1)

runtimeMonotonicClockStep(timestampMs, previousTimestampMs = 0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: FrameMath.js pure ImageData like frame and temporal media math helpers. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


imagePixelOffset(width, x, y, options = {})

imageReadPixel(image, x, y, options = {})

imageWritePixel(image, x, y, rgba, options = {})

imageSampleNearest(image, x, y, options = {})

imageSampleBilinear(image, x, y, options = {})

imageCopyRect(image, rect = {}, options = {})

imageSwizzleRgba(image, order = [0, 1, 2, 3], options = {})

imagePremultiplyAlpha(image, options = {})

imageUnpremultiplyAlpha(image, options = {})

imageHistogramReport(image, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ImageMath.js deterministic RGBA/ImageData pixel helpers. These helpers intentionally operate on ImageData like objects or raw RGBA array data. They do not construct browser ImageData, canvas, bitmap, or GPU resources, so they remain safe for workers and deterministic tests. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


inputAxisRemapReport(axis, options = {})

inputRadialDeadzoneReport(axes, options = {})

inputPressureCurve(pressure, options = {})

inputPressureReport(samples, options = {})

pointerTiltToAltitudeAzimuth(tiltX = 0, tiltY = 0)

pointerAltitudeAzimuthToTilt(altitudeAngle = HALFPI, azimuthAngle = 0)

inputSampleVelocityReport(samples, options = {})

smoothInputSamples(samples, options = {})

predictInputSample(samples, lookaheadMs = 16.6666666667, options = {})

blendInputSamples(leftSample, rightSample, amount = 0.5, options = {})

inputStrokeStabilizationReport(samples, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: InputSignalMath.js pure pointer/stylus sample shaping, smoothing, and prediction helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


jitterQualityScore(jitterMs, options = {})

packetDelayVariationReport(samplesMs = [], options = {})

rtpJitterUpdateReport(previous = null, packet = {}, options = {})

rtpJitterReport(packets = [], options = {})

adaptiveJitterEstimateUpdate(previous = {}, intervalMs, options = {})

peerRttJitterReport(rttSamplesMs = [], options = {})

webRtcJitterBufferReport(stats = {}, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: JitterMath.js packet delay variation, RTP/WebRTC jitter, and adaptive buffer reports. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/math/LineToVoxel.js
Classes
class NetworkNode
class NetworkEdge
class LineNetwork
class LineToVoxelizer
class GPULineVoxelizer
Functions
generateTree(options = {})
generateRoots(options = {})
generateTunnel(options = {})
Constants
Notes & Examples
Math Library Conventions

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Node in a line network (branch point or endpoint) Method Signature Summary Edge connecting two nodes Method Signature Summary Network of connected curves for voxelization Method Signature Summary Add a node to the network Connect two nodes with a curve Build Bezier curves from network Get all curves (builds if dirty) Compute distance from point to network Get bounding box of network Convert line network to voxel density field Method Signature Summary Generate density field from network Generate density at single point GPU accelerated line network voxelizer Method Signature Summary Initialize GPU resources Run voxelization on GPU Read back density field Functions Generate a simple tree structure Parameters: (Object) — No description in source JSDoc. Generate root system Parameters: (Object) — No description in source JSDoc. Generate cave/tunnel network Parameters: (Object) — No description in source JSDoc. Constants — Default voxel resolution — Blend radius for smooth junctions — Material IDs <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


lossyZigZagIndices(width = DEFAULTBLOCKWIDTH, height = DEFAULTBLOCKHEIGHT)

lossyQuantizeCoefficients(coefficients, quantization = 1)

lossyScalarQuantizationReport(values, options = {})

lossyResidualReport(reference, candidate, options = {})

lossyBlockDctReport(values, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: LossyCompressionMath.js pure transform, quantization, and reconstruction reports. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


legacyStructureSeededHash3D(x, y, z, seed)

legacyStructureChunkSeed3D(cx, cy, cz, seed = 0)

legacyStructurePositionSeed3D(x, y, z, seed = 0)

legacyPrimeCoordinateAbsXorBucket3D(x, y, z, tableSize)

legacyPrimeCoordinateU32XorBucket3D(x, y, z, tableSize)

legacyPrimeCoordinateSignedAddAbsBucket3D(x, y, z, tableSize)

legacyPrimeAxisHash32(value, axis = 'x', modulo = 0)

legacyDualRngPositionHash3D(x, y, z, seed = 0)

legacySeedCharWeightedXorHash32(seed, charCode, seedMultiplier, charMultiplier)

legacyPcgPixelFrameHash2D(x, y, frameIndex, salt = 0)

legacyPcgPixelFrameRandom24Float01(x, y, frameIndex, salt = 0)

legacyDeterministicRngPositionSeed32(worldSeed, x, y, z)

legacyDeterministicRngInteractionSeed32(worldSeed, entityA, entityB, tick)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathBits.js Bit manipulation, Morton codes, Hilbert curves, hash functions Critical for voxel systems, spatial indexing, and procedural generation Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


linearRgbLuminance(color, coefficients = COLORLUMAREC709)

toneMapReinhardExtended(color, whitePoint = 1)

colorContrastAdjust(color, amount = 1, pivot = 0.5)

colorSaturationAdjust(color, amount = 1, coefficients = COLORLUMAREC709)

colorDisplayTransformReport(color, options = {})

colorDisplayCapabilityReport(observed = {}, options = {})

canvasColorSettingsReport(settings = {}, observedAttributes = null)

canvasPixelReadbackReport(settings = {}, observedReadback = {}, options = {})

canvasPixelReadbackCapabilityReport(cases = [], options = {})

canvasPixelReadbackPrecisionReport(cases = [], options = {})

cssRelativeColorReport(value, options = {})

cssSystemColorReport(value, options = {})

cssSystemColorResolutionReport(systemColors = {}, options = {})

cssColorParseReport(value, options = {})

colorContrastChoiceReport(background, candidates = [[0, 0, 0], [1, 1, 1]], options = {})

cssLightDarkColorReport(lightColor, darkColor, options = {})

paletteAnalogous(baseHue, count = 5, spread = 30)

paletteSplitComplementary(baseHue, spread = 30)

paletteMonochromatic(baseHue, count = 5)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathColor.js Color spaces and conversions RGB, HSL, HSV, LAB, LCH, OKLAB, OKLCH, hex, blend modes, gradients, palettes Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/math/MathConstants.js
Constants
Notes & Examples
Math Library Conventions

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


dqCreate(rx, ry, rz, rw, dx, dy, dz, dw)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathDualQuat.js Dual Quaternion operations for skinning & rigid body interpolation Dual quaternion = [real x, real y, real z, real w, dual x, dual y, dual z, dual w] Real part = rotation quaternion, Dual part encodes translation Used for: DQS (Dual Quaternion Skinning), rigid body interpolation, screw motion Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


easeSpring(t, mass = 1, stiffness = 100, damping = 10)

easeSpringSimple(t, bounces = 3, decay = 0.4)

cssCubicBezierValue(x1, y1, x2, y2, progress)

cssStepEasing(progress, steps = 1, position = 'end', options = {})

cssEasingReport(easing, progress, options = {})

cssEasingValue(easing, progress, options = {})

catmullRomSpline(points, t, closed = false)

computeArcLengthTable(curveFn, segments = 100)

bezier3DerivativeVec3(p0, p1, p2, p3, t)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathEasing.js Easing functions, Bezier curves, splines For animation, UI transitions, and procedural motion Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


byteFrequencyHistogram(data, histogram = new Uint32Array(256)

symbolFrequencyHistogram(values, symbolCount, histogram = new Uint32Array(symbolCount)

probabilityTableFromHistogram(histogram, sampleCount = histogramSampleCount(histogram)

shannonEntropyFromHistogram(histogram, options = {})

minEntropyFromHistogram(histogram, options = {})

maxEntropyForSymbolCount(symbolCount, options = {})

klDivergence(pDistribution, qDistribution, options = {})

crossEntropy(pDistribution, qDistribution, options = {})

mutualInformationFromJointHistogram(jointHistogram, xSymbolCount, ySymbolCount, options = {})

conditionalEntropyFromJointHistogram(jointHistogram, xSymbolCount, ySymbolCount, options = {})

jointEntropyReport(jointHistogram, xSymbolCount, ySymbolCount, options = {})

byteDistributionReport(data, options = {})

adaptiveProportionReport(data, options = {})

minEntropyThresholdReport(data, options = {})

randomnessHealthReport(data, options = {})

streamingEntropyHealthReport(data, options = {})

entropyCompressionEstimate(sampleCount, entropyBitsPerSymbol, options = {})

histogramEntropyReport(histogram, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathEntropy.js histograms, entropy reports, and distribution diagnostics. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


sphereAABB(center, radius, aabbMin, aabbMax)

raySphere(rayOrigin, rayDir, center, radius)

rayAABB(rayOrigin, rayDir, aabbMin, aabbMax)

rayPlane(rayOrigin, rayDir, planeNormal, planeD)

rayTriangle(rayOrigin, rayDir, v0, v1, v2)

transformedAabbBoundingSphereReport(localMin, localMax, position, rotation, scale)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Convert a local AABB and entity TRS into a conservative world space sphere. Rotation moves the scaled local center but does not change the sphere radius. <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


bilinearSample(grid, width, height, u, v)

bilinearSampleVec3(grid, width, height, u, v)

trilinearSample(grid, width, height, depth, u, v, w)

trilinearSampleVec3(grid, width, height, depth, u, v, w)

trilinearSampleVec4(grid, width, height, depth, u, v, w)

gridGradient(grid, width, height, depth, x, y, z, cellSize = 1)

gridDivergence(grid, width, height, depth, x, y, z, cellSize = 1)

gridCurl(grid, width, height, depth, x, y, z, cellSize = 1)

gridLaplacian(grid, width, height, depth, x, y, z, cellSize = 1)

gridLaplacianVec3(grid, width, height, depth, x, y, z, cellSize = 1)

advectScalar(scalarField, velocityField, out, width, height, depth, dt, cellSize = 1)

advectVelocity(velocityField, out, width, height, depth, dt, cellSize = 1)

gridSampleScalarWorld(grid, width, height, depth, worldPos, gridOrigin, cellSize)

gridSampleVec3World(grid, width, height, depth, worldPos, gridOrigin, cellSize)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathGrid.js CPU side 3D grid sampling and discrete differential operators Consolidates: FluidSimWorld.js inline trilinear, SDFCollision trilinear, WindSimulation grid sample Houdini VEX volumesample / Niagara grid sampling parity Functions Bilinear interpolation on a 2D scalar grid Parameters: (Float32Array number[]) — Flat array [y width + x] (number) — Grid width (number) — Grid height (number) — X coordinate (0 to width 1, fractional) (number) — Y coordinate (0 to height 1, fractional) Returns: Interpolated value Bilinear interpolation on a 2D vector grid (3 component, interleaved) Parameters: (Float32Array number[]) — Flat array [y width 3 + x 3 + component] (number) — Grid width (number) — Grid height (number) — X coordinate (fractional) (number) — Y coordinate (fractional) Returns: Interpolated [x, y, z] Trilinear interpolation on a 3D scalar grid Parameters: (Float32Array number[]) — Flat array [z height width + y width + x] (number) — Grid X dimension (number) — Grid Y dimension (number) — Grid Z dimension (number) — X coordinate (fractional) (number) — Y coordinate (fractional) (number) — Z coordinate (fractional) Returns: Interpolated value Trilinear interpolation on a 3D vector grid (3 component, interleaved) Matches FluidSimWorld.js sampleVelocityTrilinear GPU implementation Parameters: (Float32Array number[]) — Flat array [(z H W + y W + x) 3 + component] (number) — Grid X dimension (number) — Grid Y dimension (number) — Grid Z dimension (number) — X coordinate (fractional) (number) — Y coordinate (fractional) (number) — Z coordinate (fractional) Returns: Interpolated [x, y, z] Trilinear interpolation on a 3D grid stored as vec4 (4 component, e.g. velocity + spin)


(number) — Z coordinate (fractional) Returns: Interpolated [x, y, z] Trilinear interpolation on a 3D grid stored as vec4 (4 component, e.g. velocity + spin) Parameters: (Float32Array number[]) — Flat array [(z H W + y W + x) 4 + component] (number) — Grid X dimension (number) — Grid Y dimension (number) — Grid Z dimension (number) — X coordinate (fractional) (number) — Y coordinate (fractional) (number) — Z coordinate (fractional) Returns: Interpolated [x, y, z, w] Discrete gradient of a scalar field (central differences) Parameters: (Float32Array number[]) — Scalar grid [z H W + y W + x] (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — Integer grid coordinate (number) — Integer grid coordinate (number) — Integer grid coordinate (number) — Grid cell spacing (default 1) Returns: [dF/dx, dF/dy, dF/dz] Discrete divergence of a vector field (central differences) Parameters: (Float32Array number[]) — Vector grid [(z H W + y W + x) 3 + component] (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — Integer grid coordinate (number) — Integer grid coordinate (number) — Integer grid coordinate (number) — No description in source JSDoc. Returns: div(F) = dFx/dx + dFy/dy + dFz/dz Discrete curl of a vector field (central differences) Parameters: (Float32Array number[]) — Vector grid [(z H W + y W + x) 3 + component] (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — Integer grid coordinate (number) — Integer grid coordinate (number) — Integer grid coordinate (number) — No description in source JSDoc. Returns: curl(F) =


— Integer grid coordinate (number) — Integer grid coordinate (number) — Integer grid coordinate (number) — No description in source JSDoc. Returns: curl(F) = [dFz/dy dFy/dz, dFx/dz dFz/dx, dFy/dx dFx/dy] Discrete Laplacian of a scalar field (6 point stencil) Parameters: (Float32Array number[]) — Scalar grid [z H W + y W + x] (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. Returns: ∇²F Discrete Laplacian of a vector field (per component, 6 point stencil) Parame


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathLine3.js Line segment operations (Three.js Line3 parity) Segment represented as { a: [x,y,z], b: [x,y,z] } Consolidates: MathGeometry.closestPointOnSegment, ViewportRaycasting.raySegmentDistance, PBDRagdoll.capsuleCollision segment segment math Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


mat4Frustum(left, right, bottom, top, near, far)

mat4PerspectiveReverseZ(fov, aspect, near, far)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


shaderFbm3DRotated(x, y, z, octaves = 4)

fbm2D(x, y, octaves = 6, lacunarity = 2, gain = 0.5, noiseFn = perlin2D)

fbm3D(x, y, z, octaves = 6, lacunarity = 2, gain = 0.5, noiseFn = perlin3D)

ridged2D(x, y, octaves = 6, lacunarity = 2, gain = 0.5, offset = 1, noiseFn = perlin2D)

ridged3D(x, y, z, octaves = 6, lacunarity = 2, gain = 0.5, offset = 1, noiseFn = perlin3D)

warpedNoise2D(x, y, warpStrength = 0.5, noiseFn = perlin2D)

warpedNoise3D(x, y, z, warpStrength = 0.5, noiseFn = perlin3D)

curlNoise2D(x, y, epsilon = 0.0001, noiseFn = perlin2D)

curlNoise3D(x, y, z, epsilon = 0.0001, noiseFn = perlin3D)

turbulence2D(x, y, octaves = 6, lacunarity = 2, gain = 0.5, noiseFn = perlin2D)

turbulence3D(x, y, z, octaves = 6, lacunarity = 2, gain = 0.5, noiseFn = perlin3D)

billow2D(x, y, octaves = 6, lacunarity = 2, gain = 0.5, noiseFn = perlin2D)

billow3D(x, y, z, octaves = 6, lacunarity = 2, gain = 0.5, noiseFn = perlin3D)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


phaseFromTime(frequency, time, phase = 0)

sampleWave(shape, phase, dutyCycle = 0.5)

sampleOscillatorArray(oscillators, time, out = [])

applyAmplitudeModulation(sampleValue, modulatorValue, amount = 1, bipolar = false)

applyPhaseModulation(phase, modulatorValue, amount = 1)

sampleAmplitudeModulated(carrier, modulator, time, amount = 1, bipolar = false)

samplePhaseModulated(carrier, modulator, time, amount = 1)

stepKuramotoPhases(phases, naturalFrequencies, dt, coupling = 0.5, weights = null, out = null)

stepCoupledOscillators(oscillators, dt, coupling = 0.5, weights = null)

stepKuramotoDriven(phases, naturalFrequencies, dt, t, coupling = 0.5, driveFrequency = 1, driveStrength = 0, weights = null, out = null)

stepKuramotoMeanFieldDriven(phases, naturalFrequencies, dt, t, coupling = 0.5, driveFrequency = 1, driveStrength = 0, out = null, order = null,)

createOscillatorBank(count, factory = null)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Kuramoto order parameter (complex form). Computes collective synchronization r·e^(iψ) of N coupled phases. r ≈ 0 = chaos/dissonance; r ≈ 1 = perfect lockstep. Real world: power grid frequency lock, neural firing synchrony, firefly flashing, cardiac pacemakers, crowd footsteps (Millennium Bridge wobble). Scalar synchronization metric r = <e^(iθ) . Game uses: swarm AI cohesion, rhythm combat sync signals, magic ritual progress bars, ambient life pulse coherence. Euler step for driven Kuramoto model. dθᵢ/dt = 2π·ωᵢ + (K/N)Σⱼsin(θⱼ−θᵢ) + λ·sin(2π·f drive·t − θᵢ) The λ term is an external forcing function (e.g. Schumann resonance 7.83 Hz, a metronome, a planetary frequency, a bassline tempo). Applications: procedural music harmony, NPC swarm coordination, breathing/ idle animation sync, climate zone oscillations, magic aura pulse coupling. Parameters: (number[]) — current phase array (radians) (number[]) — natural frequencies (Hz) (number) — time step (seconds) (number) — absolute time (seconds) (number) — K — inter oscillator coupling strength (number) — f drive — external forcing frequency (Hz) (number) — λ — external forcing amplitude (number[][] null) — optional pairwise coupling weights (number[] null) — optional output array (avoids alloc) Exact O(N) Euler step for the globally coupled, driven Kuramoto model. For uniform all to all coupling, the pair sum is exactly reducible through Z = <exp(iθ) = re + i·im: (K/N) Σⱼ sin(θⱼ θᵢ) = K (im·cos θᵢ re·sin θᵢ) This is mathematically equivalent to while avoiding its O(N²) pair loop. may be supplied when the caller already


(K/N) Σⱼ sin(θⱼ θᵢ) = K (im·cos θᵢ re·sin θᵢ) This is mathematically equivalent to while avoiding its O(N²) pair loop. may be supplied when the caller already computed the current order parameter for telemetry. Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


packSignedRangeUNORMBits(value, range, bitDepth = 16, fallback = 0)

unpackSignedRangeUNORMBits(packed, range, bitDepth = 16, fallback = 0)

packSignedRangeUNORM16(value, range, fallback = 0)

unpackSignedRangeUNORM16(packed, range, fallback = 0)

packSignedRangeSNORMBits(value, range, bitDepth = 16, fallback = 0)

unpackSignedRangeSNORMBits(packed, range, bitDepth = 16, fallback = 0)

packSignedRangeSNORM16(value, range, fallback = 0)

unpackSignedRangeSNORM16(packed, range, fallback = 0)

packTransformTRS10(transform = {}, options = {})

unpackTransformTRS10(packed, options = {})

packParticlePositionAge(x, y, z, age, options = {})

unpackParticlePositionAge(packed, options = {})

packParticleVelocityLifetime(vx, vy, vz, lifetime, options = {})

unpackParticleVelocityLifetime(packed, options = {})

packORM8(occlusion = 1, roughness = 1, metallic = 0, alpha = 1)

packPBRMaterialParams8(metallic = 0, roughness = 1, normalScale = 1, alphaCutoff = 0)

packVoxelMaterialUniforms(params = {}, out = new Float32Array(VOXELMATERIALUNIFORMFLOATS)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathPacking.js GPU data packing utilities Half float, SNORM/UNORM, RGB9E5, R11G11B10F Consolidates: World3DPreviewRenderer. floatToHalf, MeshCompression.quantizeUVs Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


linearMotion(position, velocity, acceleration, dt)

eulerIntegrate(position, velocity, acceleration, dt)

semiImplicitEuler(position, velocity, acceleration, dt)

projectileMotion(position, velocity, gravity, dt)

projectilePosition(start, velocity, gravity, t)

projectileVelocityToTarget(start, target, gravity, preferHighArc = false)

totalPointVelocity(linearVelocity, angularVelocity, centerOfMass, point)

gravitationalForce(m1, m2, p1, p2, G = 6.674e-11)

springForce(position, anchor, restLength, stiffness)

dampedSpringForce(position, velocity, anchor, restLength, stiffness, damping)

dragForce(velocity, dragCoefficient, area, fluidDensity = 1.225)

buoyancyForce(submergedVolume, fluidDensity, gravity = 9.81)

inelasticCollision(m1, v1, m2, v2, restitution = 0.5)

sphereCollisionResponse(p1, v1, m1, r1, p2, v2, m2, r2, restitution = 0.8)

planeCollisionResponse(velocity, normal, restitution = 0.8)

collisionResponseWithFriction(velocity, normal, restitution, friction)

distanceConstraint(p1, p2, targetDistance, stiffness = 1)

distanceConstraintMass(p1, m1, p2, m2, targetDistance, stiffness = 1)

pointConstraint(position, target, stiffness = 1)

angleConstraint(p1, p2, p3, targetAngle, stiffness = 1)

verletIntegrate(current, previous, acceleration, dt)

verletIntegrateDamped(current, previous, acceleration, dt, damping = 0.99)

totalMechanicalEnergy(mass, velocity, height, g = 9.81)

rk2Integrate(position, velocity, accelerationFn, t, dt)

rk4Integrate(position, velocity, accelerationFn, t, dt)

rk4AdaptiveStep(position, velocity, accelerationFn, t, dt)

pointAttractorForce(position, attractorPos, strength, falloffRadius = 1)

pointAttractorForceInvSq(position, attractorPos, strength, minDist = 0.1)

vortexFieldForce(position, vortexPos, vortexAxis, strength, radius = 1)

orbitForce(position, centerPos, orbitSpeed, upAxis = [0, 1, 0])

windForce(velocity, windVelocity, sensitivity = 0.1)

sphereSphereTimeOfImpact(p1, v1, r1, p2, r2)

sphereSphereMovingTOI(p1, v1, r1, p2, v2, r2)

spherePlaneTimeOfImpact(center, velocity, radius, planeNormal, planeD)

sphereAABBTimeOfImpact(center, velocity, radius, aabbMin, aabbMax)

potentialEnergyGravity(mass, height, g = 9.81)


planeClassifyPoint(plane, point, eps = EPSILON)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathPlane.js Plane operations (Three.js/Godot/Unity parity) Plane represented as [nx, ny, nz, d] where nx x + ny y + nz z + d = 0 Consolidates: MeshCutter.Plane, MathGeometry.rayPlane, MathGeometry.sdfPlane Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


polyNewtonRoot(coeffs, guess, maxIter = 20, tolerance = EPSILON)

polyRealRoots(coeffs, lo = -1000, hi = 1000, tolerance = 1e-10)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathPolynomial.js Polynomial root solvers and evaluation Consolidates: AIAiming.js inline quadratic, SpeculativeContacts.js quadratic CCD Standard in game math libraries for intersection tests, predictive aim, CCD Functions Evaluate polynomial using Horner's method: coeffs[0] x^n + coeffs[1] x^(n 1) + ... + coeffs[n] Derivative coefficients: returns new array of degree n 1 Evaluate polynomial and its derivative simultaneously (Horner's) Smallest positive root of quadratic, or null Find all real roots of an arbitrary polynomial using Sturm chain + bisection Parameters: (number[]) — Polynomial coefficients [a n, a {n 1}, ..., a 1, a 0] (number) — Lower bound for root search (default: 1000) (number) — Upper bound for root search (default: 1000) (number) — Root accuracy (default: EPSILON) Returns: Sorted array of real roots <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


numberWithinTolerance(actual, expected, absoluteTolerance = DEFAULTABSOLUTETOLERANCE, relativeTolerance = DEFAULTRELATIVETOLERANCE)

vecWithinTolerance(actual, expected, absoluteTolerance = DEFAULTABSOLUTETOLERANCE, relativeTolerance = DEFAULTRELATIVETOLERANCE)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathPrecision.js numeric tolerance and world scale split double helpers. Pure math helpers for tests, serialization policy, and CPU/GPU coordinate packing. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


peakSignalToNoiseRatio(reference, candidate, options = {})

structuralSimilarityLite(reference, candidate, options = {})

windowedStructuralSimilarity(reference, candidate, options = {})

channelQualityReport(reference, candidate, options = {})

imageQualityReport(referenceImage, candidateImage, options = {})

histogramDifference(referenceHistogram, candidateHistogram, options = {})

frameDifference(reference, candidate, options = {})

perceptualErrorScore(reference, candidate, options = {})

qualityMetricsReport(reference, candidate, options = {})

qualitySizeScore({ quality = 1, byteSize = 0, referenceByteSize = 0, byteBudget = Infinity, budgetBytes = byteBudget, qualityWeight = 0.7, sizeWeight = 0.3, budgetWeight, } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathQuality.js reusable error, quality, signal, and size metrics. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


quatFromEulerDeg(x, y, z, order = 'XYZ')

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathQuat.js Extended Quaternion operations [x, y, z, w] Supplements the basic quat ops in EngineMath.js with advanced features Depends on: MathConstants.js, MathScalar.js Functions <! HUMAN NOTES Notes & Examples Quaternions for 3D rotations — compact, interpolation friendly, and gimbal lock free. Stored as . Use to compose rotations and for smooth interpolation. Creating rotations Composing and interpolating Converting to/from other representations Gotchas Normalization : Always normalize after many operations; is cheap. Shortest path : takes the shortest arc; for long spins, add multiples of 2π to the target angle first. Gimbal lock : Quaternions avoid it, but converting FROM Euler can still hit singularities at ±90° pitch — prefer quat from axis or keep state as quat. See also: MathVec3 · MathMat4 · Math Library Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


uniformDistribution(min = 0, max = 1, rng = defaultRng)

normalDistribution(mean = 0, stdDev = 1, rng = defaultRng)

exponentialDistribution(lambda = 1, rng = defaultRng)

poissonDistribution(lambda, rng = defaultRng)

binomialDistribution(n, p, rng = defaultRng)

triangularDistribution(min, max, mode, rng = defaultRng)

gammaDistribution(shape, scale = 1, rng = defaultRng)

betaDistribution(alpha, beta, rng = defaultRng)

logNormalDistribution(mean = 0, stdDev = 1, rng = defaultRng)

cauchyDistribution(x0 = 0, gamma = 1, rng = defaultRng)

paretoDistribution(alpha, xMin = 1, rng = defaultRng)

weightedRandom(weights, rng = defaultRng)

sampleWithReplacement(array, n, rng = defaultRng)

reservoirSample(stream, k, rng = defaultRng)

randomOnHemisphereCosine(normal, rng = defaultRng)

randomInTriangle(v0, v1, v2, rng = defaultRng)

randomInCone(direction, halfAngle, rng = defaultRng)

fibonacciSphere(index, total, rotation = 0)

fibonacciSpherePoints(count, rotation = 0)

poissonDiskSampling(width, height, minDist, maxAttempts = 30, rng = defaultRng)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions <! HUMAN NOTES Notes & Examples Seeded random number generation for deterministic simulations, procedural generation, and networked games. Uses a xorshift128+ algorithm with 128 bit state. Each instance is independent and serializable. Basic usage Vectors and directions Procedural generation (seeded) Shuffle and pick Serialization (network sync) Gotchas Don't use : It's not seeded and differs across browsers. Seed 0 : Valid but produces a specific sequence; use larger seeds (timestamps, hashes) for variety. Threading : Each is NOT thread safe; create per thread instances with different seeds derived from a root RNG. See also: Math Library · MathVec3 Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


rayIntersectCapsule(ray, capA, capB, radius)

rayIntersectOBB(ray, boxCenter, boxAxes, halfExtents)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathRay.js Ray operations (Three.js/Unity parity) Ray represented as { origin: [x,y,z], direction: [x,y,z] } Consolidates: AIAiming.createRay, MathGeometry.ray , ScreenRayCaster, Viewport.getPickRay Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathRect2.js 2D Axis Aligned Bounding Box / Rectangle (Godot Rect2 / Three.js Box2 parity) Rect represented as { minX, minY, maxX, maxY } Consolidates: MathGeometry.pointInRect/rectRect, workflow canvas bounding box logic Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


mathRegistryById(id, registry = MATHREGISTRY)

mathRegistryFunctionsForModule(moduleId, registry = MATHREGISTRY)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathRegistry.js inspectable metadata for stable MathEngine modules and functions. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


rootAlgebraFormatElement(element, n = 4)

rootAlgebraEncodedMultiply(n, leftMask, rightMask, options = {})

rootAlgebraEncodedTrace(n, leftMask, rightMask, options = {})

rootAlgebraGenerateTable(n, multiply = rootAlgebraMultiply)

rootAlgebraCompileExecutionPlan(n, options = {})

rootAlgebraEvaluateExecutionPlan(plan, left, right = null)

rootAlgebraExecutionPlanWGSL(plan, options = {})

rootAlgebraPropertyReport(n, options = {})

rootAlgebraFindSimpleZeroDivisors(n, options = {})

rootAlgebraSearchEncodedMultipliers(n, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Compile the reducer into immutable bilinear and square execution plans. Experimental encoders never enter this path: callers may require the exact algebraic laws their optimized kernel depends on before code is generated. Generate a branch free WGSL product or square directly from a validated plan. <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


nearlyEqual(a, b, absEps = EPSILON, relEps = EPSILON)

safeDiv(numerator, denominator, fallback = 0)

rangeContains(value, min, max, inclusive = true)

rangeOverlap(aMin, aMax, bMin, bMax, inclusive = true)

rangeIntersection(aMin, aMax, bMin, bMax)

remapClamped(x, inMin, inMax, outMin, outMax)

springDamp(current, target, velocity, smoothTime, dt)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathScalar.js Scalar utility functions Depends on: MathConstants.js Functions Constants <! HUMAN NOTES Notes & Examples Scalar (single number) math utilities: clamping, interpolation, stepping, and common easing functions. These are pure functions that return new scalars. Basic range operations Mapping and wrapping Easing functions Gotchas Division by zero : and handle equal edges gracefully (return 0 or start respectively), but check your inputs for logic errors. Precision : For very large ranges, prefer the variants or use double precision temporaries. See also: Math Library Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


signalSummaryReport(signal, options = {})

exponentialMovingAverage(signal, alpha = 0.3)

firBandpassCoeffs(lowFreq, highFreq, sampleRate, numTaps)

stft(signal, windowSize, hopSize, windowFn = hannWindow)

istft(frames, windowSize, hopSize, outputLength)

spectrogram(signal, windowSize, hopSize, windowFn = hannWindow)

melFilterbank(numFilters, fftSize, sampleRate, lowFreq = 0, highFreq = null)

mfcc(signal, sampleRate, numCoeffs = 13, numFilters = 26, windowSize = 512, hopSize = 256)

generateSine(frequency, sampleRate, duration, amplitude = 1)

generateCosine(frequency, sampleRate, duration, amplitude = 1)

generateSquare(frequency, sampleRate, duration, amplitude = 1)

generateSawtooth(frequency, sampleRate, duration, amplitude = 1)

generateTriangle(frequency, sampleRate, duration, amplitude = 1)

generateWhiteNoise(sampleRate, duration, amplitude = 1)

generateChirp(startFreq, endFreq, sampleRate, duration, amplitude = 1)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathSignal.js FFT and Signal Processing FFT, window functions, filters, convolution, spectral analysis Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/math/MathSphericalHarmonics.js
Functions
shZero()
shClone(sh)
shFromColor(r, g, b)
shEvaluateBasis(dir)
shEvaluateBasisL1(dir)
shEvaluate(sh, dir)
shIrradiance(sh, normal)
shProject(directions, colors)
shAdd(a, b)
shScale(sh, s)
shLerp(a, b, t)
shAccumulate(out, sh, weight)
shConvolve(sh, kernel)
shWindow(sh, windowWidth)
shRotate(sh, mat3)
shFromCubemap(faces)
shToGPUBuffer(sh)
Notes & Examples
Math Library Conventions

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathSphericalHarmonics.js CPU side Spherical Harmonics (L0 L2, 9 coefficients) Consolidates: RealtimeGI.js inline WGSL evalSH, provides CPU parity for probe baking/debugging Three.js SphericalHarmonics3 parity Functions Create zero SH (9 RGB coefficients = 27 floats) Clone SH coefficients Create SH from constant color (ambient only, L0 band) Evaluate 9 SH basis functions for a direction [x,y,z] (must be normalized) Evaluate 4 SH basis functions (L0+L1 only, cheaper) Evaluate RGB color from SH coefficients at a direction Evaluate irradiance (diffuse lighting) from SH at a surface normal Project directional samples onto SH coefficients Parameters: (number[][]) — Array of normalized [x,y,z] directions (number[][]) — Array of [r,g,b] color samples Returns: 27 element SH coefficients Add two SH: out = a + b Scale SH by scalar Lerp between two SH Accumulate: out += sh weight (in place) Convolve SH with per band kernel (e.g., cosine lobe for diffuse) Parameters: (Float32Array) — Input SH (27 floats) (number[]) — Per band kernel [k0, k1, k2] for L0, L1, L2 Returns: Convolved SH Apply Hanning window to reduce ringing Rotate SH coefficients by a 3x3 rotation matrix L0 is invariant. L1 rotates directly. L2 uses the explicit 5x5 rotation. Reference: Ivanic & Ruedenberg (1996), Green "SH Lighting: The Gritty Details" (2003) Parameters: (Float32Array) — Input SH (27 floats) (Float32Array number[]) — 3x3 rotation matrix (column major) Returns: Rotated SH Project 6 face cubemap to SH Returns: 27 element SH Convert SH to Float32Array suitable for GPU uniform upload (already is Float32Array) <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix,


suitable for GPU uniform upload (already is Float32Array) <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/math/MathStatistics.js
Functions
runningStatsCreate()
runningStatsPush(stats, value)
runningStatsRemove(stats, value)
runningStatsVariance(stats)
runningStatsPopulationVariance(stats)
runningStatsStdDev(stats)
runningStatsMerge(a, b)
runningStatsReset(stats)
runningStatsClone(stats)
statsMean(arr)
statsSum(arr)
statsVariance(arr)
statsPopulationVariance(arr)
statsMin(arr)
statsMax(arr)
statsMedian(arr)
statsPercentile(arr, p)
statsIQR(arr)
emaCreate(alpha = 0.1)
emaPush(ema, value)
emaReset(ema)
windowedStatsCreate(windowSize = 60)
windowedStatsPush(ws, value)
windowedStatsVariance(ws)
windowedStatsReset(ws)
runningStatsMean(stats)
runningStatsCount(stats)
runningStatsMin(stats)
runningStatsMax(stats)
runningStatsRange(stats)
statsStdDev(arr)
statsPopulationStdDev(arr)
statsRange(arr)
emaGet(ema)
windowedStatsMean(ws)
windowedStatsStdDev(ws)
Notes & Examples
Math Library Conventions

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathStatistics.js Running statistics, array stats, exponential moving average Consolidates: PerformanceAnalyzer inline variance/stdDev, FramePacingController running average Welford's online algorithm for numerically stable running stats Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


rangeValidationReport(value, min, max, options = {})

alignmentReport(offset, alignment, options = {})

histogramValidationReport(histogram, options = {})

probabilityDistributionReport(probabilities, options = {})

typedArrayLayoutReport(view, options = {})

vectorValidationReport(values, options = {})

colorValidationReport(color, options = {})

schemaValidationReport(value, schema, options = {})

assertValidationReport(report, message = 'validation failed')

assertSchema(value, schema, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathValidation.js reusable finite, range, alignment, histogram, and probability reports. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


vec2SmoothDamp(current, target, currentVelocity, smoothTime, dt, maxSpeed = Infinity)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


vec3RotateTowards(current, target, maxRadiansDelta, maxMagnitudeDelta)

vec3SmoothDamp(current, target, currentVelocity, smoothTime, dt, maxSpeed = Infinity)

vec3SafeNormalize(v, fallback = [0, 1, 0])

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MathVec3.js 3D Vector operations Depends on: MathConstants.js, MathScalar.js, MathRandom.js Functions <! HUMAN NOTES Notes & Examples A flat, allocation conscious 3D vector library. Vectors are plain arrays (or typed arrays), not class instances — so they serialize, pool, and pass to the GPU without conversion. Two calling conventions Most operations come in two flavours: Pure — returns a new vector: . — writes into an array (zero allocation), ideal for hot loops: . Gotchas on a zero length vector returns s — use when the input may be zero. Equality uses an epsilon ( ); use only when you truly need bit exact comparison. See also: Math Library Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


vec4SafeNormalize(v, fallback = [0,0,0,1])


mediaTimestampReport(sample = {}, options = {})

mediaFrameIndexAtTimestamp(timestamp, options = {})

mediaTimestampForFrameIndex(frameIndex, options = {})

mediaTimelineReport(samples = [], options = {})

mediaDroppedFrameReport(samples = [], options = {})

mediaDriftReport(reference, candidate, options = {})

mediaAvSyncReport(audioSamples = [], videoSamples = [], options = {})

mediaAudioDataTimingReport(audioData = {}, options = {})

mediaColorSpaceReport(videoFrameOrColorSpace = {}, options = {})

mediaQueuePressureReport(queue = {}, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MediaTimingMath.js pure WebCodecs shaped timestamp, cadence, sync, and metadata reports. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


memoryLayoutAlignmentForKind(kind, fallback = 1)

interleavedVertexLayoutReport(attributes, options = {})

planarBufferLayoutReport(attributes, elementCount, options = {})

aosElementByteOffset(index, stride, fieldOffset = 0, baseOffset = 0)

soaElementByteOffset(index, elementByteSize, baseOffset = 0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MemoryLayoutMath.js byte alignment, struct, interleaved, planar, WGSL, and std140 layout reports. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


morphWeightStateReport(value, options = {})

positionBoundsReport(positions, options = {})

morphAttributeDeltasReport(baseValues, morphTargets, morphWeights, options = {})

morphedPositionBoundsReport(basePositions, morphTargets, morphWeights, options = {})

skinnedPositionBoundsReport(bindPositions, jointIndices, jointWeights, skinMatrices, options = {},)

readAccessorComponent(view, byteOffset, componentType, normalized = false)

accessorByteLayout(accessor, bufferView = {})

readAccessorArray(source, accessor, bufferView = {}, options = {})

accessorDecodeMetadata(accessor, bufferView = {})

attributeBounds(values, componentCount = 3)

meshoptDecodeMetadata(extension = {}, bufferView = {})

tangentHandedness(tangent, fallback = 1)

tangentFrameFromNormalTangent(normal, tangent, options = {})

gltfBitangentFromTangent(normal, tangent, options = {})

decodeNormalTextureSample(sample, normalScale = 1, options = {})

normalTextureSampleToWorld(sample, normal, tangent, normalScale = 1, options = {})

mikkTSpaceReferenceFingerprint(preparedInput, faceTangents = null)

mikkTSpaceReferenceProofReport(preparedInput, faceTangents, proof = null, registry = MIKKREFERENCECORPUSREGISTRY)

mikkTSpaceFaceTangentOutputReport(faceTangents, expectedVertexCount, options = {})

applyMikkTSpaceFaceTangents(preparedInput, faceTangents, options = {})

splitGeometryForTangentSpace(geometry, options = {})

tangentSpaceCompatibilityReport(geometry, referenceTangents = null, options = {})

generateTangentsFromGeometry(positions, normals, uvs, indices = null, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MeshAttributeMath.js glTF style accessor component, stride, tangent frame, and decode helpers. Functions Validate serializable per model morph control state keyed by stable part index. Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


peerNeighborScoreReport(peer = {}, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MeshMath.js reusable peer graph, neighbor, relay, gossip, and mesh health helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


navPathLength(waypoints = [], options = {})

navStringPull(portals = [], options = {})

navPathCorridorReport(portals = [], options = {})

navAreaTraversalCost(distance, area = 0, options = {})

navNearestPolyScore(point, polygon, options = {})

navSmoothPath(waypoints = [], smoothing = 0.5, options = {})

navSteeringTargetReport(currentPosition, waypoints = [], options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: NavigationMath.js pure navigation corridor, path, area cost, and steering reports. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


timeoutEstimateMs(estimator = {}, options = {})

rttEstimatorUpdate(sampleRttMs, previous = null, options = {})

quicProbeTimeoutMs(estimator = {}, options = {})

interarrivalJitterUpdate(previousTransitMs, currentTransitMs, previousJitterMs = 0, options = {})

rtpInterarrivalJitterUpdate(previous = null, packet = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: NetworkMetricMath.js reusable RTT, jitter, loss, throughput, goodput, and timeout helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


wrapPacketSequence(sequence, sequenceBits = PACKETSEQUENCEBITSDEFAULT)

advancePacketSequence(sequence, increment = 1, sequenceBits = PACKETSEQUENCEBITSDEFAULT)

packetSequenceForwardDelta(fromSequence, toSequence, sequenceBits = PACKETSEQUENCEBITSDEFAULT)

packetSequenceSignedDelta(fromSequence, toSequence, sequenceBits = PACKETSEQUENCEBITSDEFAULT)

comparePacketSequence(leftSequence, rightSequence, sequenceBits = PACKETSEQUENCEBITSDEFAULT)

isPacketSequenceNewer(candidateSequence, baselineSequence, sequenceBits = PACKETSEQUENCEBITSDEFAULT)

packetSequenceWindowReport(sequence, windowStart, windowSize, sequenceBits = PACKETSEQUENCEBITSDEFAULT)

packetAckRangeReport(packetNumbers = [], options = {})

packetFragmentPlan(payloadBytes, options = {})

packetReassemblyReport(fragments = [], options = {})

packetLossCandidateReport(sentPackets = [], options = {})

quicPacketNumberEncodingBytes(packetNumber, largestAcknowledgedPacket = null)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PacketMath.js reusable packet sequence, ACK range, fragmentation, flight, and loss helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


latencyStatsReport(samplesMs, options = {})

frameBudgetReport(frameTimeMs, options = {})

profileStageReport(stages, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ProfileMath.js reusable latency, frame budget, and stage profile summaries. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


quantizationStep(range, maxValue = QUANTINT16MAX)

quantizationMaxAbsoluteError(range, maxValue = QUANTINT16MAX)

quantizeSignedFloat(value, range, maxValue = QUANTINT16MAX)

dequantizeSignedFloat(quantized, range, maxValue = QUANTINT16MAX)

quantizeSignedFloatArray(values, range, bitDepth = 16)

dequantizeSignedFloatArray(quantized, range, bitDepth = 16)

quantizeRange(value, min, max, bitDepth = 16, fallback = 0)

dequantizeRange(quantized, min, max, bitDepth = 16, fallback = 0)

quantizeRangeArray(values, min, max, bitDepth = 16)

dequantizeRangeArray(quantized, min, max, bitDepth = 16)

quantizeVec2(value, range, bitDepth = 16)

dequantizeVec2(quantized, range, bitDepth = 16)

quantizeVec3(value, range, bitDepth = 16)

dequantizeVec3(quantized, range, bitDepth = 16)

dequantizeColor(quantized, bitDepth = 8)

deltaQuantize(values, range, bitDepth = 16)

quantizationErrorReport(source, decoded, tolerance = 0)

quaternionOrientationErrorReport(source, decoded, toleranceRadians = 0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: QuantMath.js reusable scalar and array quantization primitives. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: QueueMath.js reusable queue depth, delay, bucket, share, ramp, and backpressure helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


thermalNoiseFloorDbm(bandwidthHz, options = {})

channelCapacityBps(bandwidthHz, options = {})

snrQualityScore(snrValueDb, options = {})

channelOverlapReport(aCenterHz, aBandwidthHz, bCenterHz, bBandwidthHz)

signalInterferenceNoiseRatioDb(signalDbm, noiseDbm, interferenceDbm = -Infinity)

interferenceScore(interferenceDbm, signalDbm, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: RadioMath.js reusable RF power, noise, path loss, channel, and link budget helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


cancellationReport(left, right, operation = 'subtract')

orientation2DReport(a, b, c, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: RobustNumericMath.js floating point policy, stable sums, cancellation, and filtered predicates. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


simdLaneByteOffset(shape = 'f32x4', vectorIndex = 0, laneIndex = 0, baseOffset = 0)

simdVectorAlignmentReport(shape = 'f32x4', byteOffset = 0, options = {})

simdChunkPlan(elementCount, shape = 'f32x4')

simdLaneMask(shape = 'f32x4', enabledLanes = 'all')

simdTailLaneMask(elementCount, shape = 'f32x4')

simdSoALayoutReport(componentCount, elementCount, options = {})

simdScalarFallbackReport(elementCount, shape = 'f32x4', options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SIMDLayoutMath.js WebAssembly style v128 lane metadata and SoA/AoS layout helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


sampleIndexForTime(seconds, sampleRate = DEFAULTSAMPLERATE, options = {})

sampleTimeForIndex(index, sampleRate = DEFAULTSAMPLERATE, options = {})

sampleFrameWindowReport(sampleCount, windowSize, hopSize, options = {})

samplePlaybackRateReport(bufferSampleRate, contextSampleRate, playbackRate = 1, options = {})

spatialBilinearSampleReport(grid, width, height, x, y, options = {})

spatialTrilinearSampleReport(grid, width, height, depth, x, y, z, options = {})

catmullRomSampleReport(samples, x, options = {})

spatialBicubicSampleReport(grid, width, height, x, y, options = {})

spatialAreaSampleReport(grid, width, height, area = {}, options = {})

stratifiedSampleGridReport(columns, rows, options = {})

weightedSampleDistributionReport(weights, options = {})

discreteImportanceSampleReport(weights, u, options = {})

blueNoiseSampleSetReport(points, options = {})

lowDiscrepancySequenceReport(count, options = {})

multiJitteredSampleGridReport(size, options = {})

sampleSetUniformityReport(points, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SamplingMath.js pure sample grid, time window, and sample rate report helpers. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


sceneQueryHitListReport(hits, options = {})

sceneQueryFilterReport(query = {}, target = {}, options = {})

sceneQuerySweptAabbReport(movingMin, movingMax, staticMin, staticMax, delta, options = {})

sceneQueryAabbOverlapReport(aMin, aMax, bMin, bMax, options = {})

sceneQuerySpherePenetrationReport(centerA, radiusA, centerB, radiusB, options = {})

sceneQueryContactNormalReport(normal, options = {})

sceneQueryConvexRadiusReport(radius, options = {})

sceneQueryBroadphasePairScore(aMin, aMax, bMin, bMax, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SceneQueryMath.js pure ray/overlap/sweep query reports for engine callers. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


signalLevelQualityScore(valueDb, options = {})

signalLatencyQualityScore(rttMs, options = {})

signalJitterQualityScore(jitterMs, options = {})

signalBitrateQualityScore(bitrateBps, options = {})

webrtcStatsSignalReport(stats, options = {})

signalQualityTrendReport(samples = [], options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SignalQualityMath.js reusable signal/link health scoring for radio and WebRTC diagnostics. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/math/SpatialHash.js
Classes
class SpatialHash
Notes & Examples
Math Library Conventions

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes SpatialHash.js Fast spatial queries for particles and entities Uses a grid based hash for O(1) average case neighbor queries. Method Signature Summary Get cell key for a position Clear all entries Insert an object with position Remove an object Update object position Query all objects within radius of a point Query all objects in a cell Get total object count <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/math/SpatialHashCompute.js
Classes
class SpatialHashCompute
Notes & Examples
Math Library Conventions

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Initialize the compute system Rebuild the spatial hash from particles Get buffers for use in other shaders Load configuration from engine.cfg section Destroy GPU resources <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


normalizeTensorShape(shape, options = {})

tensorIndexToOffset(indices, strides, options = {})

tensorOffsetToIndices(offset, shape, options = {})

reshapeReport(inputShape, targetShape, options = {})

tensorBufferSizeReport(shape, dtype = 'float32', options = {})

reductionShape(shape, axes, options = {})

tensorGraphMemoryReport(tensors, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: TensorShapeMath.js reusable tensor shape, broadcast, stride, dtype, and graph memory reports. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


textGraphemeSegments(text, options = {})

textGraphemeBoundaries(text, options = {})

textCursorAdvance(text, offset = 0, direction = 1, options = {})

textLineBreakOpportunityReport(text, options = {})

textLineWrapReport(text, maxWidth = Infinity, options = {})

textTruncateReport(text, maxWidth = Infinity, options = {})

textBaselineReport(metrics = {}, options = {})

textSelectionRects(wrapReport, start = 0, end = start, options = {})

glyphAtlasPlacementReport(glyphs = [], options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: TextMetricMath.js grapheme, text run, wrap, baseline, selection, and glyph atlas reports. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


tileUV(uv, scale = [1, 1], offset = [0, 0])

atlasUVTransform(x, y, width, height, atlasWidth, atlasHeight = atlasWidth)

textureMipExtent3D(width, height = width, depth = 1, mipLevel = 0)

atlasPaddedExtent(width, height = width, padding = 1)

atlasContentRect(x, y, width, height, padding = 1)

atlasPaddedRectFromContent(x, y, width, height, padding = 1)

atlasPaddedArea(width, height, padding = 1)

atlasRegionUVs(x, y, width, height, atlasWidth, atlasHeight = atlasWidth)

virtualTexturePageGrid(pageTableWidth = 2048, pageTableHeight = pageTableWidth)

virtualTexturePageId(pageX, pageY, pageTableWidth = 2048, pageTableHeight = pageTableWidth)

virtualTexturePageCoord(pageId, pageTableWidth = 2048, pageTableHeight = pageTableWidth)

virtualTexturePageCoordFromUV(uv, pageTableWidth = 2048, pageTableHeight = pageTableWidth)

virtualTexturePhysicalPageGrid(cacheWidth = 4096, pageSize = 256, cacheHeight = cacheWidth)

virtualTexturePhysicalPageOrigin(slotIndex, cacheWidth = 4096, pageSize = 256, cacheHeight = cacheWidth)

virtualTexturePhysicalUV(uv, physicalPage, { pageTableWidth = 2048, pageTableHeight = pageTableWidth, pageSize = 256, cacheWidth = 4096, cacheHeight = cacheWidth, } = {})

virtualTexturePageTableEntry(pageId, physicalLocation, { pageTableWidth = 2048, pageTableHeight = pageTableWidth, pageSize = 256, resident = 1, reserved = 0, } = {})

virtualTextureFeedbackBufferLayout(pageTableWidth = 2048, pageTableHeight = pageTableWidth, bytesPerFlag = 4)

virtualTextureFeedbackBufferByteSize(pageTableWidth = 2048, pageTableHeight = pageTableWidth, bytesPerFlag = 4)

virtualTextureFeedbackIndex(pageId, pageTableWidth = 2048, pageTableHeight = pageTableWidth)

compactVirtualTextureFeedback(feedbackData, { pageTableWidth = 2048, pageTableHeight = pageTableWidth, maxRequests = Infinity, residentPages = null, } = {})

pixelToUV(pixel, textureSize, centered = false)

uvToPixel(uv, textureSize, centered = false)

textureMipLevelCount(width, height = width, depth = 1, maxMipLevels = Infinity)

textureMipExtent(width, height, mipLevel = 0)

textureMipByteSize(width, height, bytesPerPixel = 4, mipLevels = 1, depthOrArrayLayers = 1)

textureFormatBlockInfo(format = 'rgba8unorm', fallbackBytesPerPixel = 4)

textureFormatIsSupported(format = 'rgba8unorm', features = null)

textureDefaultTranscodeTargets({ needsAlpha = true, preferSrgb = false } = {})

textureBytesPerPixel(format = 'rgba8unorm', fallbackBytesPerPixel = 4)

textureFormatBitsPerPixel(format = 'rgba8unorm', fallbackBytesPerPixel = 4)

textureMipBlockExtent(width, height, format = 'rgba8unorm', mipLevel = 0)

textureMipBlockExtent3D(width, height, depth = 1, format = 'rgba8unorm', mipLevel = 0)

textureFormatMipByteSize(width, height, format = 'rgba8unorm', mipLevels = 1, depthOrArrayLayers = 1)

textureContainerLevelByteSize({ width, height = width, depth = 1, format = 'rgba8unorm', mipLevel = 0, layerCount = 1, faceCount = 1, } = {})

textureKtxLevelAlignment(format = 'rgba8unorm', supercompressionScheme = 0)

alignByteOffset(byteOffset, alignment = 1)

textureKtxMipPadding(byteOffset, format = 'rgba8unorm', supercompressionScheme = 0)

textureKtxSupercompressionLevelReport({ byteLength = 0, uncompressedByteLength = byteLength, supercompressionScheme = 0, expectedUncompressedByteLength = null, faceCount = 1, layerCount = 1, } = {})

textureKtxSupercompressionGlobalDataRange({ byteOffset = 0, byteLength = 0, precedingByteEnd = 0, supercompressionScheme = 0, } = {})

textureKtxSupercompressionPolicy({ supercompressionScheme = 0, levels = [], expectedUncompressedByteLengths = null, sgdByteOffset = 0, sgdByteLength = 0, precedingByteEnd = 0, faceCount = 1, layerCount = 1, } = {})

textureContainerImageLayout({ width, height = width, depth = 1, format = 'rgba8unorm', mipLevel = 0, layerCount = 1, faceCount = 1, } = {})

textureContainerImageByteOffset(layout, layer = 0, face = 0, zSlice = 0)

textureWebGpuUploadLayout({ width, height = width, depthOrArrayLayers = 1, format = 'rgba8unorm', mipLevel = 0, offset = 0, bytesPerRowAlignment = 1, copyBufferToTexture = false, } = {})

textureKtxLevelLayout({ width, height = width, depth = 1, format = 'rgba8unorm', levelCount = textureMipLevelCount(width, height, depth)

textureMemorySavingsRatio(width, height, compressedFormat, referenceFormat = 'rgba8unorm', mipLevels = 1)

textureQualitySizeScore({ width, height = width, format = 'rgba8unorm', referenceFormat = 'rgba8unorm', mipLevels = 1, depthOrArrayLayers = 1, quality = 1, byteBudget = Infinity, budgetBytes = byteBudget, qualityWeight = 0.7, sizeWeight = 0.3, budgetWeight, } = {})

textureTranscodeTargetScore(target, { width, height = width, referenceFormat = 'rgba8unorm', mipLevels = 1, depthOrArrayLayers = 1, supportedFeatures = null, needsAlpha = true, allowPunchthroughAlpha = false, preferSrgb = false, byteBudget = Infinity, qualityWeight = 0.7, sizeWeight = 0.3, budgetWeight, } = {})

textureRankTranscodeTargets({ candidates = null, needsAlpha = true, preferSrgb = false, ...options } = {})

textureStreamingPriorityScore({ priority = 0, distance = Infinity, lastUsedFrame = 0, frameIndex = 0, distanceScale = 0.01, recencyScale = 0.1, distanceWeight = 10, recencyWeight = 5, } = {})

mipLevelFromPixelSize(pixelSize, maxMipLevel = Infinity)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: TextureMath.js shared UV, atlas, format, and mip pyramid helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


uiCssMathFunctionReport(value, context = {})

uiLayoutValueReport(value, context = {})

uiPercentageBasisReport(value, basis, options = {})

uiViewportUnitReport(value, viewport = {}, options = {})

uiSafeAreaInsetReport(insets = {}, options = {})

uiVisualViewportReport(observed = {}, options = {})

uiLayoutClampReport(value, minValue, maxValue, context = {})

uiBoxConstraintReport(style = {}, context = {})

uiFlexBasisReport(style = {}, context = {})

uiIntrinsicSizePolicyReport(value = 'auto', options = {})

uiGridTrackSizingReport(trackList = [], options = {})

uiResponsiveStepReport(value, steps = [], options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: UILayoutMath.js pure CSS/UI length, constraint, and responsive layout reports. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/math/UnionFind.js
Classes
class UnionFind
class VoxelUnionFind extends UnionFind
class HybridConnectivity
Notes & Examples
Math Library Conventions

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Reset all elements to be their own component Find the root of element x with path compression Union two components by rank Check if two elements are in the same component Get the size of the component containing x Get all unique component roots Get number of distinct components Get all elements in the same component as x Union Find specialized for 3D voxel grids Method Signature Summary Convert 3D position to linear index Convert linear index to 3D position Check if position is within grid bounds Get 6 connected neighbor indices Add a voxel and update connectivity Remove a voxel NOTE: This may require recomputation Union Find doesn't support efficient splits Check if a voxel is connected to anchor Get all floating (unanchored) voxel indices Get floating components as separate groups Combines GPU flood fill for initial/full recomputes with CPU Union Find for incremental updates Method Signature Summary Initialize from voxel data Add a voxel (fast incremental) Remove a voxel (may trigger recompute) Process any pending recomputes Check if voxel is anchored Get floating voxels Get floating components <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library