141 |
|
* Definitions for 3-d vector manipulation functions |
142 |
|
*/ |
143 |
|
|
144 |
< |
#ifdef SMLFLT |
145 |
< |
#define FLOAT float |
144 |
> |
#ifdef SMLFLT |
145 |
> |
#define FLOAT float |
146 |
> |
#define FTINY (1e-3) |
147 |
|
#else |
148 |
< |
#define FLOAT double |
148 |
> |
#define FLOAT double |
149 |
> |
#define FTINY (1e-6) |
150 |
|
#endif |
151 |
+ |
#define FHUGE (1e10) |
152 |
|
|
153 |
|
typedef FLOAT FVECT[3]; |
154 |
|
|
155 |
+ |
#define VCOPY(v1,v2) ((v1)[0]=(v2)[0],(v1)[1]=(v2)[1],(v1)[2]=(v2)[2]) |
156 |
+ |
#define DOT(v1,v2) ((v1)[0]*(v2)[0]+(v1)[1]*(v2)[1]+(v1)[2]*(v2)[2]) |
157 |
+ |
#define VSUM(vr,v1,v2,f) ((vr)[0]=(v1)[0]+(f)*(v2)[0], \ |
158 |
+ |
(vr)[1]=(v1)[1]+(f)*(v2)[1], \ |
159 |
+ |
(vr)[2]=(v1)[2]+(f)*(v2)[2]) |
160 |
+ |
|
161 |
+ |
#define is0vect(v) (DOT(v,v) < FTINY*FTINY) |
162 |
+ |
|
163 |
+ |
#define round0(x) if (x <= FTINY && x >= -FTINY) x = 0 |
164 |
+ |
|
165 |
|
#ifdef NOPROTO |
166 |
|
extern double normalize(); /* normalize a vector */ |
167 |
|
#else |
198 |
|
FVECT p, n; /* point and normal */ |
199 |
|
} C_VERTEX; /* vertex context */ |
200 |
|
|
201 |
+ |
#define isgrey(cxy) ((cxy)->cx > .31 && (cxy)->cx < .35 && \ |
202 |
+ |
(cxy)->cy > .31 && (cxy)->cy < .35) |
203 |
+ |
|
204 |
|
#define C_DEFCOLOR {.333,.333} |
205 |
|
#define C_DEFMATERIAL {NULL,1,0.,C_DEFCOLOR,0.,C_DEFCOLOR,0.,C_DEFCOLOR,\ |
206 |
|
0.,C_DEFCOLOR,0.,0.,C_DEFCOLOR,0.} |
345 |
|
extern MEM_PTR malloc(); |
346 |
|
extern MEM_PTR calloc(); |
347 |
|
extern MEM_PTR realloc(); |
348 |
+ |
extern void free(); |