programextensions/scene/demos/cube.xtl

A wireframe cube turning in a native 3D window: its corners and edges are X_eTaL arrays; Rust draws them. Run: just demo scene cube (drag to turn it; q or close: quit)

source · imports sc: extensions/scene/lib/Scene.xtl

c : Int

value · line 8

the 8 corners: every sign combination of -1 1 in x, y and z

c ← 8 3 r̲eshape -1 -1 -1  1 -1 -1  -1 1 -1  1 1 -1  -1 -1 1  1 -1 1  -1 1 1  1 1 1
Used in: x, y

e : Int

value · line 11

the 12 edges join corners that differ in one coordinate: pairs (from 1)

e ← 12 2 r̲eshape 1 2  3 4  5 6  7 8  1 3  2 4  5 7  6 8  1 5  2 6  3 7  4 8
Used in: x

w : Int

value · line 13
w ← "Cube -- X_eTaL" ˢᶜo̲pen! 480 480
Used in: k, x, y, ᵘq̲uit, ᵘf̲rame

k : Int

value · line 14
k ← w ˢᶜc̲amera! 0.6 0.45 5.0 0.8

x : Int

value · line 15
x ← ((f̲loat w c̲at 1) c̲at 0.4 0.8 1.0) ˢᶜs̲egments! (r̲avel e) s̲elect c

y : Int

value · line 16
y ← ((f̲loat w c̲at 2) c̲at 1.0 0.6 0.2) ˢᶜd̲ots! c

ᵘq̲uit : (Any a, Num b) => a -> b

function · line 18
ᵘq̲uit ← { n →
  z ← ˢᶜc̲lose! w
  0
}
Used in: ᵘf̲rame

ᵘf̲rame : Num a => a -> a

function · line 22
ᵘf̲rame ← { n →
  n = 0 ? 0
  v ← ˢᶜn̲ext! w
  ((v m̲atch "close") + v m̲atch "key q") > 0 ? ᵘq̲uit n
  n
}
Used in: last

last : Int

value · line 28
last ← 100000 'ᵘf̲rame p̲ower 1