Skip to content

Commit

Permalink
count leaves
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Park authored and Mike Park committed Sep 28, 2022
1 parent 880b163 commit 27e59a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ref_oct.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,19 @@ REF_FCN REF_STATUS ref_oct_tec(REF_OCT ref_oct, const char *filename) {

RSS(ref_oct_tec_node(ref_oct, 0, ref_oct->bbox, f), "draw root box");

for (i = 0; i < ref_oct->n; i++) {
for (i = 0; i < ref_oct_n(ref_oct); i++) {
fprintf(f, "%d %d %d %d %d %d %d %d\n", 1 + 8 * i, 2 + 8 * i, 3 + 8 * i,
4 + 8 * i, 5 + 8 * i, 6 + 8 * i, 7 + 8 * i, 8 + 8 * i);
}
fclose(f);
return REF_SUCCESS;
}

REF_FCN REF_STATUS ref_oct_n_leaf(REF_OCT ref_oct, REF_INT *n_leaf) {
REF_INT i;
*n_leaf = 0;
for (i = 0; i < ref_oct_n(ref_oct); i++) {
if (ref_oct_leaf_node(ref_oct, i)) (*n_leaf)++;
}
return REF_SUCCESS;
}
2 changes: 2 additions & 0 deletions src/ref_oct.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ REF_FCN REF_STATUS ref_oct_bbox_scale(REF_DBL *bbox0, REF_DBL factor,

REF_FCN REF_STATUS ref_oct_tec(REF_OCT ref_oct, const char *filename);

REF_FCN REF_STATUS ref_oct_n_leaf(REF_OCT ref_oct, REF_INT *n_leaf);

END_C_DECLORATION

#endif /* REF_OCT_H */

0 comments on commit 27e59a5

Please sign in to comment.