Cord/examples/functions.crd

14 lines
412 B
Plaintext

// functions.crd — user-defined functions
ring(r, t) = diff(sphere(r), sphere(r - t))
pillar(r, h) = cylinder(r, h)
let base: Obj = ring(5, 0.5)
let col: Obj = translate(pillar(0.8, 4), 4, 0, 4)
let col2: Obj = translate(pillar(0.8, 4), -4, 0, 4)
let col3: Obj = rotate_z(col, pi/2)
let col4: Obj = rotate_z(col2, pi/2)
let result: Obj = union(base, union(col, union(col2, union(col3, col4))))
cast(result)