ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/genclock.c
(Generate patch)

Comparing ray/src/gen/genclock.c (file contents):
Revision 2.1 by greg, Thu May 25 16:34:47 1995 UTC vs.
Revision 2.4 by greg, Sat Feb 22 02:07:23 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1995 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Generate an analog clock.
6   */
7  
8   #include <stdio.h>
9 + #include <stdlib.h>
10   #include <math.h>
11   #include <ctype.h>
12  
13   #define PI              3.14159265358979323846
14  
17 #ifdef  DCL_ATOF
18 extern double  atof();
19 #endif
20
15   #define FACEBITMAP      "clockface.hex"
16  
17   char    myfacemat[] = "white_plastic";
# Line 107 | Line 101 | genclock()                             /* put out clock body */
101          printf("\n%s ring %s.case_front\n", casemat, name);
102          printf("0\n0\n8\t.12\t0\t0\n\t1\t0\t0\n\t1\t1.1\n");
103          printf("\n%s cylinder %s.case_inner\n", casemat, name);
104 <        printf("0\n0\n7\t.05\t0\t0\n\t.15\t0\t0\n\t1\n");
104 >        printf("0\n0\n7\t.05\t0\t0\n\t.12\t0\t0\n\t1\n");
105          printf("\nclock_crystal ring %s.crystal\n", name);
106          printf("0\n0\n8\t.10\t0\t0\n\t1\t0\t0\n\t0\t1\n");
107          printf("\nclock_face_paint ring %s.face\n", name);
# Line 125 | Line 119 | double hour;
119  
120          printf("\nhand_paint polygon %s.hour_hand\n", name);
121          printf("0\n0\n12\n");
122 <        rvert(.06, -.03, -.03, hrot);
123 <        rvert(.06, .03, -.03, hrot);
122 >        rvert(.06, -.03, -.06, hrot);
123 >        rvert(.06, .03, -.06, hrot);
124          rvert(.06, .025, .5, hrot);
125          rvert(.06, -.025, .5, hrot);
126  
127          printf("\nhand_paint polygon %s.minute_hand\n", name);
128          printf("0\n0\n12\n");
129 <        rvert(.07, -.02, -.04, mrot);
130 <        rvert(.07, .02, -.04, mrot);
129 >        rvert(.07, -.02, -.1, mrot);
130 >        rvert(.07, .02, -.1, mrot);
131          rvert(.07, .01, .9, mrot);
132          rvert(.07, -.01, .9, mrot);
133   }
# Line 142 | Line 136 | double hour;
136   rvert(x, y, z, ang)                     /* print rotated vertex */
137   double  x, y, z, ang;
138   {
139 <        double  sa, ca;
139 >        static double   lastang=0, sa=0, ca=1;
140  
141 <        sa = sin(-ang);
142 <        ca = cos(-ang);
141 >        if (ang != lastang) {
142 >                sa = sin(-ang);
143 >                ca = cos(-ang);
144 >                lastang = ang;
145 >        }
146          printf("%15.12g %15.12g %15.12g\n", x, y*ca-z*sa, z*ca+y*sa);
147   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines