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.11 by greg, Wed Oct 23 15:19:25 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   {
26          double  atof(), sin(), cos();
27 <        double  xfmat[4][4], m4[4][4];
27 >        MAT4  xfmat, m4;
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   }
133  
134  
136 #ifdef  INVXF
135   int
136 < invxf(retmat, retsca, ac, av)           /* invert transform specification */
137 < double  retmat[4][4];
140 < double  *retsca;
136 > invxf(ret, ac, av)              /* invert transform specification */
137 > register XF  *ret;
138   int  ac;
139   char  *av[];
140   {
141          double  atof(), sin(), cos();
142 <        double  xfmat[4][4], m4[4][4];
142 >        MAT4  xfmat, m4;
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);
# Line 227 | Line 224 | char  *av[];
224                  case 'i':                       /* iterate */
225                          checkarg(2,1);
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);
# Line 243 | Line 240 | char  *av[];
240          }
241   done:
242          while (icnt-- > 0) {
243 <                multmat4(retmat, xfmat, retmat);
244 <                *retsca *= xfsca;
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