8 |
|
|
9 |
|
/* Assumes included after standard.h */ |
10 |
|
|
11 |
+ |
#include <values.h> |
12 |
+ |
|
13 |
|
#define ZERO(x) ((x) < FTINY && (x) > -FTINY) |
14 |
|
#define EQUAL(a,b) ZERO((a) - (b)) |
15 |
|
|
18 |
|
#define FALSE 0 |
19 |
|
#endif |
20 |
|
|
21 |
+ |
typedef struct _FPEQ { |
22 |
+ |
FVECT n; |
23 |
+ |
double d; |
24 |
+ |
char x,y,z; |
25 |
+ |
}FPEQ; |
26 |
+ |
|
27 |
+ |
#define FP_N(f) ((f).n) |
28 |
+ |
#define FP_D(f) ((f).d) |
29 |
+ |
#define FP_X(f) ((f).x) |
30 |
+ |
#define FP_Y(f) ((f).y) |
31 |
+ |
#define FP_Z(f) ((f).z) |
32 |
+ |
|
33 |
+ |
typedef long BCOORD; |
34 |
+ |
typedef long BDIR; |
35 |
+ |
typedef long TINT; |
36 |
+ |
#define BITS_BCOORD (BITS(long)>>1) |
37 |
+ |
#define SHIFT_MAXBCOORD (BITS_BCOORD-2) |
38 |
+ |
#define MAXBCOORD (1L << SHIFT_MAXBCOORD) |
39 |
+ |
#define MAXBCOORD2 (MAXBCOORD>>1) |
40 |
+ |
#define MAXBDIR MAXBCOORD |
41 |
+ |
#define MAXT MAXBCOORD |
42 |
+ |
#define HUGET MAXLONG |
43 |
+ |
|
44 |
|
#define M_2_3_PI PI*2/3 |
45 |
|
|
46 |
+ |
#ifndef INVALID |
47 |
|
#define INVALID -1 |
48 |
+ |
#endif |
49 |
|
|
50 |
|
#define GT_INVALID 0 |
51 |
|
#define GT_VERTEX 1 |
75 |
|
|
76 |
|
#define MIN_VEC3(v) ((v)[0]<(v)[1]?((v)[0]<(v)[2]?(v)[0]:v[2]): \ |
77 |
|
(v)[1]<(v)[2]?(v)[1]:(v)[2]) |
78 |
< |
|
78 |
> |
#define MAX3(a,b,c) (((b)>(a))?((b) > (c))?(b):(c):((a)>(c))?(a):(c)) |
79 |
> |
#define MIN3(a,b,c) (((b)<(a))?((b) < (c))?(b):(c):((a)<(c))?(a):(c)) |
80 |
> |
#define MAX(a,b) (((b)>(a))?(b):(a)) |
81 |
> |
#define MIN(a,b) (((b)<(a))?(b):(a)) |
82 |
|
|
83 |
|
#define SUM_3VEC3(r,a,b,c) ((r)[0]=(a)[0]+(b)[0]+(c)[0], \ |
84 |
|
(r)[1]=(a)[1]+(b)[1]+(c)[1],(r)[2]=(a)[2]+(b)[2]+(c)[2]) |
118 |
|
/* double spherical_edge_normal(FVECT v0,FVECT v1,FVECT n,char norm) */ |
119 |
|
double spherical_edge_normal(); |
120 |
|
|
121 |
+ |
#define point_in_stri_n(n0,n1,n2,p) \ |
122 |
+ |
((DOT(n0,p)<=0.0)&&(DOT(n1,p)<=0.0)&&(DOT(n2,p)<=0.0)) |
123 |
|
|
124 |
+ |
#define PT_ON_PLANE(p,peq) (DOT(FP_N(peq),p)+FP_D(peq)) |