From 4f8c0b937e198597cb264c452cd3ca6bb87409c2 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 26 Jan 2008 19:53:56 +0000 Subject: cleanup --- stern.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/stern.c b/stern.c index b74de23..9907f7b 100644 --- a/stern.c +++ b/stern.c @@ -21,8 +21,8 @@ struct line { struct point a, b; }; -int Calc3D(struct point *, int *, int *); -void DrawObject(int, struct line *, int); +int Calc3D(struct point *, float, float, int *, int *); +void DrawObject(int, struct line *, int); #define Usleep 10000 #define Width 400 @@ -112,11 +112,12 @@ struct line world[] = { #endif /* XGCValues values; */ -Display *display; -Window win; -GC gc; +Display *display; +Window win; +GC gc; -int main(void) +int +main(void) { XEvent event; int screen; @@ -164,17 +165,15 @@ int main(void) } usleep(Usleep); - } return 0; } -float Sr, Cr; - -void DrawObject(int r, struct line *p, int nelem) +void +DrawObject(int r, struct line *p, int nelem) { - float R; + float R, Sr, Cr; int i; int x1, y1, x2, y2; @@ -184,14 +183,14 @@ void DrawObject(int r, struct line *p, int nelem) Cr = cos(R); for(i = 0; i < nelem; ++i) { - Calc3D(&p[i].a, &x1, &y1); - Calc3D(&p[i].b, &x2, &y2); + Calc3D(&p[i].a, Sr, Cr, &x1, &y1); + Calc3D(&p[i].b, Sr, Cr, &x2, &y2); XDrawLine(display, win, gc, x1, y1, x2, y2); } } int -Calc3D(struct point *p, int *x, int *y) +Calc3D(struct point *p, float Sr, float Cr, int *x, int *y) { float X, Y, Z, Xa, Ya, Za; -- cgit v1.2.3