3#define vecdot(a,b) ((a).x*(b).x + (a).y*(b).y + (a).z*(b).z)
4#define vecdotproduct(a,b) ((coord){(a).y*(b).z - (a).z*(b).y, \
5 (a).z*(b).x - (a).x*(b).z, \
6 (a).x*(b).y - (a).y*(b).x})
7#define vecdiff(a,b) ((coord){(a).x - (b).x, (a).y - (b).y, (a).z - (b).z})
8#define vecdist2(a,b) (sq((a).x - (b).x) + sq((a).y - (b).y) + sq((a).z - (b).z))
19 double *
s,
double *
t)
292 (*segmentClosest).z = 0.;
294 (*segmentClosest).x = (*p0).x +
t *
direction.x;
double PointSegmentDistance(const coord *p, const coord *p0, const coord *p1, coord *segmentClosest, double *segmentParameter)
Returns the squared distance between p and [p0:p1].
double PointTriangleDistance(const coord *P, const coord *P0, const coord *P1, const coord *P2, double *s, double *t)
Returns the squared distance between point P and triangle P0, P1, P2.
#define vecdotproduct(a, b)
int PointSegmentOrientation(const coord *P, const coord *P0, const coord *P1)
int PointTriangleOrientation(const coord *P, const coord *P0, const coord *P1, const coord *P2)
static int sign(number x)