4 #if !defined(TYPES_H) || !defined(NAME_H)
5 #warning "obbox.h" requires "types.h" and "name.h"
8 #define obbox_calc_2 PREFIXED_NAME(obbox_calc_2)
9 #define obbox_calc_3 PREFIXED_NAME(obbox_calc_3)
59 const double *
const elx[2],
60 const unsigned n[2],
uint nel,
61 const unsigned m[2],
const double tol);
64 const double *
const elx[3],
65 const unsigned n[3],
uint nel,
66 const unsigned m[3],
const double tol);
72 const double bx = (x[0]-b->
x[0].
min)*(b->
x[0].
max-x[0]);
73 return bx<0 ? bx : (x[1]-b->
x[1].
min)*(b->
x[1].
max-x[1]);
80 if(bxy<0)
return bxy;
else {
81 const double dx = x[0]-b->
c0[0], dy = x[1]-b->
c0[1];
82 const double r = b->
A[0]*dx + b->
A[1]*dy,
83 s = b->
A[2]*dx + b->
A[3]*dy;
84 const double br = (r+1)*(1-r);
85 return br<0 ? br : (s+1)*(1-s);
93 const double bx = (x[0]-b->
x[0].
min)*(b->
x[0].
max-x[0]);
94 const double by = (x[1]-b->
x[1].
min)*(b->
x[1].
max-x[1]);
95 return bx<0 ? bx : (by<0 ? by : (x[2]-b->
x[2].
min)*(b->
x[2].
max-x[2]));
102 if(bxyz<0)
return bxyz;
else {
103 const double dx = x[0]-b->
c0[0], dy = x[1]-b->
c0[1], dz = x[2]-b->
c0[2];
104 const double r = b->
A[0]*dx + b->
A[1]*dy + b->
A[2]*dz,
105 s = b->
A[3]*dx + b->
A[4]*dy + b->
A[5]*dz,
106 t = b->
A[6]*dx + b->
A[7]*dy + b->
A[8]*dz;
107 const double br = (r+1)*(1-r), bs = (s+1)*(1-s);
108 return br<0 ? br : (bs<0 ? bs : (t+1)*(1-t));
static double obbox_test_3(const struct obbox_3 *const b, const double x[3])
static double elx[NR *NS]
static double obbox_axis_test_2(const struct obbox_2 *const b, const double x[2])
static double obbox_axis_test_3(const struct obbox_3 *const b, const double x[3])
static double obbox_test_2(const struct obbox_2 *const b, const double x[2])