The Lambda Lab
/
projects
/
raymarcher.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c86e8c7
)
Added SDF operations.
author
Tim Vaughan
<timv@ughan.xyz>
Mon, 20 Feb 2023 08:20:22 +0000
(09:20 +0100)
committer
Tim Vaughan
<timv@ughan.xyz>
Mon, 20 Feb 2023 08:20:22 +0000
(09:20 +0100)
Operations.lua
[new file with mode: 0644]
patch
|
blob
diff --git a/Operations.lua
b/Operations.lua
new file mode 100644
(file)
index 0000000..
d606d39
--- /dev/null
+++ b/
Operations.lua
@@ -0,0
+1,20
@@
+-- Package of geometric operations on SDF objects
+
+local function union(s1, s2)
+ return function (location)
+ local p1 = s1(location)
+ local p2 = s2(location)
+
+ if p1.dist < p2.dist then
+ return {dist = p1.dist, texture = p1.texture}
+ else
+ return {dist = p2.dist, texture = p2.texture}
+ end
+ end
+end
+
+Operations = {
+ union = union
+}
+
+return Operations