sdf/primitives
src/sdf/primitives.tur
smart constructors for SDF leaf shapes.
Since: Phase 1
defn
sdf-sphere
(sdf-sphere [cx :float cy :float cz :float r :float] :int)
sphere centred at (cx,cy,cz) with radius r.
Parameters
| cx cy cz -- centre position | ||
| r | radius (> 0) |
Returns
SdfExpr handle.
Example
(sdf-sphere 0.0 0.0 0.0 1.5)
Since: Phase 1
defn
sdf-box
(sdf-box [lx :float ly :float lz :float hx :float hy :float hz :float] :int)
axis-aligned box from corner lo=(lx,ly,lz) to hi=(hx,hy,hz).
Parameters
| lx ly lz -- minimum corner | ||
| hx hy hz -- maximum corner |
Returns
SdfExpr handle.
Example
(sdf-box -1.0 -1.0 -1.0 1.0 1.0 1.0)
Since: Phase 1
defn
sdf-cylinder
(sdf-cylinder [cx :float cy :float cz :float r :float] :int)
infinite cylinder along +Z axis, projected radius r.
Parameters
| cx cy cz -- axis centre (z component ignored for distance, used for translate) | ||
| r | radius (> 0) |
Returns
SdfExpr handle.
Example
(sdf-cylinder 0.0 0.0 0.0 0.5)
Since: Phase 1
defn
sdf-plane
(sdf-plane [nx :float ny :float nz :float d :float] :int)
infinite plane n.p + d = 0.
Parameters
| nx ny nz -- outward normal (unit length recommended) | ||
| d | plane offset (distance from origin along -n direction) |
Returns
SdfExpr handle.
Example
(sdf-plane 0.0 1.0 0.0 0.0) ; floor at y = 0 (sdf-plane 0.0 1.0 0.0 -2.0) ; floor at y = 2
Since: Phase 1