kaolin/index.js

kaolin/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: engine/kaolin — Kaolin equivalent 3D Geometry Toolkit WebGPU native geometry operations inspired by NVIDIA Kaolin. Provides representation conversions, mesh ops, SDF tools, point cloud ops, and physics bridges for the engine's particle/softbody/mesh/voxel systems. Usage: import { ops } from '../kaolin/index.js'; const he = new ops.mesh.HalfEdgeMesh(positions, indices); const normals = ops.mesh.computeVertexNormals(positions, indices); Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


writeOBJ(positions, indices, options = {})

writePLY(positions, indices, options = {})

writeSTL(positions, indices, normals = null)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MeshIO.js — Programmatic mesh import/export (OBJ, PLY, STL) Pure JS parsers/writers for common mesh formats. No dependencies — works with fetch() or FileReader in browser. All outputs use the Kaolin convention: positions: Float32Array stride 3 indices: Uint32Array stride 3 normals: Float32Array stride 3 (optional) uvs: Float32Array stride 2 (optional) Compatible with: MeshOps.js, MeshSubdivision.js, MeshTetrahedralize.js Editor GLB loader (supplementary path for non GLB formats) EntityMeshRenderer Functions Parse an OBJ string into mesh data. Parameters: (string) — — OBJ file content (Object) — No description in source JSDoc. (boolean) — — swap Y and Z axes (default false) Returns: } Write mesh data to OBJ format string. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (Object) — No description in source JSDoc. (Float32Array) — — stride 3 (Float32Array) — — stride 2 (string) — — object name Returns: — OBJ file content Parse a PLY file (ArrayBuffer) into mesh data. Supports ASCII and binary little endian formats. Parameters: (ArrayBuffer) — — raw file bytes Returns: } Write mesh data to PLY format (ASCII). Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (Object) — No description in source JSDoc. (Float32Array) — — stride 3 (Uint8Array) — — stride 3 (RGB, 0 255) Returns: — PLY file content Parse an STL file (ArrayBuffer) into mesh data. Auto detects ASCII vs binary. Parameters: (ArrayBuffer) — — raw file bytes Returns: } Write mesh data to binary STL format. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (Float32Array) — — face normals stride 3 (optional, computed if missing) Load a mesh from URL (auto detects format from


— — stride 3 (Uint32Array) — — stride 3 (Float32Array) — — face normals stride 3 (optional, computed if missing) Load a mesh from URL (auto detects format from extension). Parameters: (string) — No description in source JSDoc. Returns: } Download mesh as a file (browser). <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


writePLYPointCloud(points, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PointCloudIO.js — Point cloud import/export (PLY, PCD, XYZ) Pure JS parsers/writers for point cloud formats. Outputs: Float32Array positions (stride 3) + optional normals/colors. Compatible with: PointCloudOps.js MeshToPoints.js / PointsToMesh.js Particle system (direct spawn from loaded points) Functions Load a point cloud from PLY (ArrayBuffer). Ignores face data — returns only vertex positions + attributes. Parameters: (ArrayBuffer) — No description in source JSDoc. Returns: } Write a point cloud to PLY format (ASCII string, no faces). Parameters: (Float32Array) — — stride 3 (Object) — No description in source JSDoc. (Float32Array) — — stride 3 (Uint8Array) — — stride 3 (RGB 0 255) Parse XYZ text format. Each line: x y z [nx ny nz] [r g b] Parameters: (string) — No description in source JSDoc. Returns: } Write points to XYZ text format. Parameters: (Float32Array) — — stride 3 (Object) — No description in source JSDoc. (Float32Array) — — stride 3 (Float32Array) — — stride 3 (0 1 range) Parse PCD text format (ASCII only). Parameters: (string) — No description in source JSDoc. Returns: } Write points to PCD ASCII format. Parameters: (Float32Array) — — stride 3 (Object) — No description in source JSDoc. (Float32Array) — — stride 3 Load a point cloud from URL (auto detects format from extension). Parameters: (string) — No description in source JSDoc. Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/io/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Kaolin IO — Barrel exports Mesh and point cloud import/export (OBJ, PLY, STL, XYZ, PCD). Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


chamferDistance(pointsA, pointsB, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ChamferDistance.js — Bidirectional nearest neighbor distance metric Measures how close two point sets (or meshes) are to each other. For each point in A, find nearest in B (and vice versa), average the distances. Standard metric in 3D reconstruction / generative model evaluation. Used by: agi/ training loops, mesh quality assessment, LOD validation. CPU path with spatial hash acceleration. For GPU path, see future WebGPU compute implementation. Functions Compute Chamfer Distance between two point sets. CD(A, B) = (1/ A ) Σ min {b∈B} a b ² + (1/ B ) Σ min {a∈A} b a ² Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 (Object) — No description in source JSDoc. (boolean) — — return squared distances (default true) (boolean) — — compute both directions (default true) (string) — — 'mean' 'sum' (default 'mean') Returns: } Compute per point nearest distances from A to B. Useful for visualization (color coded error maps). Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 Returns: — per point squared distances, length = nA Approximate Earth Mover's Distance via auction algorithm. Both point sets must have the same number of points. This is O(n²) and practical only for small sets (<1000 points). Parameters: (Float32Array) — — stride 3, n points (Float32Array) — — stride 3, n points (same count) Returns: — approximate EMD <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/metrics/GPUMetrics.js
Classes
class GPUMetrics
Functions
getGPUMetrics(device)
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: GPUMetrics.js — WebGPU compute shader accelerated 3D distance metrics GPU accelerated implementations of: Chamfer Distance (bidirectional nearest neighbor) Hausdorff Distance (max nearest neighbor) Mean Distance / RMSE For each point in set A, a compute shader finds the nearest point in set B using a brute force O(N M) scan parallelized across workgroups. Results are reduced on the GPU via a parallel reduction pass. Falls back to CPU path (ChamferDistance.js / HausdorffDistance.js) if WebGPU is unavailable or point counts are below the GPU beneficial threshold ( 2000). Usage: const gpu = new GPUMetrics(device); const result = await gpu.chamferDistance(pointsA, pointsB); Classes Method Signature Summary Lazy init pipelines on first use. GPU accelerated Chamfer Distance. GPU accelerated Hausdorff Distance. GPU accelerated RMSE (Root Mean Squared Error of nearest neighbor distances). Run nearest neighbor compute + reduction in one direction. Destroy cached pipelines. Functions Get or create a singleton GPUMetrics instance. Parameters: (GPUDevice) — No description in source JSDoc. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


hausdorffDistance(pointsA, pointsB, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: HausdorffDistance.js — Maximum surface deviation metric Measures the worst case distance between two point sets or meshes. Hausdorff(A, B) = max( max {a∈A} min {b∈B} a b , max {b∈B} min {a∈A} b a ) Variants: Standard Hausdorff (max of mins) Percentile Hausdorff (e.g. 95th percentile — more robust to outliers) Directed Hausdorff (one direction only) Used by: mesh quality validation, LOD error bounds, surface fitting. Functions Compute Hausdorff distance between two point sets. Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 (Object) — No description in source JSDoc. (boolean) — — compute both directions (default true) (number) — — use percentile instead of max (0 100, default 100 = exact) Returns: } Compute per point minimum distances from A to B. Returns the distance of each point in A to its nearest neighbor in B. Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 Returns: — per point distances (not squared), length = nA Compute RMSE (Root Mean Square Error) between two point sets. Symmetric: averages both directions. Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 Compute mean absolute distance between two point sets (one direction). Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


volumetricIoU(positionsA, indicesA, positionsB, indicesB, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: VolumetricIoU.js — Intersection over Union for 3D shapes Measures overlap between two 3D shapes by voxelizing both and computing intersection / union . Also supports direct voxel grid inputs (skip re voxelization). Used by: agi/ training loops, mesh reconstruction quality, shape matching. Functions Compute Volumetric IoU between two triangle meshes. Voxelizes both at the same resolution/origin, then counts overlap. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (Object) — No description in source JSDoc. (number) — — voxels per longest axis (default 32) (boolean) — — fill interiors before comparing (default true) Returns: } Compute IoU directly from two voxel grids (same dimensions). Parameters: (Uint8Array) — No description in source JSDoc. (Uint8Array) — No description in source JSDoc. Returns: } F Score: harmonic mean of precision and recall at a distance threshold. Precision = fraction of predicted points within threshold of ground truth. Recall = fraction of ground truth points within threshold of prediction. Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 (number) — — distance threshold Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/metrics/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Kaolin Metrics — Barrel exports 3D shape comparison metrics for training loops and quality assessment. Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


dualContouringSDF(sdf, resX, resY, resZ, options = {})

dualContouringFunction(sdfFn, boundsMin, boundsMax, resolution = 64, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: DualContouring.js — Sharp feature preserving isosurface extraction Implements Dual Contouring (Ju et al., 2002) for extracting triangle meshes from SDF fields while preserving sharp edges and corners that Marching Cubes rounds off. Uses Hermite data (intersection points + normals on sign changing edges) and QEF (Quadratic Error Function) minimization to optimally place vertices within cells. Features: QEF vertex placement via SVD free normal equations solver Sharp edge/corner detection via eigenvalue analysis Adaptive sharpness threshold (user configurable) Manifold quad→tri output with consistent winding Works with grid SDF arrays or analytical SDF functions Compatible with: SDFToMesh.js (same input/output conventions) MeshToVoxel.js voxelGridToSDF() output CSGShape.js V2 boolean operations Functions Extract an isosurface from a 3D SDF grid using Dual Contouring. Parameters: (Float32Array) — — signed distance values [x + y resX + z resX resY] (number) — — grid resolution X (number) — — grid resolution Y (number) — — grid resolution Z (Object) — No description in source JSDoc. (number[]) — — world position of grid corner (default [0,0,0]) (number) — — size of each voxel (default 1) (number) — — isosurface threshold (default 0) (number) — — sharpness threshold 0 1 (default 0.3, higher = sharper) Returns: } Dual Contour an analytical SDF function. Parameters: (Function) — — (x, y, z) = signed distance (number[]) — — [x, y, z] minimum corner (number[]) — — [x, y, z] maximum corner (number) — — voxels per longest axis (default 64) (Object) — No description in source JSDoc. (number) — — 0 1, higher = sharper features (default 0.3) Returns: } <! HUMAN NOTES Notes & Examples No hand


