1 |
– |
/* Copyright (c) 1990 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* xf.c - routines to convert transform arguments into 4X4 matrix. |
6 |
|
* |
7 |
< |
* 1/28/86 |
7 |
> |
* External symbols declared in rtmath.h |
8 |
|
*/ |
9 |
|
|
10 |
< |
#include "standard.h" |
10 |
> |
#include <stdlib.h> |
11 |
> |
#include "rtmath.h" |
12 |
> |
#include "rtio.h" |
13 |
|
|
14 |
|
#define d2r(a) ((PI/180.)*(a)) |
15 |
|
|
17 |
|
|
18 |
|
|
19 |
|
int |
20 |
< |
xf(ret, ac, av) /* get transform specification */ |
22 |
< |
register XF *ret; |
23 |
< |
int ac; |
24 |
< |
char *av[]; |
20 |
> |
xf(XF *ret, int ac, char *av[]) /* get transform specification */ |
21 |
|
{ |
22 |
|
MAT4 xfmat, m4; |
23 |
|
double xfsca, dtmp; |
64 |
|
m4[1][0] = -(m4[0][1] = sin(dtmp)); |
65 |
|
break; |
66 |
|
default: |
67 |
< |
return(i); |
67 |
> |
goto done; |
68 |
|
} |
69 |
|
break; |
70 |
|
|
97 |
|
m4[2][2] = -1.0; |
98 |
|
break; |
99 |
|
default: |
100 |
< |
return(i); |
100 |
> |
goto done; |
101 |
|
} |
102 |
|
break; |
103 |
|
|
113 |
|
continue; |
114 |
|
|
115 |
|
default: |
116 |
< |
return(i); |
116 |
> |
goto done; |
117 |
|
|
118 |
|
} |
119 |
|
multmat4(xfmat, xfmat, m4); |
128 |
|
|
129 |
|
|
130 |
|
int |
131 |
< |
invxf(ret, ac, av) /* invert transform specification */ |
136 |
< |
register XF *ret; |
137 |
< |
int ac; |
138 |
< |
char *av[]; |
131 |
> |
invxf(XF *ret, int ac, char *av[]) /* invert transform specification */ |
132 |
|
{ |
133 |
|
MAT4 xfmat, m4; |
134 |
|
double xfsca, dtmp; |
175 |
|
m4[1][0] = -(m4[0][1] = sin(dtmp)); |
176 |
|
break; |
177 |
|
default: |
178 |
< |
return(i); |
178 |
> |
goto done; |
179 |
|
} |
180 |
|
break; |
181 |
|
|
208 |
|
m4[2][2] = -1.0; |
209 |
|
break; |
210 |
|
default: |
211 |
< |
return(i); |
211 |
> |
goto done; |
212 |
|
} |
213 |
|
break; |
214 |
|
|
224 |
|
break; |
225 |
|
|
226 |
|
default: |
227 |
< |
return(i); |
227 |
> |
goto done; |
228 |
|
|
229 |
|
} |
230 |
|
multmat4(xfmat, m4, xfmat); /* left multiply */ |
239 |
|
|
240 |
|
|
241 |
|
int |
242 |
< |
fullxf(fx, ac, av) /* compute both forward and inverse */ |
250 |
< |
FULLXF *fx; |
251 |
< |
int ac; |
252 |
< |
char *av[]; |
242 |
> |
fullxf(FULLXF *fx, int ac, char *av[]) /* compute both forward and inverse */ |
243 |
|
{ |
244 |
|
xf(&fx->f, ac, av); |
245 |
|
return(invxf(&fx->b, ac, av)); |