sdf/colors
ColoredSDF: SdfExpr paired with per-leaf color and object ID.
Since: Phase 2
csdf-sdf
(csdf-sdf [cn : int] :)
the combined SdfExpr handle for this colored subtree.
| cn | ColoredSDF handle |
SdfExpr handle.
(sdf-eval (csdf-sdf scene) 0.0 0.0 0.0)
Since: Phase 2
csdf-left
(csdf-left [cn : int] :)
left colored child handle (0 for leaves). Since: Phase 3
csdf-right
(csdf-right [cn : int] :)
right colored child handle (0 for leaves and unaries). Since: Phase 3
csdf-r
(csdf-r [cn : int] :)
red color component of a leaf node. Since: Phase 3
csdf-g
(csdf-g [cn : int] :)
green color component of a leaf node. Since: Phase 3
csdf-b
(csdf-b [cn : int] :)
blue color component of a leaf node. Since: Phase 3
csdf-object-id
(csdf-object-id [cn : int] :)
object ID of a colored node (-1 for interior). Since: Phase 3
csdf-free
(csdf-free [cn : int] :)
free a ColoredSDF tree and its associated SdfExpr tree.
| cn | ColoredSDF handle; safe to call with 0. |
(csdf-free scene)
Since: Phase 2
colored-sphere
(colored-sphere [cx : float cy : float cz : float r : float cr : float cg : float cb : float objid : int] :)
sphere centred at (cx,cy,cz) with radius r and RGB color.
| cx cy cz -- centre position | ||
| r | radius (> 0) | |
| cr cg cb -- diffuse RGB color in [0, 1] | ||
| objid | object ID (>= 0; unique per colored leaf in the scene) |
ColoredSDF handle.
(colored-sphere 0.0 0.0 0.0 1.5 1.0 0.0 0.0 1)
Since: Phase 2
colored-box
(colored-box [lx : float ly : float lz : float hx : float hy : float hz : float cr : float cg : float cb : float objid : int] :)
AABB from (lx,ly,lz) to (hx,hy,hz) with RGB color.
| lx ly lz -- minimum corner | ||
| hx hy hz -- maximum corner | ||
| cr cg cb -- diffuse RGB color in [0, 1] | ||
| objid | object ID (>= 0) |
ColoredSDF handle.
(colored-box -1.0 -1.0 -1.0 1.0 1.0 1.0 0.0 1.0 0.0 2)
Since: Phase 2
colored-cylinder
(colored-cylinder [cx : float cy : float cz : float r : float cr : float cg : float cb : float objid : int] :)
infinite cylinder through (cx,cy,*) radius r with color.
Since: Phase 2
colored-plane
(colored-plane [nx : float ny : float nz : float d : float cr : float cg : float cb : float objid : int] :)
infinite plane n.p + d = 0 with given color.
Since: Phase 2
colored-union
(colored-union [a : int b : int] :)
CSG union of two colored SDFs.
| a b -- ColoredSDF handles |
Combined ColoredSDF handle.
(colored-union
(colored-sphere -1.0 0.0 0.0 0.8 1.0 0.0 0.0 1)
(colored-sphere 1.0 0.0 0.0 0.8 0.0 1.0 0.0 2))
Since: Phase 2
colored-intersection
(colored-intersection [a : int b : int] :)
CSG intersection of two colored SDFs.
Since: Phase 2
colored-difference
(colored-difference [a : int b : int] :)
CSG difference: a minus b.
| a | base shape | |
| b | shape to subtract |
Since: Phase 2
colored-smooth-union
(colored-smooth-union [a : int b : int k : float] :)
smooth union of two colored SDFs (Quilez blend).
| a b -- ColoredSDF handles | ||
| k | blend radius (>= 0) |
Since: Phase 2
colored-translate
(colored-translate [cn : int tx : float ty : float tz : float] :)
translate a colored SDF by (tx, ty, tz).
| cn | ColoredSDF handle | |
| tx ty tz -- translation vector |
Translated ColoredSDF handle.
(colored-translate my-sphere 0.0 2.0 0.0)
Since: Phase 2
colored-torus
(colored-torus [cx : float cy : float cz : float big-r : float small-r : float cr : float cg : float cb : float objid : int] :)
torus with a fixed surface color.
| cx cy cz -- centre position | ||
| big-r | ring radius | |
| small-r | tube radius | |
| cr cg cb -- diffuse RGB color in [0, 1] | ||
| objid | object ID (>= 0) |
(colored-torus 0.0 0.0 0.0 1.5 0.3 0.8 0.3 0.1 5)
Since: Phase 5
colored-capsule
(colored-capsule [ax : float ay : float az : float bx : float by : float bz : float r : float cr : float cg : float cb : float objid : int] :)
capsule with a fixed surface color.
| ax ay az -- endpoint A | ||
| bx by bz -- endpoint B | ||
| r | capsule radius | |
| cr cg cb -- diffuse RGB color in [0, 1] | ||
| objid | object ID (>= 0) |
(colored-capsule 0.0 -1.0 0.0 0.0 1.0 0.0 0.4 0.2 0.7 0.9 6)
Since: Phase 5
colored-smooth-intersection
(colored-smooth-intersection [a : int b : int k : float] :)
smooth CSG intersection of two colored SDFs.
| a b -- ColoredSDF handles | ||
| k | blend radius (>= 0) |
Since: Phase 5
colored-repeat-inf
(colored-repeat-inf [cn : int px : float py : float pz : float] :)
infinite repetition of a colored SDF.
| cn | ColoredSDF handle to repeat | |
| px py pz -- repetition period per axis (0 = no repetition on that axis) |
(colored-repeat-inf (colored-sphere 0.0 0.0 0.0 0.3 1.0 0.0 0.0 1)
1.5 1.5 1.5)
Since: Phase 5
colored-repeat-fin
(colored-repeat-fin [cn : int px : float py : float pz : float lx : float ly : float lz : float] :)
finite repetition of a colored SDF.
| cn | ColoredSDF handle to repeat | |
| px py pz -- repetition period per axis (0 = no repetition) | ||
| lx ly lz -- number of repetitions on each side of the origin |
(colored-repeat-fin sphere 2.0 2.0 2.0 3.0 3.0 3.0)
Since: Phase 5
Internal definitions
csdf--make-leaf-- allocate a ColoredSDF leaf.csdf--make-node-- allocate a ColoredSDF interior node.