MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / rotate_donut_3D

Function rotate_donut_3D

CPP/pattern/donut.cpp:33–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include <stdio.h>
32
33void rotate_donut_3D(void)
34{ // Originally Code by Andy Sloane https://www.a1k0n.net/2011/07/20/donut-math.html
35 int k; //by Andy Sloane
36 system("cls"); //C++ Builder
37 float A= 0,B=0,i,j,z[1760];char
38 b[1760];printf("\x1b[2J");for(;;
39 ){memset(b,32,1760);memset(z,0,7040)
40 ;for(j=0;6.28>j;j+=0.07)for(i=0;6.28
41 >i;i+=0.02){float c=sin(i),d=cos(j),e=
42 sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c*
43 h*e+f*g+5),l=cos (i),m=cos(B),n=s\
44in(B),t=c*h*g-f* e;int x=40+30*D*
45(l*h*m-t*n),y= 12+15*D*(l*h*n
46+t*m),o=x+80*y, N=8*((f*e-c*d*g
47 )*m-c*d*e-f*g-l *d*n);if(22>y&&
48 y>0&&x>0&&80>x&&D>z[o]){z[o]=D;;;b[o]=
49 ".,-~:;=!*#$@"[N>0?N:0];}} /*#****!!-*/
50 printf("\x1b[H");for(k=0;1761>k;k++)
51 putchar(k%80?b[k]:10);A+=0.04;B+=
52 0.02;}/*****####*******!!=;:~
53 ~::==!!!**********!!!==::-
54 .,~~;;;========;;;:~-.
55 ..,--------,*/
56}
57
58int _tmain(int argc, _TCHAR* argv[])
59{

Callers 1

_tmainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected