ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/sm_stree.h
Revision: 3.1
Committed: Wed Aug 19 17:45:24 1998 UTC (25 years, 8 months ago) by gwlarson
Content type: text/plain
Branch: MAIN
Log Message:
Initial revision

File Contents

# Content
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
3 /* SCCSid "$SunId$ SGI" */
4
5 /*
6 * sm_stree.h - header file for spherical quadtree code:
7 *
8 */
9
10 #include "sm_qtree.h"
11
12 #define SQRT3_INV 0.5773502692
13
14
15 typedef struct _STREE {
16 QUADTREE root; /* quadtree triangulation of sphere */
17 FVECT center; /* sphere center */
18 FVECT base[4]; /* 4 vertices on sphere that define base triangulation
19 of 4 triangles: assume cover sphere and triangles
20 are base verts (0,1,2),(0,2,3),(0,3,1), and (1,3,2)
21 */
22 }STREE;
23
24 #define ST_ROOT(s) ((s)->root)
25 #define ST_NTH_ROOT(s,n) QT_NTH_CHILD(ST_ROOT(s),n)
26 #define ST_NTH_ROOT_PTR(s,n) QT_NTH_CHILD_PTR(ST_ROOT(s),n)
27 #define ST_CLEAR_ROOT(s) QT_CLEAR_CHILDREN(ST_ROOT(s))
28
29 #define ST_CENTER(s) ((s)->center)
30 #define ST_SET_CENTER(s,b) VCOPY(ST_CENTER(s),b)
31 #define ST_BASE(s) ((s)->base)
32 #define ST_NTH_BASE(s,n) ((s)->base[(n)])
33 #define ST_SET_NTH_BASE(s,n,b) VCOPY(ST_NTH_BASE(s,n),b)
34 #define ST_SET_BASE(s,b) (VCOPY(ST_NTH_BASE(s,0),(b)[0]), \
35 VCOPY(ST_NTH_BASE(s,1),(b)[1]), \
36 VCOPY(ST_NTH_BASE(s,2),(b)[2]), \
37 VCOPY(ST_NTH_BASE(s,3),(b)[3]))
38 #define ST_COORD(s,p,r) VSUB(r,p,ST_CENTER(s))
39
40 /* STREE functions
41
42
43 STREE *stInit(STREE *st)
44 Initialize STREE: if st = NULL, allocate a new one, else clear
45 return pointer to initialized structure
46
47 QUADTREE *stPoint_locate(STREE *st,FVECT pt)
48 Find stree node that projection of pt on sphere falls in
49
50 stInsert_tri()
51 for every quadtree tri in the base- find node all leaf nodes that
52 tri overlaps and add tri to set. If this causes any of the nodes
53 to be over threshhold- split
54 stDelete_tri()
55 for every quadtree tri in the base- find node all leaf nodes that
56 tri overlaps. If this causes any of the nodes to be under
57 threshold- merge
58 */
59 extern int stTri_verts[4][3];
60 extern FVECT stDefault_base[4];
61
62
63
64
65
66
67
68
69