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

Comparing ray/src/common/xf.c (file contents):
Revision 1.7 by greg, Wed Oct 18 23:15:37 1989 UTC vs.
Revision 1.10 by greg, Mon Jul 15 11:28:41 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1990 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10   *     1/28/86
11   */
12  
13 + #include  "standard.h"
14  
14 #define  PI             3.14159265358979323846
15   #define  d2r(a)         ((PI/180.)*(a))
16  
17   #define  checkarg(a,n)  if (av[i][a] || i+n >= ac) goto done
18  
19  
20   int
21 < xf(retmat, retsca, ac, av)              /* get transform specification */
22 < double  retmat[4][4];
23 < double  *retsca;
21 > xf(ret, ac, av)                 /* get transform specification */
22 > register XF  *ret;
23   int  ac;
24   char  *av[];
25   {
# Line 29 | Line 28 | char  *av[];
28          double  xfsca, dtmp;
29          int  i, icnt;
30  
31 <        setident4(retmat);
32 <        *retsca = 1.0;
31 >        setident4(ret->xfm);
32 >        ret->sca = 1.0;
33  
34 +        icnt = 1;
35          setident4(xfmat);
36          xfsca = 1.0;
37  
# Line 108 | Line 108 | char  *av[];
108  
109                  case 'i':                       /* iterate */
110                          checkarg(2,1);
111                        icnt = atoi(av[++i]);
111                          while (icnt-- > 0) {
112 <                                multmat4(retmat, retmat, xfmat);
113 <                                *retsca *= xfsca;
112 >                                multmat4(ret->xfm, ret->xfm, xfmat);
113 >                                ret->sca *= xfsca;
114                          }
115 +                        icnt = atoi(av[++i]);
116                          setident4(xfmat);
117                          xfsca = 1.0;
118 <                        break;
118 >                        continue;
119  
120                  default:
121                          return(i);
# Line 124 | Line 124 | char  *av[];
124                  multmat4(xfmat, xfmat, m4);
125          }
126   done:
127 <        multmat4(retmat, retmat, xfmat);
128 <        *retsca *= xfsca;
127 >        while (icnt-- > 0) {
128 >                multmat4(ret->xfm, ret->xfm, xfmat);
129 >                ret->sca *= xfsca;
130 >        }
131          return(i);
132   }
133  
134  
133 #ifdef  INVXF
135   int
136 < invxf(retmat, retsca, ac, av)           /* invert transform specification */
137 < double  retmat[4][4];
137 < double  *retsca;
136 > invxf(ret, ac, av)              /* invert transform specification */
137 > register XF  *ret;
138   int  ac;
139   char  *av[];
140   {
# Line 143 | Line 143 | char  *av[];
143          double  xfsca, dtmp;
144          int  i, icnt;
145  
146 <        setident4(retmat);
147 <        *retsca = 1.0;
146 >        setident4(ret->xfm);
147 >        ret->sca = 1.0;
148  
149 +        icnt = 1;
150          setident4(xfmat);
151          xfsca = 1.0;
152  
# Line 222 | Line 223 | char  *av[];
223  
224                  case 'i':                       /* iterate */
225                          checkarg(2,1);
225                        icnt = atoi(av[++i]);
226                          while (icnt-- > 0) {
227 <                                multmat4(retmat, xfmat, retmat);
228 <                                *retsca *= xfsca;
227 >                                multmat4(ret->xfm, xfmat, ret->xfm);
228 >                                ret->sca *= xfsca;
229                          }
230 +                        icnt = atoi(av[++i]);
231                          setident4(xfmat);
232                          xfsca = 1.0;
233                          break;
# Line 238 | Line 239 | char  *av[];
239                  multmat4(xfmat, m4, xfmat);     /* left multiply */
240          }
241   done:
242 <        multmat4(retmat, xfmat, retmat);
243 <        *retsca *= xfsca;
242 >        while (icnt-- > 0) {
243 >                multmat4(ret->xfm, xfmat, ret->xfm);
244 >                ret->sca *= xfsca;
245 >        }
246          return(i);
247   }
248 < #endif
248 >
249 >
250 > int
251 > fullxf(fx, ac, av)                      /* compute both forward and inverse */
252 > FULLXF  *fx;
253 > int  ac;
254 > char  *av[];
255 > {
256 >        xf(&fx->f, ac, av);
257 >        return(invxf(&fx->b, ac, av));
258 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines