21 template <
typename Real>
33 template <
typename Real>
43 if (fabs(P[0]) <= box.extent[0] && fabs(P[1]) <= box.extent[1])
46 result.intersect =
true;
53 +sector.cosAngle * sector.direction[0] + sector.sinAngle * sector.direction[1],
54 -sector.sinAngle * sector.direction[0] + sector.cosAngle * sector.direction[1]
57 Real prjcen0 =
Dot(N0, CmV);
58 Real radius0 = box.extent[0] * fabs(
Dot(N0, box.axis[0]))
59 + box.extent[1] * fabs(
Dot(N0, box.axis[1]));
60 if (prjcen0 > radius0)
62 result.intersect =
false;
70 +sector.cosAngle * sector.direction[0] - sector.sinAngle * sector.direction[1],
71 +sector.sinAngle * sector.direction[0] + sector.cosAngle * sector.direction[1]
74 Real prjcen1 =
Dot(N1, CmV);
75 Real radius1 = box.extent[0] * fabs(
Dot(N1, box.axis[0]))
76 + box.extent[1] * fabs(
Dot(N1, box.axis[1]));
77 if (prjcen1 > radius1)
79 result.intersect =
false;
86 std::vector<Vector2<Real>> polygon;
88 polygon.push_back(box.center - e0U0 - e1U1);
89 polygon.push_back(box.center + e0U0 - e1U1);
90 polygon.push_back(box.center + e0U0 + e1U1);
91 polygon.push_back(box.center - e0U0 + e1U1);
98 if (prjcen0 >= -radius0)
102 hpResult = hpQuery(halfspace, polygon);
103 polygon = std::move(hpResult.polygon);
107 if (prjcen1 >= -radius1)
111 hpResult = hpQuery(halfspace, polygon);
112 polygon = std::move(hpResult.polygon);
117 int const numVertices =
static_cast<int>(polygon.size());
118 if (numVertices >= 2)
120 for (
int i0 = numVertices - 1, i1 = 0; i1 < numVertices; i0 = i1++)
123 psResult = psQuery(sector.vertex, segment);
124 if (psResult.distance <= sector.radius)
126 result.intersect =
true;
132 result.intersect =
false;
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Vector2< Real > Perp(Vector2< Real > const &v)
Result operator()(Type0 const &primitive0, Type1 const &primitive1)