1 -- Package of geometric operations on SDF objects
3 local function union(s1, s2)
4 return function (location)
5 local p1 = s1(location)
6 local p2 = s2(location)
8 if p1.dist < p2.dist then
9 return {dist = p1.dist, texture = p1.texture}
11 return {dist = p2.dist, texture = p2.texture}
16 local function diff(s1, s2)
17 return function (location)
18 local p1 = s1(location)
19 local p2 = s2(location)
21 return {dist = math.max(p1.dist, -p2.dist),