10 #include "../voxvision.h"
41 #ifdef VOXTREES_SOURCE
44 #define MTREE_MAX_CHILDREN 9
46 struct vox_mtree_node {
48 struct vox_mtree_node *parent;
53 struct vox_mtree_node *children[MTREE_MAX_CHILDREN+1];
58 struct vox_mtree_node;
112 VOX_EXPORT
const struct vox_mtree_node*
144 void (*callback)(
const struct vox_sphere *s,
void *arg),
VOX_EXPORT void vox_mtree_spheres_containing(const struct vox_mtree_node *node, const vox_dot dot, void(^block)(const struct vox_sphere *s))
Do a job for all spheres which contain a specific dot.
VOX_EXPORT unsigned int vox_mtree_items(const struct vox_mtree_node *node)
Get a number of items (spheres) in M-tree.
VOX_EXPORT int vox_mtree_add_sphere(struct vox_mtree_node **nodeptr, const struct vox_sphere *s)
Add a sphere to an M-tree.
VOX_EXPORT void vox_mtree_destroy(struct vox_mtree_node *node)
Destroy a tree, freeing all used space.
VOX_EXPORT void vox_mtree_dump(const struct vox_mtree_node *node)
Dump a tree to stdout.
VOX_EXPORT int vox_mtree_remove_sphere(struct vox_mtree_node **nodeptr, const struct vox_sphere *s)
Remove sphere from a tree.
VOX_EXPORT const struct vox_mtree_node * vox_mtree_contains_sphere(const struct vox_mtree_node *node, const struct vox_sphere *s)
Check if a sphere is in a tree.
VOX_EXPORT void vox_mtree_spheres_containing_f(const struct vox_mtree_node *node, const vox_dot dot, void(*callback)(const struct vox_sphere *s, void *arg), void *thunk)
Callback-styled version of vox_mtree_spheres_containing().
Sphere structure.
Definition: mtree.h:17
vox_dot color
Color of the sphere.
Definition: mtree.h:21
float radius
Radius of the sphere.
Definition: mtree.h:30
float sqr_radius
Square of the sphere's radius.
Definition: mtree.h:33
vox_dot center
Center of the sphere.
Definition: mtree.h:18