-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTHREED.C
executable file
·112 lines (72 loc) · 1.66 KB
/
THREED.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* This is my test function for the graphics libraries
In this case, a 3d rotating cube
Author: Bryce Lobdell
Date: 12/14/98
*/
struct point
{
float x,y;
};
struct line
{
float x1,y1,z1,x2,y2,z2;
};
/* Works like this cube[x][ 0 1 2 3 4 5]
x1 y1 z1 x2 y2 z2
*/
float cube[12][6]={ {-1,-1,-1,1,-1,-1},
{1,-1,-1,1,1,-1},
{1,1,-1,-1,1,-1},
{-1,1,-1,-1,-1,-1},
{-1,-1,-1,-1,-1,1},
{-1,-1,1,-1,1,1},
{-1,1,1,-1,1,-1},
{1,-1,-1,1,-1,1},
{1,-1,1,-1,-1,1},
{1,-1,1,1,1,1},
{1,1,1,-1,1,1},
{1,1,-1,1,1,1}
};
#include "stdio.h"
#include "vector.h"
#include "cartmath.h"
#include "graphics.h"
#include "conio.h"
void printv(struct vector v)
{
printf("i=%f j=%f k=%f\n",v.i,v.j,v.k);
}
#define SCRUP 0
#define SCRDOWN 480
#define SCRRIGHT 640
#define SCRLEFT 0
#define VIEWUP 2
#define VIEWDOWN -2
#define VIEWRIGHT 2
#define VIEWLEFT 2
#define XSCALE ((SCRRIGHT-SCRLEFT)/(VIEWRIGHT-VIEWLEFT))
#define YSCALE ((SCRUP-SCRDOWN)/(VIEWUP-VIEWDOWN))
#define XCENTER ((SCRRIGHT+SCRLEFT)/2)
#define YCENTER ((SCRUP+SCRDOWN)/2)
#define XCENTER_V ((VIEWRIGHT+VIEWLEFT)/2)
#define YCENTER_V ((VIEWUP+VIEWDOWN)/2)
struct point viewport(struct point l)
{
l.x=((l.x-XCENTER_V)/XSCALE)+XCENTER;
l.y=((l.y-YCENTER_V)/YSCALE)+YCENTER;
return l;
}
#define SINX
#define COSX
struct vector rotatexy
{
}
main()
{
int gdriver=VGA,gmode=VGAHI;
initgraph(&gdriver,&gmode,"c:\\winprogs\\bc45\\bgi");
do {
} while (!kbhit());
closegraph();
return 0;
}