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

Comparing ray/src/cv/lampcolor.c (file contents):
Revision 1.5 by greg, Thu Sep 12 13:26:16 1991 UTC vs.
Revision 1.6 by greg, Thu Sep 12 13:36:43 1991 UTC

# Line 182 | Line 182 | compute()                      /* compute lamp radiance */
182   }
183  
184  
185 < getd(dp)                        /* get a positive double from stdin */
185 > getd(name, dp, help)            /* get a positive double from stdin */
186 > char    *name;
187   double  *dp;
188 + char    *help;
189   {
190          char    buf[32];
191 <
191 > again:
192 >        printf("%s [%g]: ", name, *dp);
193          if (gets(buf) == NULL)
194                  return(0);
195 +        if (buf[0] == '?') {
196 +                puts(help);
197 +                goto again;
198 +        }
199          if ((buf[0] < '0' || buf[0] > '9') && buf[0] != '.')
200                  return(0);
201          *dp = atof(buf);
# Line 200 | Line 207 | getpolygon()                   /* get projected area for a polygon */
207   {
208          static double   area = 1.0;
209  
210 <        printf("Polygon area [%g]: ", area);
211 <        getd(&area);
210 >        getd("Polygon area", &area,
211 >                "Enter the total radiating area of the polygon.");
212          projarea = PI*unit2meter*unit2meter * area;
213          return(1);
214   }
# Line 211 | Line 218 | getsphere()                    /* get projected area for a sphere */
218   {
219          static double   radius = 1.0;
220  
221 <        printf("Sphere radius [%g]: ", radius);
222 <        getd(&radius);
221 >        getd("Sphere radius", &radius,
222 >                "Enter the distance from the sphere's center to its surface.");
223          projarea = 4.*PI*PI*unit2meter*unit2meter * radius*radius;
224          return(1);
225   }
# Line 222 | Line 229 | getcylinder()                  /* get projected area for a cylinder *
229   {
230          static double   length = 1.0, radius = 0.1;
231  
232 <        printf("Cylinder length [%g]: ", length);
233 <        getd(&length);
234 <        printf("Cylinder radius [%g]: ", radius);
235 <        getd(&radius);
232 >        getd("Cylinder length", &length,
233 >                "Enter the length of the cylinder.");
234 >        getd("Cylinder radius", &radius,
235 >                "Enter the distance from the cylinder's axis to its surface.");
236          projarea = PI*PI*2.*PI*unit2meter*unit2meter * radius*length;
237          return(1);
238   }
# Line 235 | Line 242 | getring()                      /* get projected area for a ring */
242   {
243          static double   radius = 1.0;
244  
245 <        printf("Disk radius [%g]: ", radius);
246 <        getd(&radius);
245 >        getd("Disk radius", &radius,
246 > "Enter the distance from the ring's center to its outer edge.\n\
247 > The inner radius must be zero.");
248          projarea = PI*PI*unit2meter*unit2meter * radius*radius;
249          return(1);
250   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines