メインコンテンツまでスキップ

vesicaSDF: Vesica Piscis Distance Field

Sacred Geometry through Circular Intersection

The vesicaSDF function generates the signed distance field for a vesica piscis (fish bladder) shape. This ancient geometric form emerges from the intersection of two equal circles, creating a lens-shaped region with profound mathematical properties.

Mathematical Foundation

A vesica piscis is formed by the maximum operation of two offset circles:

dvesica(p,w)=max(dcircle(poffset),dcircle(p+offset))d_{\text{vesica}}(p, w) = \max(d_{\text{circle}}(p - \text{offset}), d_{\text{circle}}(p + \text{offset}))

where offset=(w/2,0)\text{offset} = (w/2, 0) represents the horizontal separation between circle centers.

The width parameter ww controls the overlap between circles:

  • w=0w = 0: Complete overlap (single circle)
  • w=1w = 1: Circles touch at center
  • w>1w > 1: Circles separate with lens narrowing

Function Signature

ParameterTypeDescription
stvec2Sample point coordinates
wfloatWidth separation between circle centers

Alternative Forms

  • vesicaSDF(st, w): Customizable width parameter
  • vesicaSDFDefault(st): Fixed width at 0.5

Implementation Demonstrations

ライブエディター
const fragment = () => {
      const p = uv.sub(0.5).mul(2)
      const width = iTime.sin().mul(0.3).add(0.6)
      const dist = vesicaSDF(p, width)
      const brightness = float(0).step(dist.negate()).mul(0.8).add(0.2)
      return vec4(vec3(brightness), 1)
}