Team Ai
Datasetpublic

hschumann2/TempleOS-Source-Code

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes847downloads
Box.txt52 linesDownload Raw Back to Graphics
1 2I64 glbl_r[4][4];3 4U0 DrawIt(CTask *,CDC *dc)5{6  I64 *old_r=dc->r;7  dc->thick=2;8  dc->color=RED;9  dc->x=200;10  dc->y=200;11  dc->flags|=DCF_TRANSFORMATION;12  DCMat4x4Set(dc,glbl_r); //This assigns to dc->r and sets r_norm.13  GrLine3(dc,-100,-100,-100, -100, 100,-100);14  GrLine3(dc,-100, 100,-100,  100, 100,-100);15  GrLine3(dc, 100, 100,-100,  100,-100,-100);16  GrLine3(dc, 100,-100,-100, -100,-100,-100);17  GrLine3(dc,-100,-100, 100, -100, 100, 100);18  GrLine3(dc,-100, 100, 100,  100, 100, 100);19  GrLine3(dc, 100, 100, 100,  100,-100, 100);20  GrLine3(dc, 100,-100, 100, -100,-100, 100);21  GrLine3(dc,-100,-100, 100, -100,-100,-100);22  GrLine3(dc,-100, 100, 100, -100, 100,-100);23  GrLine3(dc, 100, 100, 100,  100, 100,-100);24  GrLine3(dc, 100,-100, 100,  100,-100,-100);25  dc->r=old_r;26}27 28U0 Box()29{30  F64 theta=0,phi=0,omega=0,s=1,s1=1.05;31  SettingsPush; //See SettingsPush32  DocClear;33  Fs->draw_it=&DrawIt;34  while (!ScanChar) {35    Mat4x4IdentEqu(glbl_r);36    Mat4x4RotZ(glbl_r,theta);37    Mat4x4RotX(glbl_r,phi);38    Mat4x4RotZ(glbl_r,omega);39    Mat4x4Scale(glbl_r,s);40 41    Sleep(20);42    theta+=2*pi/70;43    phi+=2*pi/90;44    omega+=2*pi/110;45    s*=s1;46    if ( !(0.2<s<1.4) ) s1=1/s1;47  }48  SettingsPop;49}50 51Box;52