64) (Object) — No description in source JSDoc. (number) — — 0 1, higher = sharper features (default 0.3) Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


flexiCubesSDF(sdf, resX, resY, resZ, options = {})

flexiCubesFunction(sdfFn, boundsMin, boundsMax, resolution = 64, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: FlexiCubes.js — Flexible Marching Cubes mesh extraction An improved isosurface extraction inspired by NVIDIA's FlexiCubes (2023). Key improvements over standard Marching Cubes: 1. Flexible edge vertices — Instead of fixed linear interpolation along edges, vertex positions can be adjusted (flexed) to better approximate the true surface, improving triangle quality. 2. Flexible dual vertices — Each cube gets a "dual vertex" (interior point) that can be optimized. Quads are formed connecting dual vertices of adjacent cubes across sign changing edges, then split into tris. 3. Adaptive splitting — Quad to triangle splitting direction is chosen to minimize the max angle, producing more uniform triangulations. 4. Gradient aware vertex placement — Uses SDF gradient (surface normal) to project dual vertices onto the isosurface for better accuracy. Compatible with: SDFToMesh.js (same API conventions) DualContouring.js (complementary approach) MeshToVoxel.js voxelGridToSDF() output Functions Extract an isosurface from a 3D SDF grid using FlexiCubes. Parameters: (Float32Array) — — signed distance values [x + y resX + z resX resY] (number) — — grid resolution X (number) — — grid resolution Y (number) — — grid resolution Z (Object) — No description in source JSDoc. (number[]) — — world position of grid corner [0,0,0] (number) — — size of each voxel (default 1) (number) — — isosurface threshold (default 0) (number) — — vertex flex strength 0 1 (default 0.5) Returns: } FlexiCubes extraction from an analytical SDF function. Parameters: (Function) — — (x, y, z) = signed distance (number[]) — — [x, y, z] minimum corner (number[]) — — [x, y, z] maximum corner (number) — — voxels per longest axis


(Function) — — (x, y, z) = signed distance (number[]) — — [x, y, z] minimum corner (number[]) — — [x, y, z] maximum corner (number) — — voxels per longest axis (default 64) (Object) — No description in source JSDoc. (number) — — 0 1 vertex flexibility (default 0.5) Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


sampleUniform(positions, indices, numSamples, options = {})

samplePoissonDisk(positions, indices, minDist, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MeshToPoints.js — Sample points from triangle meshes Three sampling strategies: 1. Uniform random — area weighted triangle sampling (fast) 2. Poisson disk — blue noise distribution (quality) 3. Farthest point — greedy maximin spacing (LOD/coverage) Output: Float32Array of positions (stride 3) + optional normals Compatible with: Particle system (direct spawn from sampled points) MeshToParticlesCompute.js (CPU fallback path) Point cloud operations (PointCloudOps.js) Functions Sample points uniformly on a triangle mesh surface. Uses area weighted triangle selection + barycentric random point. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (number) — — number of points to generate (Object) — No description in source JSDoc. (boolean) — — also output per point normals (default false) (number) — — random seed (default Date.now()) Returns: } Poisson disk sampling on a triangle mesh surface. Produces well distributed (blue noise) point sets. Uses dart throwing with spatial hash acceleration. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (number) — — minimum distance between samples (Object) — No description in source JSDoc. (number) — — attempts per sample (default 30) (number) — — hard cap on samples (default 100000) (boolean) — — output normals (default false) Returns: } Farthest point sampling from a set of candidate points. Iteratively picks the point farthest from all previously selected points. Produces excellent coverage for LOD and feature preserving downsampling. Parameters: (Float32Array) — — stride 3 (input candidates) (number) — — how many to select Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in


— — stride 3 (input candidates) (number) — — how many to select Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


meshToVoxel(positions, indices, options = {})

voxelGridToDensity(grid, resX, resY, resZ)

voxelGridToSDF(grid, resX, resY, resZ, voxelSize)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MeshToVoxel.js — Voxelize any triangle mesh Converts a triangle surface mesh into a 3D voxel grid. Uses conservative voxelization: any voxel that overlaps a triangle is set. Approaches: 1. CPU scanline (simple, robust) — default 2. GPU compute (fast, for large meshes) — requires WebGPU device Output: Uint8Array (1 = solid, 0 = empty) indexed [x + y resX + z resX resY] Compatible with: engine/voxel/ chunk system (ChunkRegistry) MarchingCubesMesher (feed density field) ConnectivityCompute (structural analysis) VoronoiFracture (fracture source) Functions Voxelize a triangle mesh on the CPU. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (Object) — No description in source JSDoc. (number) — — voxels per longest axis (default 32) (number) — — padding voxels around mesh (default 1) (boolean) — — flood fill interior after surface (default false) Returns: } Convert voxel grid to a density field (Float32Array) for Marching Cubes. Surface voxels get density 0, interior 0, exterior < 0. Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. Returns: — density field, same dimensions Compute a signed distance field from a voxel grid. Uses distance transform (chamfer approximation). Parameters: (Uint8Array) — 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: — signed distance at each voxel center <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a


description in source JSDoc. Returns: — signed distance at each voxel center <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


particlesToMesh(particlePositions, options = {})

particlesToMeshAnisotropic(positions, velocities, options = {})

particlesToMeshFast(positions, radius, resolution = 24)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ParticlesToMesh.js — Convert particle positions into a triangle mesh Generates an isosurface from particle density fields using metaball style implicit functions + Marching Cubes extraction. Use cases: Fluid surface rendering (SPH → mesh) Particle cloud → solid mesh for physics Point sprite → mesh conversion for LOD Compatible with: Particle system readback (ParticleSimWorld positions) FluidMPM / ParticleSPH output SDFToMesh.js (shares MC internals) Functions Build an isosurface mesh from particle positions using metaball density. Each particle contributes a smooth falloff: d(r) = 1 (r/radius)^2 summed at each grid point. Isosurface at threshold extracts the mesh. Parameters: (Float32Array) — — stride 3 (Object) — No description in source JSDoc. (number) — — influence radius per particle (default auto) (number) — — density isosurface value (default 1.0) (number) — — grid voxels per longest axis (default 32) (number) — — padding voxels (default 2) (Float32Array) — — per particle radii (overrides uniform radius) (string) — — 'poly6' 'metaball' 'wyvill' (default 'poly6') Returns: } Build mesh from particles with anisotropic kernels. Each particle's influence is stretched along its velocity direction. Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 (same count as positions) (Object) — No description in source JSDoc. (number) — — base radius (default auto) (number) — — stretch factor along velocity (default 2.0) (number) — — grid res (default 32) (number) — — density threshold (default 1.0) Returns: } Quick mesh from particles using a simple point to voxel splat. Faster than full metaball but lower quality. Good for preview/LOD. Parameters: (Float32Array) — —


mesh from particles using a simple point to voxel splat. Faster than full metaball but lower quality. Good for preview/LOD. Parameters: (Float32Array) — — stride 3 (number) — — splat radius (number) — — grid res (default 24) Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


ballPivoting(points, normals, radius, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PointsToMesh.js — Surface reconstruction from point clouds Converts unstructured 3D point sets into triangle meshes. Approaches: 1. Ball Pivoting Algorithm (BPA) — requires oriented normals 2. Poisson Surface Reconstruction (simplified) — smooth, gap filling 3. Alpha Shapes — convex hull variant with concavity control Compatible with: MeshToPoints.js output (round trip) Particle system readback positions LiDAR / scan data Functions Ball Pivoting Algorithm for surface reconstruction. Rolls a ball of given radius over the point cloud; when it touches exactly 3 points it creates a triangle. Requires oriented normals for consistent triangle winding. Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 (oriented outward) (number) — — ball radius (Object) — No description in source JSDoc. (number) — — hard cap (default 200000) Returns: } Alpha shape surface reconstruction. Computes 3D Delaunay tetrahedralization, then removes tetrahedra whose circumradius exceeds 1/alpha. Extracts boundary triangles. Parameters: (Float32Array) — — stride 3 (number) — — controls concavity (larger = more convex) Returns: } Convex hull of a 3D point set. Uses incremental algorithm. For large sets, prefer GPUConvexHull.js. Parameters: (Float32Array) — — stride 3 Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


sdfToMesh(sdf, resX, resY, resZ, options = {})

sdfFunctionToMesh(sdfFn, boundsMin, boundsMax, resolution = 64, options = {})

