ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/octree.h
Revision: 1.2
Committed: Sat Oct 14 11:25:18 1989 UTC (34 years, 6 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.1: +4 -0 lines
Log Message:
Added return values for surface intersection functions.

File Contents

# Content
1 /* Copyright (c) 1986 Regents of the University of California */
2
3 /* SCCSid "$SunId$ LBL" */
4
5 /*
6 * octree.h - header file for routines using octrees.
7 *
8 * 7/28/85
9 */
10
11 /*
12 * An octree is expressed as an integer which is either
13 * an index to eight other nodes, the empty tree, or an index
14 * to a set of objects. If the octree has a value:
15 *
16 * > -1: it is an index to eight other nodes.
17 *
18 * -1: it is empty
19 *
20 * < -1: it is an index to a set of objects
21 */
22
23 typedef int OCTREE;
24
25 #define EMPTY (-1)
26
27 #define isempty(ot) ((ot) == EMPTY)
28 #define isfull(ot) ((ot) < EMPTY)
29 #define istree(ot) ((ot) > EMPTY)
30
31 #define oseti(ot) (-(ot)-2) /* object set index */
32 #define octbi(ot) ((ot)>>8) /* octree block index */
33 #define octti(ot) (((ot)&0377)<<3)/* octree index in block */
34
35 #define MAXOBLK 4095 /* maximum octree block */
36
37 extern OCTREE *octblock[MAXOBLK]; /* octree blocks */
38
39 #define octkid(ot,br) (octblock[octbi(ot)][octti(ot)+br])
40
41 extern OCTREE octalloc(), combine(), fullnode();
42
43 /*
44 * The cube structure is used to hold an octree and its cubic
45 * boundaries.
46 */
47
48 typedef struct {
49 OCTREE cutree; /* the octree for this cube */
50 FVECT cuorg; /* the cube origin */
51 double cusize; /* the cube size */
52 } CUBE;
53
54 extern CUBE thescene; /* the main scene */
55
56 /* flags for reading and writing octrees */
57 #define IO_CHECK 0 /* verify file type */
58 #define IO_INFO 01 /* information header */
59 #define IO_SCENE 02 /* objects */
60 #define IO_TREE 04 /* octree */
61 #define IO_FILES 010 /* object file names */
62 #define IO_BOUNDS 020 /* octree boundary */
63 #define IO_ALL (~0) /* everything */
64 /* magic number for octree files */
65 #define OCTMAGIC (275+sizeof(OBJECT))
66 /* octree node types */
67 #define OT_EMPTY 0
68 #define OT_FULL 1
69 #define OT_TREE 2
70 /* return values for surface functions */
71 #define O_MISS 0 /* no intersection */
72 #define O_HIT 1 /* intersection */
73 #define O_IN 2 /* cube contained entirely */