Skip to content

Function: arcSDF() ​

ts
function arcSDF(px, py, s): number;

Experimental

Signed distance (px, negative inside) from a point at (px, py) px relative to the wedge center (y-up) to the wedge. CPU mirror of arcSDF in the fragment shader.

The point is rotated so the bisector lies on +x and folded onto y ≥ 0; by symmetry only the end side matters. The side is the boundary of the gap wedge dilated by h (so the pad gap has constant width), and each corner is replaced by its tangent circle inside the region where that circle is the nearest boundary.

Parameters ​

ParameterType
pxnumber
pynumber
sArcShape

Returns ​

number

Released under the MIT License.