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.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);
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  
135   #ifdef  INVXF
136   int
137 < invxf(retmat, retsca, ac, av)           /* invert transform specification */
138 < double  retmat[4][4];
137 < double  *retsca;
137 > invxf(ret, ac, av)              /* invert transform specification */
138 > register XF  *ret;
139   int  ac;
140   char  *av[];
141   {
# Line 143 | 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);
152          xfsca = 1.0;
153  
# Line 222 | Line 224 | char  *av[];
224  
225                  case 'i':                       /* iterate */
226                          checkarg(2,1);
225                        icnt = atoi(av[++i]);
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);
233                          xfsca = 1.0;
234                          break;
# Line 238 | Line 240 | char  *av[];
240                  multmat4(xfmat, m4, xfmat);     /* left multiply */
241          }
242   done:
243 <        multmat4(retmat, xfmat, retmat);
244 <        *retsca *= xfsca;
243 >        while (icnt-- > 0) {
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