-static void RecursiveHullCheck_Impact (RecursiveHullCheckTraceInfo_t *t, const mplane_t *plane, const int side)
-{
- // LordHavoc: using doubles for extra accuracy
- double t1, t2, frac, pdist;
-
- // LordHavoc: now that we have found the impact, recalculate the impact
- // point from scratch for maximum accuracy, with an epsilon bias on the
- // surface distance
- pdist = plane->dist;
- if (side)
- {
- pdist -= DIST_EPSILON;
- VectorNegate (plane->normal, t->trace->plane.normal);
- t->trace->plane.dist = -plane->dist;
- }
- else
- {
- pdist += DIST_EPSILON;
- VectorCopy (plane->normal, t->trace->plane.normal);
- t->trace->plane.dist = plane->dist;
- }
-
- if (plane->type < 3)
- {
- t1 = t->start[plane->type] - pdist;
- t2 = t->start[plane->type] + t->dist[plane->type] - pdist;
- }
- else
- {
- t1 = plane->normal[0] * t->start[0] + plane->normal[1] * t->start[1] + plane->normal[2] * t->start[2] - pdist;
- t2 = plane->normal[0] * (t->start[0] + t->dist[0]) + plane->normal[1] * (t->start[1] + t->dist[1]) + plane->normal[2] * (t->start[2] + t->dist[2]) - pdist;
- }
-
- frac = t1 / (t1 - t2);
- frac = bound(0.0f, frac, 1.0);
-
- t->trace->fraction = frac;
- VectorMA(t->start, frac, t->dist, t->trace->endpos);
-}
-
-static int RecursiveHullCheck (RecursiveHullCheckTraceInfo_t *t, int num, double p1f, double p2f, const double p1[3], const double p2[3])