0 Members and 1 Guest are viewing this topic.

Ans->|LTEMP|LTEMP(1->A|LTEMP(2->B|LTEMP(3->C|LTEMP(4->W|LTEMP(5->H|LTEMP(6->D[[(A),(B),(C)][(A),(B),(C+D)][(A),(B+H),(C)][(A),(B+H),(C+D)][(A+W),(B),(C)][(A+W),(B),(C+D)][(A+W),(B+H),(C)][(A+W),(B+H),(C+D)]]->[A][[1,2][2,4][4,3][3,1][5,6][6,8][8,7][7,5][1,5][2,6][3,7][4,8]]->[B]

Ans->|LTEMP|LTEMP(1->A|LTEMP(2->B|LTEMP(3->C|LTEMP(4->W|LTEMP(5->H|LTEMP(6->D[[(A),(B),(C)][(A+W),(B),(C)][(A+W),(B),(C+D)][(A),(B),(C+D)][(A+W/2),(B+H),(C+D/2)]]->[A][[1,2][2,3][3,4][4,1][1,5][2,5][3,5][4,5]]->[B]

Ans->|LTEMP|LTEMP(1->A|LTEMP(2->B|LTEMP(3->C|LTEMP(4->W|LTEMP(5->H|LTEMP(6->D[[(A),(B),(C)][(A+W/2),(B),(C+D)][(A+W),(B),(C)][(A+W/2),(B+H),(C+D/2)]]->[A][[1,2][2,3][3,1][1,4][2,4][3,4]]->[B]

Ans->A(A=0)-(A=2)->BXmin+B->XminXmax+B->Xmax(A=1)-(A=3)->BYmin+B->YminYmax+B->Ymax

Ans->thetadim([A]->L1For(A,1,L1(1For(B,1,L1(2theta*[A](A,B->[A](A,BEndEnd

Ans->L1L1(1->Zdim([A]->L2L2(1->TFor(A,1,T[A](A,Z)+L1(2->[A](A,ZEnd

dim([B]->L1For(E,1,L1(1Line([A]([B](E,1),1),[A]([B](E,1),2),[A]([B](E,2),1),[A]([B](E,2),2),1,Black,1End

Ans->L1Ans(2->thetasin(theta->Acos(theta->Bdim([A]->L2For(N,1,L2(1[A](N,1->I[A](N,2->J[A](N,3->KIf 0=L1(1ThenJB-KA->[A](N,2KB+JA->[A](N,3ElseIf 1=L1(1ThenIB-KA->[A](N,1KB+IA->[A](N,3ElseIf 2=L1(1ThenIB-JA->[A](N,1JB+IA->[A](N,2EndEndEndEnd

Disp "DIM. OF OBJECT:Input "X: ",AInput "Y: ",BInput "Z: ",CInput "OFFSETX: ",SInput "OFFSETY: ",TInput "OFFSETZ: ",UClrDraw:BackgroundOff0->|N//change object type by appending "CUBE", "TRIP", or "TETR" to the following line.{S,T,U,A,B,C:prgmOBJprgmDRAW3DPause ClrDrawRepeat 0Repeat AnsgetKeyEndAns->F//too lazy to optimize this, shouldn’t really affect speed.If F=73:Then{0,pi/16:prgmROTATE:ElseIf F=93:Then{0,~pi/16:prgmROTATE:ElseIf F=82:Then{1,pi/16:prgmROTATE:ElseIf F=84:Then{1,~pi/16:prgmROTATEEndEndEndEndIf sum(F={43,52,54,63Then1(F=43)+2(F=52)+0(F=54)+3(F=63):prgmMOVEEndIf sum(F={21,31Then.8If F=21Ans^^-1prgmSCALE3DEndClrDrawprgmDRAW3DEnd

Disp "DIM. OF OBJECT:Input "X: ",AInput "Y: ",BInput "Z: ",CInput "OFFSETX: ",SInput "OFFSETY: ",TInput "OFFSETZ: ",UClrDraw:BackgroundOff//change object type by appending "CUBE", "TRIP", or "TETR" to the following line.{S,T,U,A,B,C:prgmOBJprgmDRAW3DPause For(Z,0,1{Z,pi/16:prgmROTATEEndRepeat 0{1,pi/64:prgmROTATEClrDrawprgmDRAW3DEnd

What you want to do is most likely triangle rasterisation. You can work with quadrilateral too but it is slighty harder. You'll two thing based on your program. First implement triangle support :it shouldnt be too hard. The algorithm to fill the triangle is based off the general idea to calculate new x endpoint and startpoint at each y coordinate. What is Nice is that you can compute by how much x coordinate vary when incrementing y by one and only deal with addition in inner loop. Drawing is a simple hline with whatever color you want (lightning ? :p)

FacebookandTwitterFollow @Codewalr_us