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.8 by greg, Tue Feb 20 18:02:30 1990 UTC vs.
Revision 1.9 by greg, Sat Dec 15 15:01:40 1990 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);
# Line 110 | Line 109 | char  *av[];
109                  case 'i':                       /* iterate */
110                          checkarg(2,1);
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);
# Line 126 | Line 125 | char  *av[];
125          }
126   done:
127          while (icnt-- > 0) {
128 <                multmat4(retmat, retmat, xfmat);
129 <                *retsca *= xfsca;
128 >                multmat4(ret->xfm, ret->xfm, xfmat);
129 >                ret->sca *= xfsca;
130          }
131          return(i);
132   }
# Line 135 | Line 134 | done:
134  
135   #ifdef  INVXF
136   int
137 < invxf(retmat, retsca, ac, av)           /* invert transform specification */
138 < double  retmat[4][4];
140 < double  *retsca;
137 > invxf(ret, ac, av)              /* invert transform specification */
138 > register XF  *ret;
139   int  ac;
140   char  *av[];
141   {
# Line 146 | Line 144 | char  *av[];
144          double  xfsca, dtmp;
145          int  i, icnt;
146  
147 <        setident4(retmat);
148 <        *retsca = 1.0;
147 >        setident4(ret->xfm);
148 >        ret->sca = 1.0;
149  
150          icnt = 1;
151          setident4(xfmat);
# Line 227 | Line 225 | char  *av[];
225                  case 'i':                       /* iterate */
226                          checkarg(2,1);
227                          while (icnt-- > 0) {
228 <                                multmat4(retmat, xfmat, retmat);
229 <                                *retsca *= xfsca;
228 >                                multmat4(ret->xfm, xfmat, ret->xfm);
229 >                                ret->sca *= xfsca;
230                          }
231                          icnt = atoi(av[++i]);
232                          setident4(xfmat);
# Line 243 | Line 241 | char  *av[];
241          }
242   done:
243          while (icnt-- > 0) {
244 <                multmat4(retmat, xfmat, retmat);
245 <                *retsca *= xfsca;
244 >                multmat4(ret->xfm, xfmat, ret->xfm);
245 >                ret->sca *= xfsca;
246          }
247          return(i);
248 + }
249 +
250 +
251 + int
252 + fullxf(fx, ac, av)                      /* compute both forward and inverse */
253 + FULLXF  *fx;
254 + int  ac;
255 + char  *av[];
256 + {
257 +        xf(&fx->f, ac, av);
258 +        return(invxf(&fx->b, ac, av));
259   }
260   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines