16 template <
int N,
typename Real>
38 template <
int N,
typename Real>
42 template <
typename Real>
45 template <
typename Real>
49 template <
int N,
typename Real>
51 DCPQuery<Real, Vector<N, Real>, AlignedBox<N, Real>>::operator()(
56 box.GetCenteredForm(boxCenter, boxExtent);
60 DoQuery(closest, boxExtent, result);
63 result.boxClosest = boxCenter + closest;
67 template <
int N,
typename Real>
68 void DCPQuery<Real, Vector<N, Real>, AlignedBox<N, Real>>::DoQuery(
71 result.sqrDistance = (Real)0;
72 for (
int i = 0; i < N; ++i)
74 if (point[i] < -boxExtent[i])
76 Real delta = point[i] + boxExtent[i];
77 result.sqrDistance += delta * delta;
78 point[i] = -boxExtent[i];
80 else if (point[i] > boxExtent[i])
82 Real delta = point[i] - boxExtent[i];
83 result.sqrDistance += delta * delta;
84 point[i] = boxExtent[i];
87 result.distance = sqrt(result.sqrDistance);
GLsizei GLsizei GLfloat distance
Vector< N, Real > boxClosest
Result operator()(Type0 const &primitive0, Type1 const &primitive1)