Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66cfeaf

Browse files
committed
💾 Feat: 3D rotate donut!
1 parent 7f4c356 commit 66cfeaf

File tree

4 files changed

+185
-0
lines changed

4 files changed

+185
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <conio.h>
2+
#include <iostream>
3+
#include <math.h>
4+
#include <stdio.h>
5+
#include <string.h>
6+
#include <unistd.h>
7+
8+
9+
using namespace std;
10+
11+
int main() {
12+
float A = 0, B = 0;
13+
float i, j;
14+
int k;
15+
float z[1760];
16+
char b[1760];
17+
for (;;) {
18+
memset(b, 32, 1760);
19+
memset(z, 0, 7040);
20+
for (j = 0; j < 6.28; j += 0.07) {
21+
for (i = 0; i < 6.28; i += 0.02) {
22+
float c = sin(i);
23+
float d = cos(j);
24+
float e = sin(A);
25+
float f = sin(j);
26+
float g = cos(A);
27+
float h = d + 2;
28+
float D = 1 / (c * h * e + f * g + 5);
29+
float l = cos(i);
30+
float m = cos(B);
31+
float n = sin(B);
32+
float t = c * h * g - f * e;
33+
int x = 40 + 30 * D * (l * h * m - t * n);
34+
int y = 12 + 15 * D * (l * h * n + t * m);
35+
int o = x + 80 * y;
36+
int N = 8 * ((f * e - c * d * g) * m - c * d * e - f * g - l * d * n);
37+
if (22 > y && y > 0 && x > 0 && 80 > x && D > z[o]) {
38+
z[o] = D;
39+
b[o] = ".,-~:;=!*#$@"[N > 0 ? N : 0];
40+
}
41+
}
42+
}
43+
for (k = 0; k < 1761; k++) {
44+
putchar(k % 80 ? b[k] : 10);
45+
A += 0.00004;
46+
B += 0.00002;
47+
}
48+
usleep(30000);
49+
system("cls");
50+
cout << "Copyright @ Catrol, 2021" << endl << "3D 旋转 甜甜圈 控制台" << endl;
51+
}
52+
return 0;
53+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <conio.h>
2+
#include <iostream>
3+
#include <math.h>
4+
#include <stdio.h>
5+
#include <string.h>
6+
#include <unistd.h>
7+
8+
9+
using namespace std;
10+
11+
int main() {
12+
float A = 0, B = 0;
13+
float i, j;
14+
int k;
15+
float z[1760];
16+
char b[1760];
17+
for (;;) {
18+
memset(b, 32, 1760);
19+
memset(z, 0, 7040);
20+
for (j = 0; j < 6.28; j += 0.07) {
21+
for (i = 0; i < 6.28; i += 0.02) {
22+
float c = sin(i);
23+
float d = cos(j);
24+
float e = sin(A);
25+
float f = sin(j);
26+
float g = cos(A);
27+
float h = d + 2;
28+
float D = 1 / (c * h * e + f * g + 5);
29+
float l = cos(i);
30+
float m = cos(B);
31+
float n = sin(B);
32+
float t = c * h * g - f * e;
33+
int x = 40 + 30 * D * (l * h * m - t * n);
34+
int y = 12 + 15 * D * (l * h * n + t * m);
35+
int o = x + 80 * y;
36+
int N = 8 * ((f * e - c * d * g) * m - c * d * e - f * g - l * d * n);
37+
if (22 > y && y > 0 && x > 0 && 80 > x && D > z[o]) {
38+
z[o] = D;
39+
b[o] = ".,-~:!=#&%$@"[N > 0 ? N : 0];
40+
}
41+
}
42+
}
43+
for (k = 0; k < 1761; k++) {
44+
putchar(k % 80 ? b[k] : 10);
45+
A += 0.00004;
46+
B += 0.00002;
47+
}
48+
usleep(30000);
49+
system("cls");
50+
cout << "Copyright @ Catrol, 2021" << endl << "3D 旋转 甜甜圈 控制台" << endl;
51+
}
52+
return 0;
53+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
float A = 0, B = 0, i, j, z[1760];
4+
long long sleepT = 30000;
5+
int k;
6+
char b[1760];
7+
const float hjf = 6.28, jzen = 0.07, izen = 0.02, Azen = 0.00004, Bzen = 0.00002;
8+
int main() {
9+
printf("Input your target speed (greater then slower) : ");
10+
scanf("%lld", &sleepT);
11+
for (;;) {
12+
memset(b, 32, 1760);
13+
memset(z, 0, 7040);
14+
for (j = 0; j < hjf; j += jzen) {
15+
for (i = 0; i < hjf; i += izen) {
16+
float c, d, e, f, g, h, D, l, m, n, t;
17+
int x, y, o, N;
18+
c = sin(i), d = cos(j), e = sin(A), f = sin(j), g = cos(A), h = d + 2,
19+
D = 1 / (c * h * e + f * g + 5), l = cos(i), m = cos(B), n = sin(B), t = c * h * g - f * e;
20+
x = 40 + 30 * D * (l * h * m - t * n), y = 12 + 15 * D * (l * h * n + t * m);
21+
o = x + 80 * y, N = 8 * ((f * e - c * d * g) * m - c * d * e - f * g - l * d * n);
22+
if (22 > y && y > 0 && x > 0 && 80 > x && D > z[o]) {
23+
z[o] = D;
24+
b[o] = ".,-~:;=!*#$@"[N > 0 ? N : 0];
25+
}
26+
}
27+
}
28+
for (k = 0; k < 1761; k++) {
29+
putchar(k % 80 ? b[k] : 10);
30+
A += Azen;
31+
B += Bzen;
32+
}
33+
usleep(sleepT);
34+
system("cls");
35+
cout << "Copyright @ Catrol, 2021" << endl << "3D Rotate Round Donut" << endl;
36+
}
37+
return 0;
38+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <iostream>
2+
#include <math.h>
3+
#include <stdio.h>
4+
#include <string.h>
5+
#include <unistd.h>
6+
7+
8+
using namespace std;
9+
10+
int main() {
11+
float A = 0, B = 0;
12+
float i, j;
13+
int k;
14+
float z[1760];
15+
char b[1760];
16+
for (;;) {
17+
memset(b, 32, 1760);
18+
memset(z, 0, 7040);
19+
for (j = 0; j < 6.28; j += 0.07) {
20+
for (i = 0; i < 6.28; i += 0.02) {
21+
float c = sin(i), d = cos(j), e = sin(A), f = sin(j), g = cos(A);
22+
float h = d + 2;
23+
float D = 1 / (c * h * e + f * g + 5);
24+
float l = cos(i), m = cos(B), n = sin(B), t = c * h * g - f * e;
25+
int x = 40 + 30 * D * (l * h * m - t * n), y = 12 + 15 * D * (l * h * n + t * m),
26+
o = x + 80 * y, N = 8 * ((f * e - c * d * g) * m - c * d * e - f * g - l * d * n);
27+
if (22 > y && y > 0 && x > 0 && 80 > x && D > z[o]) {
28+
z[o] = D;
29+
b[o] = ".,-~:;=!*#$@"[N > 0 ? N : 0];
30+
}
31+
}
32+
}
33+
for (k = 0; k < 1761; k++) {
34+
putchar(k % 80 ? b[k] : 10);
35+
A += 0.00004;
36+
B += 0.00002;
37+
}
38+
usleep(30000);
39+
}
40+
return 0;
41+
}

0 commit comments

Comments
 (0)