sdfCSGToMesh(ops, boundsMin, boundsMax, resolution = 64)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SDFToMesh.js — Extract triangle mesh from a Signed Distance Field Converts a 3D SDF volume (Float32Array grid) into a triangle mesh using Marching Cubes. This is the CPU path for Kaolin conversions; for GPU accelerated MC see engine/voxel/MarchingCubesMesher.js. Also supports evaluating analytical SDF functions directly. Compatible with: MeshToVoxel.js voxelGridToSDF() output MeshSDFGenerator.js baked SDF textures SDFCollision.js primitives FlexiCubes (future Phase 3+) Functions Extract an isosurface from a 3D SDF grid using Marching Cubes. Parameters: (Float32Array) — — signed distance values, indexed [x + y resX + z resX resY] (number) — — grid resolution X (number) — — grid resolution Y (number) — — grid resolution Z (Object) — No description in source JSDoc. (Float32Array) — — world position of grid corner (default [0,0,0]) (number) — — size of each voxel (default 1) (number) — — isosurface threshold (default 0) Returns: } Mesh an analytical SDF function by evaluating it on a grid. Parameters: (Function) — — (x, y, z) = signed distance (Float32Array) — — [x, y, z] minimum corner (Float32Array) — — [x, y, z] maximum corner (number) — — voxels per longest axis (default 64) (Object) — No description in source JSDoc. (number) — — threshold (default 0) Returns: } Mesh a CSG combination of SDF primitives. Accepts an array of { sdf: fn(x,y,z), op: 'union' 'subtract' 'intersect' }. Parameters: (Array) — — [{ sdf: Function, op: string }] (Float32Array) — No description in source JSDoc. (Float32Array) — No description in source JSDoc. (number) — No description in source JSDoc. Returns: } Sphere SDF centered at origin Box SDF centered at origin Torus SDF centered at origin, in XZ plane


JSDoc. (number) — No description in source JSDoc. Returns: } Sphere SDF centered at origin Box SDF centered at origin Torus SDF centered at origin, in XZ plane Cylinder SDF centered at origin, along Y axis Translate an SDF function Smooth union of two SDF functions <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/ops/conversions/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Kaolin Conversions — Barrel exports Representation conversion modules: Mesh ↔ Voxel Mesh ↔ Points Mesh ↔ SDF Particles → Mesh Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/ops/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: engine/kaolin/ops — Geometry operations Primitive processing functions for batched 3D models: meshes, voxelgrids, point clouds, and conversions between them. Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


computeFaceNormals(positions, indices, normalize = true)

laplacianSmooth(positions, indices, iterations = 1, lambda = 0.5, pinned = null)

taubinSmooth(positions, indices, iterations = 5, lambda = 0.5, mu = -0.53, pinned = null)

cotangentLaplacianSmooth(positions, indices, lambda = 0.5, pinned = null)

fromInterleavedBuffer(interleavedBuffer, stride, posOffset, indexBuffer)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MeshOps.js — Core Mesh Operations for Kaolin style 3D Geometry Toolkit Provides half edge data structure, adjacency queries, normals, area, Laplacian smoothing, validation, and mesh analysis. All operations work on flat typed arrays (GPU friendly) with optional object wrappers. Data format (Kaolin convention): positions: Float32Array — stride 3 (x, y, z per vertex) indices: Uint32Array — stride 3 (v0, v1, v2 per triangle) Compatible with existing engine systems: MeshDecimation.js (Vertex/Triangle classes) MeshCutter.js (plain [x,y,z] arrays) GPUSoftBody.js (SoA GPU buffers) EntityMeshRenderer (interleaved vertex buffers) Classes Index based half edge mesh representation. Each half edge stores: vertex — index of the vertex it points TO face — index of the face it belongs to ( 1 for boundary) twin — index of the opposite half edge ( 1 if boundary) next — index of the next half edge in the face loop prev — index of the previous half edge in the face loop Stored as parallel typed arrays for cache efficiency. Method Signature Summary Build the half edge connectivity from triangle soup. Get the source vertex of a half edge. Get the target vertex of a half edge. Is this half edge on the boundary (no twin)? Is this mesh closed (no boundary edges)? Iterate all half edges leaving a vertex (one ring traversal). Get all vertex indices adjacent to vertex v (one ring neighbors). Get all face indices adjacent to vertex v. Get face indices sharing an edge with face f. Get all boundary half edge indices (those with no twin). Get ordered boundary loops (arrays of vertex indices). Euler characteristic: V E + F For a closed genus 0 mesh, this should be 2. Get the valence (degree) of each vertex.


boundary loops (arrays of vertex indices). Euler characteristic: V E + F For a closed genus 0 mesh, this should be 2. Get the valence (degree) of each vertex. Functions Compute per face normals (unnormalized = area weighted, or normalized). Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (boolean) — — if true, unit length normals Returns: — stride 3, length = numFaces 3 Compute per vertex normals via area weighted average of adjacent face normals. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 Returns: — stride 3, length = numVerts 3 Compute per vertex normals weighted by the angle at each vertex in each face. More accurate than area weighted for meshes with very different triangle sizes. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 Returns: — stride 3, length = numVerts 3 Compute area of each triangle face. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 Returns: — length = numFaces Total surface area of the mesh. Parameters: (Float32Array) — No description in source JSDoc. (Uint32Array) — No description in source JSDoc. Signed volume of a closed triangle mesh (divergence theorem). Positive if normals point outward with consistent winding. Parameters: (Float32Array) — No description in source JSDoc. (Uint32Array) — No description in source JSDoc. Compute lengths of all unique edges. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 Returns: } Compute axis aligned bounding box. Parameters: (Float32Array) — — stride 3 Returns: } Build vertex to vertex adjacency (sparse neighbor lists). Parameters: (Uint32Array) — — stride 3 (number) — No description in source JSDoc. Returns: — adjacency[v] = [neighbor indices] Build vertex to face adjacency. Parameters: (Uint32Array) — —


stride 3 (number) — No description in source JSDoc. Returns: — adjacency[v] = [neighbor indices] Build vertex to face adjacency. Parameters: (Uint32Array) — — stride 3 (number) — No description in source JSDoc. Returns: — vertexFaces[v] = [face indices] Build face to face adjacency (faces sharing an edge). Parameters: (Uint32Array) — — stride 3 (number) — No description in source JSDoc. Returns: — faceAdj[f] = [adjacent face indices] Uniform Laplacian smoothing (iterative). Moves each vertex toward the centroid of its neighbors. Parameters: (Float32Array) — — stride 3 (modified in place) (Uint32Array) — — stride 3 (number) — — number of smoothing passes (default 1) (number) — — step size 0..1 (default 0.5) (Set null


loopSubdivide(positions, indices, options = {})

loopSubdivideMulti(positions, indices, levels = 1, options = {})

catmullClarkSubdivide(positions, faceIndices, faceVertCounts, options = {})

catmullClarkSubdivideMulti(positions, faceIndices, faceVertCounts, levels = 1, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MeshSubdivision.js — Loop & Catmull Clark Subdivision Subdivision surface algorithms for the Kaolin geometry toolkit. Loop Subdivision (Charles Loop, 1987): Operates on triangle meshes only Inserts edge midpoints, reconnects into 4 sub triangles per face Uses β weighting for smooth limit surface (Warren weights) Boundary edges get special 1/8, 3/4, 1/8 stencil Catmull Clark Subdivision (Catmull & Clark, 1978): Operates on quad or mixed meshes Face points → edge points → vertex points → reconnect Converges to C² (bi cubic B spline) surface away from extraordinary verts Triangle input is first converted to all quad via 1 to 3 split Both algorithms support: Boundary handling (crease preservation) Pinned vertices (kept fixed) Multiple subdivision levels Data format matches MeshOps.js: positions: Float32Array — stride 3 indices: Uint32Array — stride 3 (triangles) or stride 4 (quads) Functions Perform one level of Loop subdivision on a triangle mesh. Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 3 (triangles only) (Object) — No description in source JSDoc. (Set null) — — vertex indices to keep fixed (Set null) — — edge keys (lo 0x100000+hi) to treat as creases Returns: } Perform multiple levels of Loop subdivision. Parameters: (Float32Array) — No description in source JSDoc. (Uint32Array) — No description in source JSDoc. (number) — — subdivision levels (default 1) (Object) — — passed to each level Returns: } Perform one level of Catmull Clark subdivision. Input can be triangle or quad faces (mixed is allowed). triangles: indices stride 3, faceVertCounts = [3, 3, ...] quads: indices stride 4, faceVertCounts = [4, 4, ...] mixed: flat indices + faceVertCounts array For


triangles: indices stride 3, faceVertCounts = [3, 3, ...] quads: indices stride 4, faceVertCounts = [4, 4, ...] mixed: flat indices + faceVertCounts array For simplicity, this implementation accepts two formats: 1. (positions, quadIndices) — all quad, quadIndices = Uint32Array stride 4 2. (positions, triIndices, { triangleInput: true }) — converts tris to quads first Parameters: (Float32Array) — — stride 3 (Uint32Array) — — flat face indices (number[]) — — verts per face (3 or 4 each) (Object) — No description in source JSDoc. (Set null) — — vertices to keep fixed Returns: } Perform multiple levels of Catmull Clark subdivision. Parameters: (Float32Array) — No description in source JSDoc. (Uint32Array) — No description in source JSDoc. (number[]) — No description in source JSDoc. (number) — No description in source JSDoc. (Object) — No description in source JSDoc. Returns: } Convert a triangle mesh to the faceIndices + faceVertCounts format expected by catmullClarkSubdivide. Parameters: (Uint32Array) — — stride 3 Returns: } Convert Catmull Clark output (all quads) to triangles for rendering. Each quad is split into 2 triangles along the shorter diagonal. Parameters: (Float32Array) — No description in source JSDoc. (Uint32Array) — No description in source JSDoc. (number[]) — No description in source JSDoc. Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


tetrahedralize(positions, indices, options = {})

