28 double a[3],
double b[3],
double c[3],
37 double a[3],
double b[3],
double c[3],
46 double a[3],
double b[3],
double c[3],
49 double ab[3] = {a[0]-b[0], a[1]-b[1], a[2]-b[2]},
50 ac[3] = {b[0]-c[0], b[1]-c[1], b[2]-c[2]};
58 double fabs_base_vector[3] = {fabs(bnd_circle->
base_vector[0]),
61 int biggest_component_index =
62 ((fabs_base_vector[0] < fabs_base_vector[1]) |
63 (fabs_base_vector[0] < fabs_base_vector[2])) <<
64 (fabs_base_vector[1] < fabs_base_vector[2]);
66 if ((bnd_circle->
base_vector[biggest_component_index] > 0) ^
67 (a[biggest_component_index] > 0)) {
77 bnd_circle->
sq_crd = DBL_MAX;
81 double a[3],
double b[3]) {
86 return sqrt(cross_ab[0]*cross_ab[0] +
87 cross_ab[1]*cross_ab[1] +
88 cross_ab[2]*cross_ab[2]);
94 double a[3],
double b[3],
double c[3],
97 double middle_point[3];
99 middle_point[0] = a[0] + b[0] + c[0];
100 middle_point[1] = a[1] + b[1] + c[1];
101 middle_point[2] = a[2] + b[2] + c[2];
105 double cos_angles[3] = {middle_point[0] * a[0] +
106 middle_point[1] * a[1] +
107 middle_point[2] * a[2],
108 middle_point[0] * b[0] +
109 middle_point[1] * b[1] +
110 middle_point[2] * b[2],
111 middle_point[0] * c[0] +
112 middle_point[1] * c[1] +
113 middle_point[2] * c[2]};
119 if (cos_angles[0] < cos_angles[1]) {
120 if (cos_angles[0] < cos_angles[2]) {
128 if (cos_angles[1] < cos_angles[2]) {
141 bnd_circle->
sq_crd = DBL_MAX;
149 double * restrict a,
double * restrict b,
double * restrict middle_point) {
151 double edge_middle_point[3] = {a[0] + b[0], a[1] + b[1], a[2] + b[2]};
163 double middle_point[3];
165 middle_point[0] = 0.0;
166 middle_point[1] = 0.0;
167 middle_point[2] = 0.0;
172 for (
size_t i = 0; i < num_corners; ++i) {
187 for (
size_t i = 0; i < num_corners-1; ++i) {
193 if (
compare_angles(max_angle, curr_angle) < 0) max_angle = curr_angle;
201 bnd_circle->
sq_crd = DBL_MAX;
void yac_get_cell_circumscribe_circle_reg_quad(double a[3], double b[3], double c[3], struct bounding_circle *bnd_circle)
void yac_get_cell_circumscribe_circle_unstruct_triangle(double a[3], double b[3], double c[3], struct bounding_circle *bnd_circle)
void yac_get_cell_bounding_circle_unstruct_triangle(double a[3], double b[3], double c[3], struct bounding_circle *bnd_circle)
void yac_get_cell_bounding_circle_reg_quad(double a[3], double b[3], double c[3], struct bounding_circle *bnd_circle)
void yac_get_cell_bounding_circle(struct yac_grid_cell cell, struct bounding_circle *bnd_circle)
int yac_extents_overlap(struct bounding_circle *extent_a, struct bounding_circle *extent_b)
static struct sin_cos_angle compute_edge_inc_angle(double *restrict a, double *restrict b, double *restrict middle_point)
static double get_sin_vector_angle(double a[3], double b[3])
static struct sin_cos_angle get_vector_angle_2(double const a[3], double const b[3])
static void crossproduct_d(const double a[], const double b[], double cross[])
static struct sin_cos_angle sum_angles_no_check(struct sin_cos_angle a, struct sin_cos_angle b)
static void crossproduct_kahan(double const a[], double const b[], double cross[])
static const struct sin_cos_angle SIN_COS_TOL
static int compare_angles(struct sin_cos_angle a, struct sin_cos_angle b)
static void normalise_vector(double v[])
static int sum_angles(struct sin_cos_angle a, struct sin_cos_angle b, struct sin_cos_angle *restrict sum)
static struct sin_cos_angle sin_cos_angle_new(double sin, double cos)
struct sin_cos_angle inc_angle
angle between the middle point and the boundary of the spherical cap
double(* coordinates_xyz)[3]