libraryextensions/blender/demos/Sizes.xtl

Sizes.xtl -- the size comparison, xkcd style, as a Blender scene: one cube, a 10 by 10 slab of a hundred, a 10 by 10 by 10 block of a thousand, side by side on the ground and labeled, the camera going once round them. Shared by the demo (demos/cubes.xtl: the video) and its test (a few tiny frames). Import: "sz:" u_se< "Sizes"

source · imports bp: extensions/blender/lib/Bpy.xtl

The cubes

ʰc̲ells : Int -> Int

function (private) · line 13
ʰc̲ells ← { abc →
  n ← '× r̲/ abc
  i ← (r̲ange n) − 1
  c ← 3 s̲elect abc
  b ← 2 s̲elect abc
  2 1 t̲ranspose (3 c̲at n) r̲eshape (i d̲iv b × c) c̲at ((i d̲iv c) m̲od b) c̲at i m̲od c
}

ˡone : Float

value · line 28

the three groups' centers (n by 3, z up, on the ground at z 0): one cube at x -10; a hundred, 10 by 10 on the ground, about x 0; a thousand, 10 by 10 by 10, about x 16 -- a block a step apart, the cubes 0.9 wide so each shows

      "sz:" u̲se< "Sizes"
      (1 s̲elect s̲hape ˢᶻone) c̲at (1 s̲elect s̲hape ˢᶻhundred) c̲at 1 s̲elect s̲hape ˢᶻthousand
1 100 1000
ˡone ← 1 3 r̲eshape -10.0 0.0 0.5
Used in: ˡs̲cene

ˡhundred : Float

value · line 30

a hundred: 10 by 10 on the ground, about x 0

ˡhundred ← (f̲loat ʰc̲ells 10 10 1) + 100 3 r̲eshape -4.5 -4.5 0.5
Used in: ˡs̲cene

ˡthousand : Float

value · line 32

a thousand: 10 by 10 by 10, about x 16

ˡthousand ← (f̲loat ʰc̲ells 10 10 10) + 1000 3 r̲eshape 11.5 -4.5 0.5
Used in: ˡs̲cene

The scene

ˡs̲cene : (Num c, Any d) => (a, b, c) -> d -> Char

function · line 41

(width, height, frames) sz:s_cene 0: the whole script Blender runs: the three groups, a label before each, the ground, a pale sky and a sun, the camera going once round in the frames, EEVEE at that size; then the exports and the report. The video is left to the caller (bp:v_ideo or bp:s_till), added after.

ˡs̲cene ← { (w, h, frames) z →
  blue ← 0.42 0.62 0.9
  ink ← 0.08 0.08 0.1
  ((ᵇᵖhead c̲at (("one", ˡone, 0.9, blue) ᵇᵖc̲ubes 0) c̲at (("hundred", ˡhundred, 0.9, blue) ᵇᵖc̲ubes 0) c̲at (("thousand", ˡthousand, 0.9, blue) ᵇᵖc̲ubes 0)) c̲at
    ((("1", -10.0 -3.0 0.0, 1.6, ink) ᵇᵖl̲abel 0) c̲at (("100", 0.0 -7.5 0.0, 1.6, ink) ᵇᵖl̲abel 0) c̲at (("1000", 16.0 -7.5 0.0, 1.6, ink) ᵇᵖl̲abel 0)) c̲at
    (((3.0 0.0 0.0, 200.0, 0.97 0.97 0.95) ᵇᵖg̲round 0) c̲at ((0.55 0.62 0.72, 3.0) ᵇᵖl̲ights 0)) c̲at
    (((3.0 0.0 3.0, 42.0, 20.0, frames) ᵇᵖo̲rbit 0) c̲at ((w, h, 24) ᵇᵖs̲etup 0)) c̲at
    (ᵇᵖe̲xports "sizes") c̲at ᵇᵖreport)
}
Used in: script