65 void (*
split)(
const cr8r_kd_ft *ft,
const void *
self,
const void *root_pt,
void *o1,
void *o2);
cr8r_walk_decision
Enum to allow a callee/visitor to control the behavior of a tree traversal.
bool cr8r_kd_ify(cr8r_vec *, cr8r_kd_ft *ft, uint64_t a, uint64_t b)
Rearrange a vector of points into a kd tree.
cr8r_walk_decision(* cr8r_kdvisitor)(cr8r_kd_ft *ft, const void *win, void *ent, void *data)
Type of a visitor callback for a kd tree traversal.
cr8r_kd_ft cr8r_kdft_s2i64
kdft implementation for spherical kd trees in 3 dimensions with i64 coordinates
int cr8r_default_cmp_kd_kcs_pt_dist(const cr8r_base_ft *_ft, const void *a, const void *b)
Comparison function that compares two kd tree points based on their distance from a fixed point.
bool cr8r_kdwin_init_s2i64(cr8r_kdwin_s2i64 *, const int64_t bl[3], const int64_t tr[3])
Initialize a i64x3 bounds object with a given "bottom left" and "top right" point.
cr8r_kd_ft cr8r_kdft_c3i64
kdft implementation for cuboid kd trees in 3 dimensions with i64 coordintates
bool cr8r_kd_k_closest(cr8r_vec *, cr8r_kd_ft *ft, const void *bounds, const void *pt, uint64_t k, cr8r_vec *out)
Find the k closest points to a given point.
bool cr8r_kdwin_init_c3i64(cr8r_kdwin_s2i64 *, const int64_t bl[3], const int64_t tr[3])
Initialize a i64x3 bounds object with a given "bottom left" and "top right" point.
void cr8r_kd_walk(cr8r_vec *, const cr8r_kd_ft *ft, const void *bounds, cr8r_kdvisitor visitor, void *data)
Perform a preorder traversal of the points in a kd tree and call a visitor callback on each.
bool cr8r_kdwin_bounding_i64x3(cr8r_kdwin_s2i64 *, const cr8r_vec *ents, const cr8r_kd_ft *ft)
Initialize a i64x3 bounds object with the "bottom left" and "top right" points bounding a list of poi...
Base function table for all Crater containers.
Function table for kd tree, see cr8r_kd_ft.
uint64_t dim
Dimension of the kd tree.
double(* sqdist)(const cr8r_kd_ft *ft, const void *a, const void *b)
find the squared distance between two points
size_t bounds_size
Size of a bounds object.
void(* split)(const cr8r_kd_ft *ft, const void *self, const void *root_pt, void *o1, void *o2)
split a bounds object in two along some dimension
cr8r_vec_ft super
Subtable for vector ft.
double(* min_sqdist)(const cr8r_kd_ft *ft, const void *self, const void *pt)
find the minimum squared distance from a bounds object to a point
void(* update)(const cr8r_kd_ft *ft, void *self, const void *pt)
update a bounds object to include some point
Concrete bounds object for spherical and cuboid kd trees with 3 i64 coords.
Function table for vector.
A vector Take care if manipulating these fields directly, this should only be done if the functions i...