15 template <
typename Real>
22 Real rectangle0Parameter[2], rectangle1Parameter[2];
31 template <
typename Real>
41 result.sqrDistance = std::numeric_limits<Real>::max();
44 for (
int i1 = 0; i1 < 2; ++i1)
46 for (
int i0 = -1; i0 <= 1; i0 += 2)
48 Real
s = i0 * rectangle0.extent[1 - i1];
50 s * rectangle0.axis[1 - i1];
52 rectangle0.extent[i1]);
54 srResult = srQuery(edge, rectangle1);
55 if (srResult.sqrDistance < result.sqrDistance)
57 result.distance = srResult.distance;
58 result.sqrDistance = srResult.sqrDistance;
59 result.rectangle0Parameter[i1] =
s;
60 result.rectangle0Parameter[1 - i1] =
61 srResult.segmentParameter;
62 result.rectangle1Parameter[0] =
63 srResult.rectangleParameter[0];
64 result.rectangle1Parameter[1] =
65 srResult.rectangleParameter[1];
66 result.closestPoint[0] = srResult.closestPoint[0];
67 result.closestPoint[1] = srResult.closestPoint[1];
73 for (
int i1 = 0; i1 < 2; ++i1)
75 for (
int i0 = -1; i0 <= 1; i0 += 2)
77 Real
s = i0 * rectangle1.extent[1 - i1];
79 s * rectangle1.axis[1 - i1];
81 rectangle0.extent[i1]);
83 srResult = srQuery(edge, rectangle0);
84 if (srResult.sqrDistance < result.sqrDistance)
86 result.distance = srResult.distance;
87 result.sqrDistance = srResult.sqrDistance;
88 result.rectangle0Parameter[0] =
89 srResult.rectangleParameter[0];
90 result.rectangle0Parameter[1] =
91 srResult.rectangleParameter[1];
92 result.rectangle1Parameter[i1] =
s;
93 result.rectangle1Parameter[1 - i1] =
94 srResult.segmentParameter;
95 result.closestPoint[0] = srResult.closestPoint[1];
96 result.closestPoint[1] = srResult.closestPoint[0];
GLsizei GLsizei GLfloat distance
Result operator()(Type0 const &primitive0, Type1 const &primitive1)