Samling af somakuber.
En af egenskaberne ved de syv somakuber er, at de kan samles til en 3×3×3-kube. Det kan gøres på mange måder. Her er en af dem.
Figure3D figure = Position [0,0] Size [x,y] Origin [x/2,y*0.55] Unit x/25 Angles [20,-90,80] Color "white";
Timer t = From 0 To 7000 Step 10 Tick 30;
RadioButton playbutton = Text [ "Play"; "Stop" ] Action [ start t; stop t ]
Position [x-100,y-60] Size [80,25];
PushButton resetbutton = Text "Rewind" Action reset t, reset playbutton
Position [x-100,y-30] Size [80,25];
Variable t1 = if t < 1000 then t else 1000 endif;
Variable t11 = if t1 < 500 then t1/500 else 1 endif;
Variable t12 = if t1 < 500 then 0 else (t1-500)/500 endif;
Variable t2 = if t < 1000 then 0 else if t < 2000 then t - 1000 else 1000 endif endif;
Variable t21 = if t2 < 500 then t2/500 else 1 endif;
Variable t22 = if t2 < 500 then 0 else (t2-500)/500 endif;
Variable t3 = if t < 2000 then 0 else if t < 3000 then t - 2000 else 1000 endif endif;
Variable t31 = if t3 < 500 then t3/500 else 1 endif;
Variable t32 = if t3 < 500 then 0 else (t3-500)/500 endif;
Variable t4 = if t < 3000 then 0 else if t < 4000 then t - 3000 else 1000 endif endif;
Variable t41 = if t4 < 500 then t4/500 else 1 endif;
Variable t42 = if t4 < 500 then 0 else (t4-500)/500 endif;
Variable t5 = if t < 4000 then 0 else if t < 5000 then t - 4000 else 1000 endif endif;
Variable t51 = if t5 < 500 then t5/500 else 1 endif;
Variable t52 = if t5 < 500 then 0 else (t5-500)/500 endif;
Variable t6 = if t < 5000 then 0 else if t < 6000 then t - 5000 else 1000 endif endif;
Variable t61 = if t6 < 500 then t6/500 else 1 endif;
Variable t62 = if t6 < 500 then 0 else (t6-500)/500 endif;
Variable t7 = if t < 6000 then 0 else t - 6000 endif;
Variable t71 = if t7 < 500 then t7/500 else 1 endif;
Variable t72 = if t7 < 500 then 0 else (t7-500)/500 endif;
/*
Line xline = Start [ -4, 0, 0 ] Dir [ 8, 0, 0 ] Vector Size 1 Color "black";
Line yline = Start [ 0, -4, 0 ] Dir [ 0, 8, 0 ] Vector Size 1 Color "black";
Line zline = Start [ 0, 0, -4 ] Dir [ 0, 0, 8 ] Vector Size 1 Color "black";
Label xlabel = "x" At [4,0,0] Offset [0,0,0] Color "black";
Label ylabel = "y" At [0,4,0] Offset [0,0,0] Color "black";
Label zlabel = "z" At [0,0,4] Offset [0,0,0] Color "black";
*/
Net kube1 =
Points
[0,0,0], [1,0,0], [1,1,0], [0,1,0],
[0,0,1], [1,0,1], [1,1,1], [0,1,1]
Lines
[0,1], [1,2], [2,3], [3,0], [4,5], [5,6], [6,7], [7,4],
[0,4], [1,5], [2,6], [3,7]
Faces
[0,1,2,3], [4,5,6,7], [0,1,5,4], [1,2,6,5], [2,3,7,6], [3,0,4,7]
Constant;
Net kube2 = Translate kube1 [1,0,0] Constant;
Net kube3 = Translate kube1 [2,0,0] Constant;
Net kube4 = Translate kube1 [0,0,1] Constant;
Net kube5 = Translate kube1 [1,0,1] Constant;
Net kube6 = Translate kube1 [0,-1,0] Constant;
Net kube7 = Translate kube1 [1,-1,0] Constant;
Net soma1 = Union kube1 kube2 kube4 kube6 Constant;
Net soma2 = Union kube1 kube2 kube5 kube6 Constant;
Net soma3 = Union kube1 kube2 kube4 kube7 Constant;
Net soma4 = Union kube1 kube2 kube3 kube5 Constant;
Net soma5 = Union kube4 kube5 kube2 kube3 Constant;
Net soma6 = Union kube1 kube2 kube3 kube4 Constant;
Net soma7 = Union kube1 kube2 kube4 Constant;
Net soma1r = Rotate soma1 [0,0,360*t12];
Net soma2r = Rotate soma2 [90,-90,90*t21];
Net soma3r = Rotate soma3 [0,0,-180*t31];
Net soma4r = Rotate soma4 [90,0,-90*t61];
Net soma5r0 = Rotate soma5 [0,0,90*t41];
Net soma5r = Rotate soma5r0 [90,0,-90*t41];
Net soma6r0 = Rotate soma6 [90,0,-90*t71];
Net soma6r = Rotate soma6r0 [0,0,-180*t71];
Net soma7r = Rotate soma7 [90,0,-90*t51];
Net soma1t = Translate soma1r [-12,0,5] + t11*[7,-10,-5];
Net soma2t = Translate soma2r [-9,0,5] + t21*[7,-10,0] + t22*[0,0,-5];
Net soma3t = Translate soma3r [-6,0,5] + t31*[4,-11,0] + t32*[0,0,-5];
Net soma4t = Translate soma4r [-3,0,5] + t61*[-2,-9,0] + t62*[0,0,-3];
Net soma5t = Translate soma5r [1,0,5] + t41*[-5,-10,0] + t42*[0,0,-5];
Net soma6t = Translate soma6r [5,0,5] + t71*[-7,-12,0] + t72*[0,0,-3];
Net soma7t = Translate soma7r [9,0,5] + t51*[-13,-10,0] + t52*[0,0,-4];
Scene scene = soma1t Color "black" "rgba(1,1,1,0)",
soma2t Color "black" "rgba(1,1,1,0)",
soma3t Color "black" "rgba(1,1,1,0)",
soma4t Color "black" "rgba(1,1,1,0)",
soma5t Color "black" "rgba(1,1,1,0)",
soma6t Color "black" "rgba(1,1,1,0)",
soma7t Color "black" "rgba(1,1,1,0)";