tetrahedralizeGrid(positions, indices, gridRes = 6)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: MeshTetrahedralize.js — Surface Mesh → Tetrahedral Mesh Converts a closed triangle surface mesh into a tetrahedral volume mesh suitable for FEM soft body simulation (GPUSoftBody.js). Algorithm: Constrained Delaunay Tetrahedralization 1. Compute bounding box, generate interior sample points 2. Combine surface vertices + interior points 3. Build Delaunay tetrahedralization via incremental insertion 4. Remove tets outside the surface (using winding number or ray test) 5. Output: nodePositions (Float32Array stride 3) + tetIndices (Uint32Array stride 4) The output format matches GPUSoftBody.createSoftBody() exactly: nodePositions: Float32Array — [x0, y0, z0, x1, y1, z1, ...] tetIndices: Uint32Array — [n0, n1, n2, n3, ...] (4 per tet) References: Si, "TetGen: A Delaunay Based Quality Tetrahedral Mesh Generator" (2015) Shewchuk, "Tetrahedral Mesh Generation by Delaunay Refinement" (1998) Jacobson et al., "Robust Inside Outside Segmentation using Generalized Winding Numbers" (2013) Functions Tetrahedralize a closed triangle surface mesh. Parameters: (Float32Array) — — surface vertex positions, stride 3 (Uint32Array) — — surface triangle indices, stride 3 (Object) — No description in source JSDoc. (number) — — interior sample density (default 8, range 4 32) (number) — — min tet quality ratio (default 2.0, lower = more tets) (boolean) — — keep surface verts as is (default true) Returns: } Quick tetrahedralize using simple grid based approach. Faster but lower quality than full Delaunay. Good for real time use. Parameters: (Float32Array) — — surface vertex positions, stride 3 (Uint32Array) — — surface triangle indices, stride 3 (number) — — grid resolution per axis (default 6) Returns: }


— — surface vertex positions, stride 3 (Uint32Array) — — surface triangle indices, stride 3 (number) — — grid resolution per axis (default 6) Returns: } Compute quality ratio for each tet (radius ratio = circumradius / inradius). Ideal = 3 (regular tet). Higher = worse (slivers). Parameters: (Float32Array) — — stride 3 (Uint32Array) — — stride 4 Returns: — quality per tet Extract the surface triangles of a tetrahedral mesh. Surface faces are those that belong to exactly one tetrahedron. Parameters: (Uint32Array) — — stride 4 Returns: — surface triangle indices, stride 3 <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/ops/mesh/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: engine/kaolin/ops/mesh — Core mesh operations Half edge data structure, adjacency, normals, area, Laplacian smoothing, validation, and subdivision surfaces (Loop + Catmull Clark). Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


knnQuery(points, grid, cellSize, qi, k, maxRadius = Infinity)

estimateNormals(points, k = 12, options = {})

estimateCurvature(points, normals, k = 12)

removeStatisticalOutliers(points, k = 20, stdRatio = 2.0)

removeRadiusOutliers(points, radius, minNeighbors = 3)

voxelDownsample(points, voxelSize, normals = null)

cropToSphere(points, cx, cy, cz, radius)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PointCloudOps.js — Point cloud geometric analysis Operations on unstructured 3D point sets: k NN queries via spatial hash Normal estimation (PCA on local neighborhood) Curvature estimation (from fitted normals) Statistical outlier removal Voxel downsampling Centroid / bounding box / oriented bounding box Normal orientation propagation (MST based) Compatible with: MeshToPoints.js output Particle system readback (Float32Array stride 3) PointsToMesh.js input (provides normals for BPA) Functions Build a spatial hash for fast neighbor queries. Parameters: (Float32Array) — — stride 3 (number) — No description in source JSDoc. Find k nearest neighbors for a single query point. Parameters: (Float32Array) — — stride 3 (Map<string, number[] ) — — from buildSpatialHash (number) — — hash cell size (number) — — query point index (number) — — number of neighbors (number) — — search radius (default Infinity) Returns: — indices of k nearest neighbors (sorted by distance) Batch k NN for all points. Parameters: (Float32Array) — — stride 3 (number) — — neighbors per point (number) — — optional max radius Returns: } Estimate normals for a point cloud using PCA on local neighborhoods. For each point, finds k nearest neighbors and fits a plane via PCA. The normal is the eigenvector corresponding to the smallest eigenvalue of the covariance matrix. Parameters: (Float32Array) — — stride 3 (number) — — neighborhood size (default 12) (Object) — No description in source JSDoc. (Float32Array) — — [x,y,z] for consistent orientation (default [0,0,0]) (boolean) — — use MST propagation for global consistency (default false) Returns: — normals, stride 3 Estimate per point curvature from normals and neighborhood.


— — use MST propagation for global consistency (default false) Returns: — normals, stride 3 Estimate per point curvature from normals and neighborhood. Uses the ratio of the smallest eigenvalue to the sum of eigenvalues. Parameters: (Float32Array) — — stride 3 (Float32Array) — — stride 3 (from estimateNormals) (number) — — neighborhood size (default 12) Returns: — per point curvature [0..1], 0=flat, 1=high curvature Remove statistical outliers based on mean distance to k neighbors. Points with mean distance (global mean + stdRatio global std) are removed. Parameters: (Float32Array) — — stride 3 (number) — — neighbors to check (default 20) (number) — — standard deviation multiplier (default 2.0) Returns: } Remove points with fewer than minNeighbors within given radius. Parameters: (Float32Array) — — stride 3 (number) — — search radius (number) — — minimum count (default 3) Returns: } Downsample a point cloud by averaging points within each voxel cell. Parameters: (Float32Array) — — stride 3 (number) — — grid cell size (Float32Array) — — optional stride 3 (averaged per voxel) Returns: } Compute axis aligned bounding box. Compute centroid of a point cloud. Compute oriented bounding box via PCA. Returns axes (3 Float32Array[3]), half extents, and center. Crop points to an axis aligned bounding box. Crop points to a sphere. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/ops/pointcloud/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Kaolin Point Cloud — Barrel exports Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


voxelHollow(grid, resX, resY, resZ, thickness = 1)

voxelDilate(grid, resX, resY, resZ, radius = 1)

voxelErode(grid, resX, resY, resZ, radius = 1)

voxelOpen(grid, resX, resY, resZ, radius = 1)

voxelClose(grid, resX, resY, resZ, radius = 1)

voxelDownsample(grid, resX, resY, resZ, factor = 2)

voxelUpsample(grid, resX, resY, resZ, factor = 2)

connectedComponents(grid, resX, resY, resZ)

removeSmallComponents(grid, resX, resY, resZ, minSize)

extractSurfaceVoxels(grid, resX, resY, resZ)

computeSurfaceArea(grid, resX, resY, resZ, voxelSize)

createSphere(resX, resY, resZ, cx, cy, cz, radius)

createBox(resX, resY, resZ, minX, minY, minZ, maxX, maxY, maxZ)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: VoxelOps.js — Voxel grid operations Operations on binary/scalar 3D voxel grids: Fill interior (flood fill) Hollow (keep only surface shell) CSG boolean: union, intersect, subtract Downsample / upsample Morphological: dilate, erode, open, close Extract isosurface info (surface voxels, boundary) Connected component labeling Grid format: Uint8Array indexed [x + y resX + z resX resY] 1 = solid, 0 = empty (unless scalar grid — Float32Array) Compatible with: MeshToVoxel.js output engine/voxel/ chunk system (ChunkRegistry) ConnectivityCompute.js (structural analysis) VoronoiFracture.js (fracture source) Functions Union of two voxel grids (same dimensions required). Result = A OR B. Parameters: (Uint8Array) — No description in source JSDoc. (Uint8Array) — No description in source JSDoc. Intersection of two voxel grids. Result = A AND B. Subtraction: A minus B. Result = A AND NOT B. Symmetric difference (XOR). Result = A XOR B. Invert a voxel grid. Fill the interior of a closed voxel shell. Uses flood fill from boundary to mark exterior, then inverts. Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. Returns: — new grid with interior filled Hollow a voxel grid — keep only the outer shell (surface voxels). A voxel is surface if it's solid and has at least one empty 6 neighbor. Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — — shell thickness in voxels (default 1) Dilate: expand solid voxels by voxels (6


in source JSDoc. (number) — No description in source JSDoc. (number) — — shell thickness in voxels (default 1) Dilate: expand solid voxels by voxels (6 connected). Erode: shrink solid voxels by voxels (6 connected). Morphological open: erode then dilate (removes small protrusions). Morphological close: dilate then erode (fills small holes). Downsample a voxel grid by factor (majority vote per super voxel). Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — — downsample factor (default 2) Returns: } Upsample a voxel grid by factor (nearest neighbor replication). Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — — upsample factor (default 2) Returns: } Label connected components in a voxel grid (6 connected). Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. Returns: } Remove small connected components below a size threshold. Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — No description in source JSDoc. (number) — — minimum voxel count to keep Extract surface voxels (solid voxels with at least one empty 6 neighbor). Count solid voxels. Compute volume in world units. Compute approximate surface area (count exposed faces × voxelSize²). Create an empty voxel grid. Create a solid sphere in a voxel grid. Create a solid box in a voxel grid. <!


surface area (count exposed faces × voxelSize²). Create an empty voxel grid. Create a solid sphere in a voxel grid. Create a solid box in a voxel grid. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/ops/voxelgrid/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Kaolin Voxel Grid — Barrel exports Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


autoTetMesh(positions, indices, options = {})

createSoftBodyFromMesh(softBodySystem, positions, indices, material = 'rubber', options = {})

