ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/sm_geom.h
(Generate patch)

Comparing ray/src/hd/sm_geom.h (file contents):
Revision 3.1 by gwlarson, Wed Aug 19 17:45:24 1998 UTC vs.
Revision 3.7 by gwlarson, Mon Dec 28 18:07:35 1998 UTC

# Line 8 | Line 8
8  
9   /* Assumes included after standard.h  */
10  
11 + #include <values.h>
12 +
13 + #define F_TINY 1e-5
14 + #define FZERO(x) ((x) < F_TINY && (x) > -F_TINY)
15 + #define FEQUAL(a,b) FZERO((a) - (b))
16 +
17   #define ZERO(x) ((x) < FTINY && (x) > -FTINY)
18   #define EQUAL(a,b) ZERO((a) - (b))
19  
# Line 16 | Line 22
22   #define FALSE 0
23   #endif
24  
25 + typedef struct _FPEQ {
26 +    FVECT n;
27 +    double d;
28 +    char x,y,z;
29 + }FPEQ;
30 +
31 + #define FP_N(f) ((f).n)
32 + #define FP_D(f) ((f).d)
33 + #define FP_X(f) ((f).x)
34 + #define FP_Y(f) ((f).y)
35 + #define FP_Z(f) ((f).z)
36 +  
37 + typedef long BCOORD;
38 + typedef long BDIR;
39 + typedef long TINT;
40 +
41 + #define BITS_BCOORD     (BITS(long)-2)
42 + #define SHIFT_MAXBCOORD (BITS_BCOORD-1)  
43 + #define MAXBCOORD      ((1L << BITS_BCOORD)-1)
44 + #define MAXBCOORD2      (MAXBCOORD>>1)
45 + #define MAXBCOORD4      (MAXBCOORD2>>1)
46 +
47   #define M_2_3_PI PI*2/3
48  
49 + #ifndef INVALID
50 + #define INVALID -1
51 + #endif
52 +
53   #define GT_INVALID  0
54   #define GT_VERTEX   1
55   #define GT_EDGE     2
# Line 29 | Line 61
61  
62   #define ZERO_VEC3(v)     (ZERO(v[0]) && ZERO(v[1]) && ZERO(v[2]) )
63   #define EQUAL_VEC3(a,b)  (EQUAL(a[0],b[0])&&EQUAL(a[1],b[1])&&EQUAL(a[2],b[2]))
64 + #define OPP_EQUAL_VEC3(a,b)  (EQUAL(a[0],-b[0])&&EQUAL(a[1],-b[1])&&EQUAL(a[2],-b[2]))
65 + #define FZERO_VEC3(v)     (FZERO(v[0]) && FZERO(v[1]) && FZERO(v[2]) )
66 + #define FEQUAL_VEC3(a,b) (FEQUAL(a[0],b[0])&&FEQUAL(a[1],b[1])&&FEQUAL(a[2],b[2]))
67   #define NEGATE_VEC3(v)   ((v)[0] *= -1.0,(v)[1] *= -1.0,(v)[2] *= -1.0)
68   #define COPY_VEC2(v1,v2) ((v1)[0]=(v2)[0],(v1)[1]=(v2)[1])
69   #define DIST(a,b)         (sqrt(((a)[0]-(b)[0])*((a)[0]-(b)[0]) + \
70                                  ((a)[1]-(b)[1])*((a)[1]-(b)[1]) + \
71                                  ((a)[2]-(b)[2])*((a)[2]-(b)[2])))
72 + #define DIST_SQ(a,b)      (((a)[0]-(b)[0])*((a)[0]-(b)[0]) + \
73 +                                ((a)[1]-(b)[1])*((a)[1]-(b)[1]) + \
74 +                                ((a)[2]-(b)[2])*((a)[2]-(b)[2]))
75  
76 + #define SIGN(x) ((x<0)?-1:1)
77   #define CROSS_VEC2(v1,v2) (((v1)[0]*(v2)[1]) - ((v1)[1]*(v2)[0]))
78   #define DOT_VEC2(v1,v2) ((v1)[0]*(v2)[0] + (v1)[1]*(v2)[1])
79  
80 < #define EDGE_MIDPOINT_VEC3(a,v1,v2) ((a)[0]=((v1)[0]+(v2)[0])*0.5, \
80 > #define EDGE_MIDPOINT(a,v1,v2) ((a)[0]=((v1)[0]+(v2)[0])*0.5, \
81   (a)[1]=((v1)[1]+(v2)[1])*0.5,(a)[2] = ((v1)[2]+(v2)[2])*0.5)
82  
83   #define MIN_VEC3(v) ((v)[0]<(v)[1]?((v)[0]<(v)[2]?(v)[0]:v[2]): \
84                       (v)[1]<(v)[2]?(v)[1]:(v)[2])
85 <  
85 > #define MAX3(a,b,c) (((b)>(a))?((b) > (c))?(b):(c):((a)>(c))?(a):(c))  
86 > #define MIN3(a,b,c) (((b)<(a))?((b) < (c))?(b):(c):((a)<(c))?(a):(c))                      
87 > #define MAX(a,b)    (((b)>(a))?(b):(a))  
88 > #define MIN(a,b)  (((b)<(a))?(b):(a))  
89 >
90   #define SUM_3VEC3(r,a,b,c) ((r)[0]=(a)[0]+(b)[0]+(c)[0], \
91     (r)[1]=(a)[1]+(b)[1]+(c)[1],(r)[2]=(a)[2]+(b)[2]+(c)[2])
92  
# Line 81 | Line 124
124   double tri_normal();
125   /* double spherical_edge_normal(FVECT v0,FVECT v1,FVECT n,char norm) */
126   double spherical_edge_normal();
127 + double point_on_sphere();
128  
129 + #define point_in_stri_n(n0,n1,n2,p) \
130 +  ((DOT(n0,p)<=FTINY)&&(DOT(n1,p)<=FTINY)&&(DOT(n2,p)<=FTINY))
131 +
132 + #define PT_ON_PLANE(p,peq) (DOT(FP_N(peq),p)+FP_D(peq))
133  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines