Voxvision
1
Creating and manipulating voxel octrees
|
Things related to tree construction. More...
#include "params.h"
Go to the source code of this file.
Functions | |
VOX_EXPORT struct vox_node * | vox_make_tree (vox_dot set[], size_t n) |
Turn a set of voxels into a tree. More... | |
VOX_EXPORT void | vox_destroy_tree (struct vox_node *tree) |
Free resources used by a tree. More... | |
VOX_EXPORT size_t | vox_voxels_in_tree (const struct vox_node *tree) |
Return number of voxels in the tree. | |
VOX_EXPORT void | vox_bounding_box (const struct vox_node *tree, struct vox_box *box) |
Get the bounding box for voxels in the tree. | |
VOX_EXPORT struct vox_node * | vox_rebuild_tree (const struct vox_node *tree) |
Rebuild a tree. More... | |
VOX_EXPORT int | vox_insert_voxel (struct vox_node **tree_ptr, vox_dot voxel) |
Insert a voxel in the tree on the fly. More... | |
VOX_EXPORT int | vox_insert_voxel_coord (struct vox_node **tree_ptr, float x, float y, float z) |
Insert a voxel in the tree on the fly. More... | |
VOX_EXPORT int | vox_delete_voxel (struct vox_node **tree_ptr, vox_dot voxel) |
Delete a voxel from the tree on the fly. More... | |
VOX_EXPORT int | vox_delete_voxel_coord (struct vox_node **tree_ptr, float x, float y, float z) |
Delete a voxel from the tree on the fly. More... | |
VOX_EXPORT void | vox_dump_tree (const struct vox_node *tree) |
Dump a tree to standard output stream. More... | |
VOX_EXPORT struct vox_node * | vox_make_dense_leaf (const struct vox_box *box) |
Create a cuboid tree. More... | |
VOX_EXPORT void | vox_set_voxel_size (float x, float y, float z) |
Set global voxel size. More... | |
Things related to tree construction.
Functions for tree construction/deletion/statistical info are defined here
VOX_EXPORT int vox_delete_voxel | ( | struct vox_node ** | tree_ptr, |
vox_dot | voxel | ||
) |
Delete a voxel from the tree on the fly.
You can call vox_rebuild_tree() after many applications of this function to get a more balanced tree.
VOX_EXPORT int vox_delete_voxel_coord | ( | struct vox_node ** | tree_ptr, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Delete a voxel from the tree on the fly.
This is like vox_delete_voxel(), but voxel coordinates are given instead of vox_dot value.
VOX_EXPORT void vox_destroy_tree | ( | struct vox_node * | tree | ) |
Free resources used by a tree.
Note, that you must free underlying set by yourself.
VOX_EXPORT void vox_dump_tree | ( | const struct vox_node * | tree | ) |
Dump a tree to standard output stream.
This is ment solely for debugging purposes and can produce very big output.
VOX_EXPORT int vox_insert_voxel | ( | struct vox_node ** | tree_ptr, |
vox_dot | voxel | ||
) |
Insert a voxel in the tree on the fly.
Many applications of this function will result in unbalanced tree. You can rebalance the tree by recreating it with vox_rebuild_tree()
VOX_EXPORT int vox_insert_voxel_coord | ( | struct vox_node ** | tree_ptr, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Insert a voxel in the tree on the fly.
This is like vox_insert_voxel(), but voxel coordinates are given instead of vox_dot value.
Create a cuboid tree.
Create a tree consisting of one big box. The name "dense leaf" comes from the library's internals. It means that the library has a special way for dealing with tree nodes which consist only from one big box. This function is a user interface to that mechanism.
VOX_EXPORT struct vox_node* vox_make_tree | ( | vox_dot | set[], |
size_t | n | ||
) |
Turn a set of voxels into a tree.
The underlying set is destructively modified and can be freed after creation.
set | a set of dots (of type vox_dot) to form a tree |
n | number of voxels in the set |
Rebuild a tree.
You can rebuild a tree completely and destroy the old one with vox_destroy_tree(). The new tree can be more balanced. Use this after a big amount of insertions or deletions.
VOX_EXPORT void vox_set_voxel_size | ( | float | x, |
float | y, | ||
float | z | ||
) |
Set global voxel size.
This function sets global voxel size. You must rebuild all trees after changing this value. Currently, you can set voxel size by writing directly to vox_voxel
dot.