generateTetLODs(positions, indices, gridResolutions = [8, 5, 3])

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: AutoTetMesh.js — Automatic surface mesh → tetrahedral mesh → GPUSoftBody bridge One call pipeline: give it a triangle mesh, get back a soft body. Pipeline: 1. Validate + repair mesh (MeshOps.validateMesh) 2. Optionally decimate for performance (MeshDecimation) 3. Tetrahedralize (MeshTetrahedralize) 4. Quality check + optimization 5. Create GPUSoftBody instance Compatible with: GPUSoftBody.createSoftBody() — exact format match MeshDecimation.js — LOD before tet generation EntityMeshRenderer — visual mesh binding MeshTetrahedralize.js — Delaunay + grid methods Functions Full pipeline: surface mesh → tet mesh ready for GPUSoftBody. Parameters: (Float32Array) — — surface mesh vertices (stride 3) (Uint32Array) — — surface mesh triangles (stride 3) (Object) — No description in source JSDoc. (string) — — 'delaunay' 'grid' (default 'grid' for speed) (number) — — grid resolution for grid method (default 6) (number) — — interior points per unit volume for delaunay (default 8) (number) — — hard cap on node count (default 8000) (number) — — hard cap on tet count (default 20000) (boolean) — — run validation first (default true) (boolean) — — smooth surface before tet gen (default false) (number) — — Laplacian smooth iterations (default 2) (boolean) — — optimize tet quality (default true) (Set) — — indices to pin (default null) (string) — — 'none' 'bottom' 'top' 'custom' (default 'none') (number) — — fraction of bbox height for auto pin (default 0.05) Returns: {{ nodePositions: Float32Array, tetIndices: Uint32Array, surfaceIndices: Uint32Array, Create a GPUSoftBody from a surface mesh in one call. Parameters: (GPUSoftBody) — — initialized GPUSoftBody instance (Float32Array) — — surface mesh


Create a GPUSoftBody from a surface mesh in one call. Parameters: (GPUSoftBody) — — initialized GPUSoftBody instance (Float32Array) — — surface mesh vertices (Uint32Array) — — surface mesh triangles (number string) — — material index or preset name (Object) — — passed to autoTetMesh + createSoftBody Returns: null} Batch create multiple soft bodies from meshes. Parameters: (GPUSoftBody) — No description in source JSDoc. (Array) — — [{ positions, indices, material, options }] Returns: — [{ handle, tetResult } null] Generate multiple LOD levels of tet meshes from a single surface mesh. Parameters: (Float32Array) — No description in source JSDoc. (Uint32Array) — No description in source JSDoc. (number[]) — — e.g. [8, 5, 3] Returns: — array of autoTetMesh results, one per LOD Constants — Preset configurations for different use cases. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


extractDeformationModes(capture, numModes = 8)

bakeToAnimation(capture, decomposition, fps = 60)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ParticleSkinning.js — Learned reduced deformation basis from particle sim Inspired by NVIDIA Simplicits: learn a small set of skinning weights that approximate the full FEM simulation at a fraction of the cost. Pipeline: 1. Run full sim for N frames → capture deformation snapshots 2. PCA on displacement field → extract dominant deformation modes 3. Compute skinning weights via least squares fitting 4. At runtime: blend modes with learned weights → fast approximate deformation This enables: Real time soft body preview without FEM solve LOD: near = full FEM, far = skinned approximation Baking physics to animation for replay Compatible with: GPUSoftBody.js — reads back node positions for training EntityMeshRenderer — applies skinned deformation to visual mesh SkeletalAnimation.js — similar weight/bone concept Functions Capture deformation snapshots from a running soft body. Call this each frame during a training run. Returns: — accumulates snapshots Record a frame's deformed positions. Parameters: (DeformationCapture) — No description in source JSDoc. (Float32Array) — — deformed node positions (stride 3) Extract dominant deformation modes via PCA on displacement snapshots. Parameters: (DeformationCapture) — — with accumulated snapshots (number) — — number of modes to extract (default 8) Returns: } Compute skinning weights for each node per deformation mode. Uses least squares: for each snapshot, find mode weights that best reconstruct the displacement. Parameters: (Object) — — from extractDeformationModes (DeformationCapture) — No description in source JSDoc. Returns: } Create a runtime skinning evaluator. Parameters: (Float32Array) — — stride 3 (Float32Array[]) — — from


— No description in source JSDoc. Returns: } Create a runtime skinning evaluator. Parameters: (Float32Array) — — stride 3 (Float32Array[]) — — from extractDeformationModes (Float32Array) — — from extractDeformationModes Evaluate skinned deformation with given mode coefficients. Parameters: (SkinningEvaluator) — No description in source JSDoc. (Float32Array) — — length = numModes Returns: — deformed positions (stride 3) Fit mode coefficients to match a target deformation (least squares). Useful for transitioning from full FEM to skinned approximation. Parameters: (SkinningEvaluator) — No description in source JSDoc. (Float32Array) — — deformed positions to match Returns: — optimal coefficients Bake deformation snapshots into mode coefficient keyframes. Output can drive the skinning evaluator for replay without physics. Parameters: (DeformationCapture) — No description in source JSDoc. (Object) — — from extractDeformationModes (number) — — frames per second of capture (default 60) Returns: } Interpolate baked animation at a given time. Parameters: (Object) — — from bakeToAnimation (number) — — seconds Returns: — interpolated coefficients <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


kaolin/physics/index.js
Exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Kaolin Physics — Barrel exports Physics bridges: auto tet mesh generation + learned skinning. Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


makeRouteCapability({ principal, routeId, allow = DEFAULTROUTEALLOW, constraints = {}, expiresAt = null, singleUse = false, delegable = true, } = {})

attenuateRouteCapability(cap, { allow, predicate, key, label } = {})

authorizesRoute(cap, { principal, routeId, action, epoch, context = {} } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/capability/RouteCapability.js — capability based route access for the Particle Global OS Network Layer (network plan §10). Reuses the Causal State Engine's UCAN style capability primitive (engine/state/authority/Capability.js: makeCapability/attenuate/authorizes) unmodified. A route capability names a principal (device/profile/membership signer fingerprint), the route as its object, and an allow list of route/ verbs enforced via a caveat predicate — narrowing only delegation comes for free from . (also reused as is) tracks issuance, revocation, and single use consumption. Functions Mint a route capability. The capability's own is always ; the actual allow list is enforced by a caveat so it composes correctly with further narrowing. Parameters: (object) — No description in source JSDoc. (string) — holder's signer fingerprint (device/profile/membership) (string) — opaque route id (the capability's object) (string[]) — allowed route/ verbs (default: attach+subscribe) (object) — extra descriptive constraints (message kinds, byte caps, ...) (number) — operational time expiry epoch (boolean) — consumed on first use (e.g. invite capabilities) (boolean) — may be further attenuated/re delegated Returns: frozen capability Narrow an existing route capability's allow list and/or add an arbitrary extra predicate (e.g. "only from this device fingerprint"). Cannot widen beyond the parent's allow list — throws if it would. Parameters: (object) — parent capability (from makeRouteCapability) (object) — No description in source JSDoc. (string[]) — a subset of the parent's allow list ((ctx:object)= boolean) — extra caveat predicate (string) — No description in source JSDoc. (string) — No


(string[]) — a subset of the parent's allow list ((ctx:object)= boolean) — extra caveat predicate (string) — No description in source JSDoc. (string) — No description in source JSDoc. Returns: new, strictly narrower capability Check whether a capability authorizes a specific route action right now. Parameters: (object) — No description in source JSDoc. (object) — No description in source JSDoc. (string) — requester's signer fingerprint (string) — No description in source JSDoc. (string) — one of ROUTE ACTIONS (number) — No description in source JSDoc. (object) — extra caveat context Returns: } Create a fresh registry to issue/revoke/consume route capabilities in. Constants — Default allow list for a freshly minted route capability (network plan §10). — All route verbs the network layer currently understands. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


