X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=Operations.lua;h=617916d90c9d1682ecf9eeb2d95de50d78d2ea36;hb=b2d510f61cb4ffa581aa62c1c97ee2ce73e5b1fb;hp=d606d391006d73963666bf64df483672922c2d15;hpb=bbd8d6d0b901e62730562d6cddfa80ca1c00bbbe;p=raymarcher.git diff --git a/Operations.lua b/Operations.lua index d606d39..617916d 100644 --- a/Operations.lua +++ b/Operations.lua @@ -13,8 +13,20 @@ local function union(s1, s2) end end +local function diff(s1, s2) + return function (location) + local p1 = s1(location) + local p2 = s2(location) + + return {dist = math.max(p1.dist, -p2.dist), + texture = p1.texture} + end +end + + Operations = { - union = union + union = union, + diff = diff } return Operations