functional language for computing with geometry
DEF background = (S:<1,2>:<0.8,0.8> ~ JOIN ~ Circle:1):<24,1> ;
DEF minute = (T:<1,2>:<-0.05,-0.05> ~ CUBOID):<0.9,0.1>;
DEF hour = (T:<1,2>:<-0.1,-0.1> ~ CUBOID):<0.7,0.2>;
DEF ticks = (STRUCT ~ ##:12):< tick, R:<1,2>:(PI/6) >;
DEF tick = (T:<1,2>:<-0.025,0.55> ~ CUBOID):<0.05,0.2>;
DEF clock2D (h,m::IsInt) = STRUCT:<
background,
ticks,
R:<1,2>:( PI/2 - (h + m/60)*PI/6 ): hour,
R:<1,2>:( PI/2 - m*PI/30 ): minute
>;
DEF clock3D (h,m::IsInt) = STRUCT:<
background * Q:0.2 COLOR RED,
T:3:0.2:(ticks * Q:0.01), T:3:0.2,
R:<1,2>:( PI/2 - (h + m/60)*PI/6 ):(hour * Q:0.03), T:3:0.03,
R:<1,2>:( PI/2 - m*PI/30 ):(minute * Q:0.03)
DEF out = MOVE: clock3D:<<2,10>,<2,20>>:<0,10>;