17 template <
typename Real>
32 template <
typename Real>
44 tetrahedron.GetPlanes(planes);
48 result.sqrDistance = std::numeric_limits<Real>::max();
50 for (
int i = 0; i < 4; ++i)
52 if (
Dot(planes[i].normal, point) >= planes[i].constant)
55 tetrahedron.GetFaceIndices(i, indices);
57 tetrahedron.v[indices[0]],
58 tetrahedron.v[indices[1]],
59 tetrahedron.v[indices[2]]);
62 auto ptResult =
query(point, triangle);
63 if (ptResult.sqrDistance < result.sqrDistance)
65 result.sqrDistance = ptResult.sqrDistance;
66 result.tetrahedronClosestPoint = ptResult.closest;
71 if (result.sqrDistance == std::numeric_limits<Real>::max())
75 result.sqrDistance = (Real)0;
76 result.tetrahedronClosestPoint = point;
78 result.distance = sqrt(result.sqrDistance);
GLsizei GLsizei GLfloat distance
Result operator()(Type0 const &primitive0, Type1 const &primitive1)
GLsizei GLenum const void * indices
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Vector3< Real > tetrahedronClosestPoint