Skip to content
sigma.js sigma.js
v4.0.6 Docs Examples GitHub 12.2K

GLSL_SDF_BOX

const GLSL_SDF_BOX: ā€œ\nfloat sdfBox(vec2 p, vec2 halfSize) {\n vec2 d = abs(p) - halfSize;\n return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);\n}\nā€

Defined in: packages/sigma/src/rendering/glsl.ts:75

SDF for an axis-aligned box. Returns signed distance from point p to the box boundary.