selectAnonymityMode({ isSelfDevice = false, groupApproved = false, trustPending = false, highRiskOverride = false } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/carrier/AnonymityMode.js — connection mode selection + UI transport truth labels (network plan §25/§42): the UI must never claim a connection is more private than it actually is. Functions Decide the anonymity mode for a peer relationship (network plan §25 policy: unknown/public anonymous; new invites anonymous until approved; group members group policy; trusted/own devices direct). Parameters: (object) — No description in source JSDoc. (boolean) — No description in source JSDoc. (boolean) — No description in source JSDoc. (boolean) — No description in source JSDoc. (boolean) — force anonymous regardless of trust Returns: one of ANONYMITY MODE Human readable, honest transport label for the UI (§42). Whether a mode permits direct (non relayed) transport — direct may reveal network metadata to the peer (§42). Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


evaluateForward({ packet, dedupeCache, rateLimiter, dedupeTtlMs = 60000, now = Date.now()

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/carrier/CarrierForwarder.js — the forwarding decision a carrier node makes for a sealed packet, WITHOUT ever inspecting its payload (network plan §24/§35/§36): expiry, hop limit (TTL), dedupe, and rate limit, in that order. Reuses as is (network plan §29 dedupe applies uniformly to control/route/carrier traffic). Functions Decide whether to forward a carrier packet. Parameters: (object) — No description in source JSDoc. (object) — from makeCarrierPacket() (object) — from createDedupeCache() (object) — from createRateLimiter() (number) — =60000] (number) — No description in source JSDoc. Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/carrier/CarrierIdentity.js — announces a node's carrier layer (§26) ECDH onion recipient public key to its current mesh peers. Closes the gap 's own doc flagged: "another peer can only address this device as an onion hop if it learned the key out of band." This is that in band announce: a tiny message sent over the SAME mesh session data channel (via , typically from ), cached locally so a future call can look up a hop's key without any prior out of band exchange. Deliberately NOT signed/verified against a stronger identity (e.g. the CSE profile/device signer) — WebRTC's own DTLS already authenticates "these bytes came from the peer this data channel is connected to"; the remaining trust question (should carrier packets even be routed through this specific peer) is a routing/reputation decision for the caller, not this module's job. only checks that the announce's claimed peerId matches the channel it arrived on (fails closed on mismatch — either a bug or a spoof attempt). Functions Create an empty registry of peerId carrier recipient ECDH public key. Build the announce message to hand to a mesh session's . Returns null if this node has no key to announce. Feed every relevant message through this, alongside / / 's own handlers (same chaining pattern). Returns: true if this message was a carrier identity announce (handled) Look up a previously announced peer's carrier recipient ECDH public key (raw bytes), or null. List peerIds this node has learned a carrier recipient key for. Forget a peer's announced key (e.g. on disconnect/leave). Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


makeCarrierPacket({ routeId, ttl = 4, expiresAt = null, sealed } = {})

isCarrierPacketExpired(packet, now = Date.now()

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/carrier/CarrierPacket.js — the carrier layer's OUTER envelope (network plan §26): visible routing metadata (route/ttl/expiry) plus an opaque sealed payload (SealedPacket.js) that carrier nodes forward without ever decrypting. Functions Wrap a sealed onion packet for carrier forwarding. Parameters: (object) — No description in source JSDoc. (string) — No description in source JSDoc. (number) — =4] max remaining hops (network plan §35) (number) — No description in source JSDoc. (object) — from buildSealedPacket()/peelSealedPacket().forward Return a new carrier packet with ttl decremented by 1 (does not mutate the input). <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


createCarrierRelay({ sendToPeer, topology, dedupeCache, rateLimiter, recipientEcdhPrivateKey = null, onPayloadReceived = ()

async handleCarrierRelayMessage(relay, fromPeerId, op)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/carrier/CarrierRelay.js — routes a CarrierPacket across a real mesh (network plan §24/§35/§36, previously deferred: "CollabMeshTopology gossip/fanout/TTL wiring for actual multi peer carrier mesh topology"). SealedPacket.js's onion path is an ordered peerId list chosen by the SENDER, but not every hop in that path is necessarily a live WebRTC neighbor of the previous hop — K neighbor partial mesh/supernode modes deliberately do NOT connect every peer to every peer (see engine/collab/CollabMeshTopology.js's header comment: "K neighbor gossip mesh ... messages reach all N peers in log K(N) hops"). This module bridges that gap: If the addressed next hop IS a direct neighbor right now, deliver directly — cheapest path, one hop, no flood. Otherwise, gossip flood the envelope via CollabMeshTopology's existing TTL+dedupe fanout ( / ) so it propagates through the mesh until it reaches a peer who either IS the target or has it as a direct neighbor, at which point THAT peer delivers it directly instead of re flooding. Every touch of a carrier packet — direct delivery or gossip relay — always runs through first (onion layer expiry/TTL/dedupe/rate limit), independent of and in addition to the mesh gossip's OWN TTL/dedupe: gossip TTL bounds mesh hops for one flood attempt; carrier TTL bounds total onion hops end to end. Neither layer ever inspects the sealed payload itself (network plan §24's core guarantee) — only , called with THIS node's own private key when (and only when) this node is the addressed hop, can see anything beyond the next hop id. Functions Parameters: (object) — No description in source JSDoc. ((peerId:string, data:object) = void) — e.g. (object) — from (object) —


the next hop id. Functions Parameters: (object) — No description in source JSDoc. ((peerId:string, data:object) = void) — e.g. (object) — from (object) — from — carrier layer dedupe (see CarrierForwarder.js), separate from the mesh's own gossip dedupe (object) — from (CryptoKey) — this node's ECDH private key, if it can be an onion recipient/intermediate hop ((payload: ) = void) — called with the final plaintext payload when THIS node is the packet's ultimate recipient Returns: relay state Send/relay a carrier packet toward its addressed next hop. Runs the standard forwarding check first — a caller originating a brand new packet should still go through this (it's the same expiry/TTL/dedupe/rate limit gate every intermediate hop uses, applied uniformly per network plan §35). Returns: } Feed every relevant message through this (e.g. from , alongside 's own — both follow the same "return false if not ours" chaining pattern). Handles: peeling a layer addressed to this node, delivering the final payload, direct hop forwarding, and mesh gossip re forwarding. Returns: true if this message was a carrier relay message (handled) Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


createRateLimiter({ capacity = 30, refillPerSecond = 10 } = {})

tryConsume(limiter, cost = 1, now = Date.now()

availableTokens(limiter, now = Date.now()

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/carrier/RateLimiter.js — token bucket rate limiting for carrier forwarding (network plan §35/§36 spam controls, V1: rate limits + dedupe, no proof of work yet). Functions Create a token bucket. Parameters: (object) — No description in source JSDoc. (number) — =30] max burst size (number) — =10] steady state rate Try to consume tokens. Returns false (caller should drop/reject) if insufficient. Tokens currently available (after applying refill for elapsed time). <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


async buildSealedPacket({ hops, payload } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/carrier/SealedPacket.js — multi hop onion sealed packets (network plan §24/§26 public carrier layer). Phase 0 audit finding: implements SINGLE hop anonymization (host relay + garlic encrypted payload) for one game collab session. The OS network layer needs TRUE multi hop onion routing across semi trusted carrier meshes that are not part of any group. This module builds that generically, reusing the same ECDH P 256 + AES 256 GCM primitives ( ) rather than inventing new crypto. Each layer is wrapped from the innermost (final recipient) outward, so only the addressed hop can decrypt its own layer. A peeled layer reveals only the NEXT hop's peerId (or, at the final layer, the actual payload) — never the full path, the true sender, or the payload, matching §26. Functions Build a multi hop sealed packet. Parameters: (object) — No description in source JSDoc. ( ) — JSON serializable final payload Returns: the outer sealed layer, addressed to hops[0] Peel one layer with this hop's ECDH private key. Returns: {done:true, payload: } null } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


network/carrier/index.js
Exports
Notes & Examples

<! 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. Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


createChunkCache({ maxEntries = 128, maxBytes = 64  1024  1024 } = {})

cacheVerifiedChunk(cache, { chunkId, fragmentRoot, bytes } = {})

<! 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 Bounded in memory LRU used only while the browser endpoint is alive. Store bytes that the caller has already content/Merkle verified. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


splitIntoChunks(bytes, chunkSize = DEFAULTCHUNKBYTES)

splitChunkIntoFragments(chunkBytes, fragmentSize = DEFAULTFRAGMENTBYTES)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/ChunkFragmenter.js — split large objects into chunks, and chunks into transport sized fragments (network plan §27/§31/§32). Functions Split an object's bytes into chunks no larger than (which must not exceed the network wide 4MB ceiling). Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. Split one chunk's bytes into transport sized fragments. Parameters: (Uint8Array) — No description in source JSDoc. (number) — No description in source JSDoc. Concatenate fragments back into one chunk's bytes. Concatenate chunks back into the full object's bytes. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


network/chunks/ChunkLimits.js
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/ChunkLimits.js — size ceilings/defaults (network plan §27). Constants — Network wide hard ceiling for one logical chunk. Not the default — a ceiling. — Sensible default chunk size (§27: "512 KB 1 MB"). — Default transport fragment size (§27/§28; matches WebRTC DataChannel's assumed default ). — Experimental larger fragment size for trusted high bandwidth links. — Soft caps for non bulk message classes (§27). <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


createChunkTransport({ sendToPeer, maxInFlightBytes, getChunk = async ()

requestChunkFromPeer(transport, { peerId, chunkId, fragmentRoot, timeoutMs = REQUESTTIMEOUTMS, lane = PRIORITYLANE.NORMAL, } = {})

enqueueChunkSend(transport, { peerId, chunkId, chunkBytes, fragmentRoot, lane = PRIORITYLANE.NORMAL, fragmentSize = DEFAULTFRAGMENTBYTES })

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/ChunkTransport.js — binds the transport agnostic chunk pipeline (ChunkFragmenter/MerkleFragments/ChunkVerifier/FlowControl/ DedupeCache) to a real peer connection (network plan §27/§28/§31/§32, previously deferred: "Real WebRTC DataChannel transport wiring"). Deliberately transport agnostic at the call boundary — takes a function matching engine/collab/CollabCore.js's signature (which already auto chunks anything over 60KB to dodge SCTP frame limits and reassembles transparently on the receive side, and round trips natively via CollabCodec.js's msgpack format) rather than importing CollabCore itself. Callers feed every relevant message through before their own app level op handling — same pattern SyncTransport.js uses for MasterServerClient signal events. Real credit based backpressure (FlowControl.js's whole point): a CollabCore style reliable ordered data channel does NOT drop or backpressure large "critical" application messages on its own (see CollabCore.js's — only a handful of non critical types like get dropped under buffer pressure); blasting every fragment of a multi MB object immediately would build unbounded . This module gates sends on an ACK based credit window instead: a fragment's credit is only released once the receiver confirms it actually arrived ( ), not merely once handed to the transport. Functions Parameters: (object) — No description in source JSDoc. ((peerId:string, data:object) = void) — e.g. (number) — No description in source JSDoc. Returns: transport state — pass to enqueueChunkSend/handleChunkTransportMessage Ask one peer for a manifest declared chunk and await its verified bytes. Enqueue one chunk's fragments for sending to a peer.


Ask one peer for a manifest declared chunk and await its verified bytes. Enqueue one chunk's fragments for sending to a peer. Actual sends are paced by the credit window (see module doc) — this returns immediately; fragments drain asynchronously as ACKs free up credit. Parameters: (object) — No description in source JSDoc. (object) — No description in source JSDoc. (string) — No description in source JSDoc. (string) — expected content hash (Manifest.js chunk entry's chunkId) (Uint8Array) — No description in source JSDoc. (string) — expected merkle root (Manifest.js chunk entry's fragmentRoot) (number) — FlowControl.PRIORITY LANE, default NORMAL (number) — No description in source JSDoc. Feed every message through this (e.g. from ). Handles fragment sends and their acks; returns false for anything that isn't a chunk transport message so callers can safely chain their own app level op handling after it. Returns: true if this message was a chunk transport message (handled) Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/ChunkVerifier.js — verify received fragments/chunks against a manifest's declared hashes (network plan §31/§32). Functions Verify a fully received set of fragments for one chunk against the manifest's declared fragment merkle root — before spending time/memory reassembling+hashing the whole chunk. Reassemble fragments and verify the resulting chunk's content hash matches the manifest's declared chunkId. Returns the reassembled bytes on success, or null (fails closed) on mismatch. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


markSeen(cache, key, ttlMs, now = Date.now()

checkAndMark(cache, key, ttlMs, now = Date.now()

pruneDedupeCache(cache, now = Date.now()

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/DedupeCache.js — generic seen packet dedupe table (network plan §29), keyed by whatever content/event/packet hash a caller chooses. Type specific retention: callers pick the ttlMs per dedupe key type (control packets 1 5min, route announcements 5 30min, chunks/ledger events effectively forever via their own content hash, etc.) — this module just enforces "seen within its TTL drop" generically. Functions Create an empty dedupe cache. True if was marked seen and its TTL hasn't expired yet. Expired entries are lazily evicted. Mark as seen for milliseconds. Convenience: check and mark in one call — the usual receive path pattern ("if already seen, drop; otherwise mark seen and process"). Returns: true if this is a NEW key (caller should process it) Remove all expired entries. Returns the number removed. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


createFlowControl({ maxInFlightBytes = 16  1024  1024 } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/FlowControl.js — credit based flow control + priority lanes (network plan §28). QUIC style: a receiver advertises how much in flight data it can absorb; senders must reserve credit before sending and the receiver restores it once a fragment is verified/written. Functions Create a flow control window. Try to reserve of send credit. Returns false (caller must pause) if it would exceed the window. Restore credit after a fragment is verified/written (or dropped/timed out). Bytes of credit still available right now. Create an empty multi lane priority queue. Enqueue an item on a priority lane (lower lane number = served first). Dequeue the next item, always draining the lowest non empty lane first. True if every lane is empty. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


async buildManifest({ objectId, scope = 'private', version = 1, chunks = [], permissions = [], encryptionEpoch = null, signer, } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/Manifest.js — signed object manifests (network plan §31). A manifest describes an object as an ordered list of chunks (each with a content hash + fragment merkle root); the object itself is fetched chunk by chunk, possibly from many peers at once (SwarmScheduler.js). Functions Build + sign a manifest. Parameters: (object) — No description in source JSDoc. (string) — No description in source JSDoc. (string) — e.g. 'group dev lab', 'public' (number) — No description in source JSDoc. (string[]) — No description in source JSDoc. (number) — No description in source JSDoc. (object) — No description in source JSDoc. Returns: signed manifest envelope Verify a manifest's protocol/type and signature. Total object size implied by a manifest's chunk list. List of chunk ids a manifest references, in order. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


network/chunks/MerkleFragments.js
Functions
async hashFragment(fragmentBytes)
async computeChunkHash(chunkBytes)
async computeFragmentHashes(fragments)
async computeMerkleRoot(fragmentHashes)
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/MerkleFragments.js — per fragment hashing + a chunk's merkle root (network plan §32), so receivers can reject a corrupted fragment early instead of only detecting failure after the whole chunk is reassembled. Reuses the engine's existing SHA 256 content hash helper (already used for identity fingerprints elsewhere). Functions SHA 256 hex hash of one fragment's raw bytes. SHA 256 hex hash of a full chunk's raw bytes (used as the chunk's content id). Hash every fragment of a chunk, in order. Compute a chunk's merkle root from its (ordered) fragment hashes: pair up adjacent hashes, hash their concatenation, repeat until one root remains (odd node carries up unchanged, standard merkle tree construction). Parameters: (string[]) — No description in source JSDoc. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


async fetchManifestFromSwarm({ signedManifest, transport, findProviders, fallbackPeers = ()

<! 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 Functions Resolve a signed manifest from many DHT providers, retrying failed peers, verifying every content hash, and preserving manifest chunk order. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


planSwarmFetch({ chunkIds, providers, maxLanes = 4 } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/chunks/SwarmScheduler.js — spread chunk fetches across multiple providing peers (network plan §31 swarm fetching). Pure scheduling logic; the actual byte transfer happens over routes/sessions from earlier phases. Functions Assign each requested chunk to one candidate provider peer, load balancing so no single peer is asked for every chunk, then group the assignments into fetch "lanes" of up to concurrent requests. Parameters: (object) — No description in source JSDoc. (string[]) — No description in source JSDoc. (Map<string,string[] ) — chunkId candidate peerIds (network plan §31 provider records) (number) — No description in source JSDoc. Returns: , lanes:Array<Array<{chunkId:string, peerId:string} , unresolved:string[], peerLoad:object }} <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


network/chunks/index.js
Exports
Notes & Examples


async hpkeSeal(recipientPublicKeyHex, plaintext, options = {})

async hpkeOpen(recipientPrivateKey, encHex, ciphertextHex, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: RFC 9180 base mode: DHKEM(P 256, HKDF SHA256), HKDF SHA256, AES 128 GCM. Signaling uses a fresh encapsulation for every message, so the AEAD sequence number is always zero and the base nonce is used directly. Functions Re exports , <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


async deriveOpaqueRoute({ routeSecret = null, projectId = 'default' } = {})

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


async verifyRawSignature(publicKeyHex, bytes, signatureHex)

async verifySignedManifest(signed, expectedPins, nowSeconds = Math.floor(Date.now()

async verifySignedV3Manifest(signed, expectedPins, nowSeconds = Math.floor(Date.now()


network/crypto/index.js
Exports
Notes & Examples


readParticleTrustFloor(networkRootId, nodeId, storage = globalThis.localStorage)

writeParticleTrustFloor(networkRootId, nodeId, floor, storage = globalThis.localStorage)

<! 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 Issue a short lived, route bound SSE State Channel lease from verified V3 trust. Functions Validate and normalize a V2 ICE response. Explicit direct mode is strict so a malformed or compromised response cannot smuggle relay credentials into a no TURN client. Legacy relay responses remain accepted when they contain a real authenticated TURN URL. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


acquireParticleNetworkDaemon({ server, deviceSigner, onEvent = null, preferV3 = false } = {})


<! 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 Selects V3 only from a valid, pinned V2 advertisement. A valid advertisement with no V3 marker selects V2. Any V3 marker commits the connection attempt to V3; V3 integrity failures are forwarded and never retried as V2. Method Signature Summary Re exports , <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


network/daemon/index.js
Exports
Notes & Examples

<! 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. Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


createBootstrapSource({ id, scan, advertise = null } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/dht/BootstrapSource.js — pluggable bootstrap sources for the no bootstrap is impossible reality check (network plan §37/§47/§48): "no pure zero bootstrap global discovery exists" — cached peers, LAN, invite code, DHT, radio beacon, or a seed/master server are the only starting paths. This module defines a tiny, transport agnostic interface ( ) and a registry to combine several sources into one bootstrap attempt order; it ships NO concrete transport. Concrete adapter (wired at the OS integration layer, per this module's engine/network stays webgpu os free rule): webgpu os/drivers/ ResidentBootstrapSource.js wraps the OS browser extension's "resident" node (webgpu os/browser extension/services/ResidentService.js, exposed via BrowserBridgeClient.resident) — a standing MV3 offscreen document that persists a device's PUBLIC identity cert and stays warm via a chrome.alarms keepalive. Kept honest in that adapter: the resident node does NOT answer presence with no OS tab open (it is a lightweight cert vault + heartbeat only, off by default) — its returns a "last remembered identity" hint, not a confirmed reachable peer. Functions Wrap a bootstrap source implementation. Parameters: (object) — No description in source JSDoc. (string) — stage name (e.g. 'lan', 'residentExtension', 'radio') (() = Promise<object[] ) — return known peer/route records this source currently has ((record:object) = Promise<void ) — publish our own presence via this source, if supported Create a registry of bootstrap sources, tried in registration order. Try each registered source in order, collecting whatever records each one returns (a source throwing/timing out just contributes nothing — this never fails


Try each registered source in order, collecting whatever records each one returns (a source throwing/timing out just contributes nothing — this never fails the whole bootstrap attempt). Returns: } Flatten runBootstrap()'s per source results into one record list, tagged with their source. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


makeFindPeerMessage({ targetPeerId, requesterPeerId } = {})

makeFindRouteMessage({ routeId, requesterPeerId } = {})

makeFindProvidersMessage({ key, requesterPeerId } = {})

makeAnnounceProviderMessage({ key, peerId, ttlMs } = {})

makeAnnounceRouteMessage({ routeId, peerId, services = [], ttlMs } = {})

makePeerExchangeMessage({ knownPeers = [] } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/dht/DhtMessages.js — future Particle DHT message primitives (network plan §47): FIND PEER / FIND ROUTE / FIND PROVIDERS / PEER EXCHANGE ANNOUNCE PROVIDER / ANNOUNCE ROUTE. Low priority per the plan — these are just versioned envelope builders (protocol.js ) for a future real DHT transport; no network code lives here yet. Bootstrap is still required even with a DHT (network plan §47: cached peers/LAN/master server/invite) — see BootstrapSource.js. Functions <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


rememberPeer(node, peerId, { routeHints = [], reportedBy = null, direct = false } = {}, now = Date.now()

handleFindRoute(node, routeId, now = Date.now()

handleFindProviders(node, key, now = Date.now()

handleAnnounceProvider(node, { key, peerId, ttlMs } = {}, now = Date.now()

handlePeerExchange(node, knownPeers = [], now = Date.now()

listKnownPeers(node, { limit = 64 } = {})

providersMapForKeys(node, keys, now = Date.now()

pruneDhtNode(node, { peerStaleMs = 30  60  1000 } = {}, now = Date.now()

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/dht/DhtNode.js — a local Particle DHT node view (network plan §47, low priority/future). Combines a ProviderStore with a lightweight known peers registry and answers FIND PEER/FIND ROUTE/FIND PROVIDERS queries from LOCAL knowledge only — this phase delivers the data structures and message handling logic; real gossip/replication across a live DHT transport is deferred (network plan §47: "still needs bootstrap" even once a real DHT exists — see BootstrapSource.js). Functions Create a local DHT node view. Record/refresh knowledge of a peer (from PEER EXCHANGE or any direct contact). Answer a local FIND PEER query: do we know this peer, and if so, its route hints? Answer a local FIND ROUTE query: any peers providing this route? Answer a local FIND PROVIDERS query for an arbitrary key (chunk hash, service name, ...). Ingest an ANNOUNCE PROVIDER (route or generic key peer). Ingest a PEER EXCHANGE payload (array of ). Bounded peer summaries for authenticated PEER EXCHANGE messages. Build the providers map SwarmScheduler.planSwarmFetch expects for a list of keys. Prune expired provider records and stale peer knowledge. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


createDhtTransport({ sendToPeer, topology, node, verifyControlIdentity = async ()

findPeerOverNetwork(transport, targetPeerId, { timeoutMs = DEFAULTQUERYTIMEOUTMS } = {})

findRouteOverNetwork(transport, routeId, { timeoutMs = DEFAULTQUERYTIMEOUTMS } = {})

findProvidersOverNetwork(transport, key, { timeoutMs = DEFAULTQUERYTIMEOUTMS } = {})

async announceProviderOverNetwork(transport, { key, ttlMs, signer } = {})

async announceRouteOverNetwork(transport, { routeId, services = [], ttlMs, signer } = {})

async sendPeerExchangeOverNetwork(transport, { peerId, signer, limit = MAXPEEREXCHANGE } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/dht/DhtTransport.js — a scoped down real transport for DhtNode.js's FIND PEER/FIND ROUTE/FIND PROVIDERS queries (network plan §47, low priority). Deliberately NOT a full Kademlia DHT (no k buckets, no XOR distance routing, no iterative closest node lookup) — this is a minimal query/forward/respond loop over the existing mesh: 1. A query with no local answer is gossip flooded across the mesh via CollabMeshTopology.js's existing TTL+dedupe fanout (same mechanism CarrierRelay.js uses) — reuses its per query fingerprint ( ) as this transport's queryId, so no new id scheme or message shape changes were needed in DhtMessages.js. 2. Every node that relays a (non duplicate) query remembers which neighbor it heard the query from ( ) — classic flood/reverse path relay (the same idea AODV uses), not a gossip broadcast itself. 3. Any node with a local answer (from its own DhtNode.js knowledge) sends a direct (non gossiped) DHT RESPONSE back along that reverse path, one hop at a time, until it reaches the original requester. Known MVP limitation (intentional, per the plan's "low priority" scope): entries are not proactively pruned by this module; a real deployment would want a TTL sweep alongside . Functions Parameters: (object) — No description in source JSDoc. ((peerId:string, data:object) = void) — e.g. (object) — from (object) — from — local knowledge this node answers queries from Returns: transport state Query the mesh for a peer's route hints. Checks local knowledge first; only floods the network if we don't already know it. Returns: null } null if no answer arrived in time Query the mesh for a route's live providers. Checks local knowledge first. Query the mesh for an


know it. Returns: null } null if no answer arrived in time Query the mesh for a route's live providers. Checks local knowledge first. Query the mesh for an arbitrary key's providers (chunk hash, service name, ...). Checks local knowledge first. Authenticated, bounded provider announcement to current mesh neighbors. Authenticated route announcement; services are descriptive and bounded, never ambient authority. Send a signed, bounded sample of local peer knowledge to one connected peer. Feed every relevant message through this, alongside 's and 's own handlers (same "return false if not ours" chaining pattern). Returns: true if this message was a DHT transport message (handled) <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


announceProvider(store, key, peerId, ttlMs = DEFAULTPROVIDERTTLMS, now = Date.now()

findProviders(store, key, now = Date.now()

providersMapFor(store, keys, now = Date.now()

pruneProviderStore(store, now = Date.now()

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/dht/ProviderStore.js — local view of "who provides what" (network plan §47 DHT objects: network id route providers, manifest hash chunk providers, group alias route hints, service name providers). This is a LOCAL cache only — no network gossip/replication yet (that's the deferred real DHT transport); it's what a future DHT node would populate from FIND PROVIDERS/ANNOUNCE PROVIDER traffic, and what SwarmScheduler.js (Phase 7) already consumes as its map. Functions Create an empty provider store. Announce that provides (e.g. a manifest chunk hash, route id, service name). Remove one provider's record for a key. Live (non expired) provider peerIds for a key, or []. Build the shape SwarmScheduler.planSwarmFetch expects, for a set of keys. Remove all expired provider records. Returns the number of (key, peerId) pairs removed. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


network/dht/index.js
Exports
Notes & Examples


<! 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 Functions <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


network/endpoint/index.js
Exports
Notes & Examples


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/groupCrypto/DeviceEncryptionKey.js — per device ECDH encryption keypair used to receive group welcome packets (network plan §14). This is intentionally SEPARATE from the ECDSA signing identities in engine/network/identity/NetworkIdentity.js: signing proves "who you are"; this key only exists so other members can encrypt an epoch key TO this specific device. Reuses engine/collab/CollabCrypto.js's ECDH P 256 primitives (the same ones used for peer to peer session encryption). Functions Generate a fresh ECDH P 256 keypair for this device to receive welcome packets. Ephemeral by design (network plan §14 "per device public encryption keys") — callers that need persistence should store /export the private key themselves via their own storage. Returns: } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


async sealForEpoch(gc, epoch, plaintext)

async makeWelcomePacket({ gc, epoch, recipientEcdhPublicKeyRaw } = {})

async openWelcomePacket({ gc, welcomePacket, recipientPrivateKey } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/groupCrypto/GroupEpoch.js — MLS inspired group encryption epochs (network plan §14 group security / §39 route+key rotation on removal). Each group has a sequence of "epochs"; each epoch has its own AES 256 GCM key. Content sealed under an epoch can only be opened by holders of that epoch's key. Removing a member rotates to a fresh epoch and CRYPTO ERASES the old one (drops the key reference) so previously sealed content stays unreadable to anyone who only has the new epoch's key — the removed member's copy of the old epoch key becomes useless going forward, and any FUTURE content is sealed under a key they never received. This deliberately builds directly on (raw AES 256 GCM primitives) rather than the higher level class: welcome packets need to export/re wrap the raw epoch key material for a specific recipient's ECDH public key, and does not expose its internal CryptoKey for export. The crypto erase SEMANTICS (drop the key reference; GCM tamper detection) are identical to . Functions Create an empty group crypto state (no epochs started yet). Parameters: (object) — No description in source JSDoc. (string) — No description in source JSDoc. Start the next epoch with a fresh AES 256 GCM key. Returns the new epoch number. True if has no live key (never started here, or crypto erased). Seal a plaintext string under a specific epoch's key. Returns: } Open an envelope from . Returns null (fails closed) if the epoch's key is missing/erased, the group id doesn't match, or the GCM authentication tag fails (tampering/wrong key). Rotate to a new epoch and crypto erase the current one (network plan §14/§39). Removed members keep whatever they already downloaded, but cannot read


key). Rotate to a new epoch and crypto erase the current one (network plan §14/§39). Removed members keep whatever they already downloaded, but cannot read anything sealed after the rotation, and (once their key reference is dropped) cannot re derive the old epoch's key either. Returns: } Build a welcome packet: an epoch's raw key, ECDH wrapped to one recipient's device encryption public key. Only that recipient's matching private key can unwrap it. Parameters: (object) — No description in source JSDoc. (object) — sender's GroupCrypto (holds the epoch key) (number) — No description in source JSDoc. (ArrayBuffer Uint8Array) — from createDeviceEncryptionKeyPair() Returns: welcome packet Recipient side: unwrap a welcome packet with the matching device private key and import the epoch's raw key into the recipient's own GroupCrypto instance (so they can now content sealed under it). Returns: true on success <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


network/groupCrypto/index.js
Exports
Notes & Examples


createGovernancePolicy({ mode = GOVERNANCEMODES.MAJORITY, founders = ()

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: network/groupLedger/GovernancePolicy.js — group governance modes on top of the CSE PolicyEngine (network plan §16 "adminless and moderatorless groups"): unanimous / majority / threshold / founder protected / open capability. This module decides WHETHER a given vote/approval set is enough for a governance action to commit; GroupLedger.js decides WHAT happens once it does. Functions Build a governance policy for a group. Parameters: (object) — No description in source JSDoc. (string) — one of GOVERNANCE MODES (() = Set<string ) — live founder membershipId set (() = number) — live member count (number) — required approvals for THRESHOLD mode Returns: } Constants — Governance actions that always require approval (network plan §17 eviction/bans). <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.