MCPcopy
hub / github.com/rdev/liquid-glass-react / roundedRectSDF

Function roundedRectSDF

src/shader-utils.ts:24–28  ·  view source on GitHub ↗
(x: number, y: number, width: number, height: number, radius: number)

Source from the content-addressed store, hash-verified

22}
23
24function roundedRectSDF(x: number, y: number, width: number, height: number, radius: number): number {
25 const qx = Math.abs(x) - width + radius
26 const qy = Math.abs(y) - height + radius
27 return Math.min(Math.max(qx, qy), 0) + length(Math.max(qx, 0), Math.max(qy, 0)) - radius
28}
29
30function texture(x: number, y: number): Vec2 {
31 return { x, y }

Callers 1

shader-utils.tsFile · 0.85

Calls 1

lengthFunction · 0.85

Tested by

no test coverage detected