• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

A categorical programming language


Commit MetaInfo

修订版bd63be8d401d19b9d4904795a52903c8ddf3f86d (tree)
时间2021-11-15 13:47:25
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

hive: Basic 2D signed distance functions.

Circles and metaballs.

更改概述

差异

--- /dev/null
+++ b/hive/demo/metaball.cammy
@@ -0,0 +1,9 @@
1+(comp
2+ (sdf2/metaballs (comp f/4 f-recip)
3+ (fun/const
4+ (comp
5+ (pair (pair (comp (comp f/4 f-recip) fun/dup) (comp f/3 f-recip))
6+ (comp
7+ (pair (pair (pair (comp f-one f-negate) f-zero) (comp f/2 f-recip))
8+ nil) cons)) cons)))
9+ sdf2d)
--- /dev/null
+++ b/hive/f/div.cammy
@@ -0,0 +1 @@
1+(comp (pair fst (comp snd f-recip)) f-mul)
--- /dev/null
+++ b/hive/f/min.cammy
@@ -0,0 +1 @@
1+(comp (pair f-lt id) bool/pick)
--- /dev/null
+++ b/hive/f/minpair.cammy
@@ -0,0 +1 @@
1+(comp (pair @0 @1) f/min)
--- /dev/null
+++ b/hive/sdf2/circle.cammy
@@ -0,0 +1 @@
1+(f/subpair v2/norm (fun/const f-one))
--- /dev/null
+++ b/hive/sdf2/extrude.cammy
@@ -0,0 +1 @@
1+(f/subpair @1 (fun/const @0))
--- /dev/null
+++ b/hive/sdf2/metaballs.cammy
@@ -0,0 +1,13 @@
1+(f/subpair
2+ (fun/apppair
3+ (comp @1 (fold
4+ (fun/name (fun/const f-zero))
5+ (curry
6+ (f/addpair
7+ (f/divpair (comp (comp fst fst) snd)
8+ (comp (comp
9+ (pair (comp (comp fst fst) fst) snd)
10+ (v2/map2 f/sub)) v2/norm))
11+ (fun/apppair (comp fst snd) snd)))))
12+ id)
13+ (fun/const @0))
--- /dev/null
+++ b/hive/sdf2/scale.cammy
@@ -0,0 +1,5 @@
1+(f/mulpair
2+ (comp
3+ (comp (pair id (fun/const (pair @0 @0))) (v2/map2 f/div))
4+ @1)
5+ (fun/const @0))
--- /dev/null
+++ b/hive/sdf2/translate.cammy
@@ -0,0 +1,3 @@
1+(comp
2+ (comp (pair id (fun/const @0)) (v2/map2 f/sub))
3+ @1)
--- /dev/null
+++ b/hive/sdf2/union.cammy
@@ -0,0 +1 @@
1+(f/minpair @0 @1)
--- /dev/null
+++ b/hive/sdf2d.cammy
@@ -0,0 +1,5 @@
1+(v3/triple id
2+ (comp
3+ (comp (pair id (fun/const f-zero)) f-lt)
4+ (comp either (case f-zero f-one)))
5+ id)
--- a/todo.txt
+++ b/todo.txt
@@ -20,3 +20,6 @@
2020 * Remove movelist djinn, maybe?
2121 * At least give up on having the clauses magically sorted; sort them in the
2222 same order as the docs and cammy-run
23+* f/ltpair
24+* Double-negation monad for CPS?
25+* fun/name should always start from 1