25 static void RTreeInitBranch(
struct Branch *
b)
34 register struct Node *
n =
N;
40 RTreeInitBranch(&(n->
branch[i]));
46 register struct Node *
n;
62 static void RTreePrintBranch(
struct Branch *b,
int depth)
72 for (i = 0; i < depth; i++)
84 fprintf(stdout,
"node");
86 fprintf(stdout,
" LEAF");
87 else if (n->
level > 0)
88 fprintf(stdout,
" NONLEAF");
90 fprintf(stdout,
" TYPE=?");
91 fprintf(stdout,
" level=%d count=%d address=%o\n", n->
level, n->
count,
94 for (i = 0; i < n->count; i++) {
101 fprintf(stdout,
"branch %d\n", i);
102 RTreePrintBranch(&n->branch[i], depth + 1);
113 register struct Node *
n =
N;
114 register int i, first_time = 1;
120 for (i = 0; i <
MAXKIDS(n); i++)
141 register struct Rect *
r = R;
142 register struct Node *
n =
N;
143 register struct Rect *rr;
144 register int i, first_time = 1;
147 struct Rect tmp_rect;
151 for (i = 0; i <
MAXKIDS(n); i++) {
157 if (increase < bestIncr || first_time) {
163 else if (increase == bestIncr && area < bestArea) {
181 register struct Branch *b = B;
182 register struct Node *
n =
N;
183 register struct Node **new_node = New_node;
190 for (i = 0; i <
MAXKIDS(n); i++) {
209 assert(n && i >= 0 && i <
MAXKIDS(n));
212 RTreeInitBranch(&(n->
branch[i]));
int RTreePickBranch(struct Rect *, struct Node *)
int RTreeAddBranch(struct Branch *, struct Node *, struct Node **)
void RTreeDestroyNode(struct Node *)
RectReal RTreeRectSphericalVolume(struct Rect *R)
void RTreePrintNode(struct Node *, int)
void RTreeSplitNode(struct Node *, struct Branch *, struct Node **)
struct Node * RTreeNewNode(void)
void RTreeInitRect(struct Rect *)
void RTreePrintRect(struct Rect *, int)
struct Rect RTreeNodeCover(struct Node *)
struct Rect RTreeCombineRect(struct Rect *, struct Rect *)
void RTreeInitNode(struct Node *)
void RTreeFreeNode(struct Node *)
struct Branch branch[MAXCARD]
void RTreeDisconnectBranch(struct Node *, int)