-
Notifications
You must be signed in to change notification settings - Fork 0
/
bounding.h
42 lines (33 loc) · 1.09 KB
/
bounding.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* bounding.h
* ndt: n-dimensional tracer
*
* Copyright (c) 2014-2019 Bryan Franklin. All rights reserved.
*/
#ifndef BOUNDING_SPHERE_H
#define BOUNDING_SPHERE_H
#include "vectNd.h"
typedef struct bounding_sphere_t
{
vectNd center;
double radius;
unsigned int prepared:1;
double radius_sqr;
} bounding_sphere;
int vect_bounding_sphere_intersect(bounding_sphere *sph, vectNd *o, vectNd *v, double min_dist);
typedef struct bounds_node_t {
bounding_sphere bounds;
struct bounds_node_t *next;
} bounds_node;
typedef struct bounds_list_t {
struct bounds_node_t *head;
struct bounds_node_t *tail;
} bounds_list;
int bounds_list_init(bounds_list *list);
int bounds_list_add(bounds_list *list, vectNd *vect, double radius);
int bounds_list_join(bounds_list *list, bounds_list *other);
int bounds_list_free(bounds_list *list);
int bounds_list_centroid(bounds_list *list, vectNd *centroid);
int bounds_list_radius(bounds_list *list, vectNd *centroid, double *radius);
int bounds_list_optimal(bounds_list *list, vectNd *centroid, double *radius);
#endif /* BOUNDING_SPHERE_H */