21 template <
typename Real>
36 template <
typename Real>
50 Real halfHeight = cylinder.height * (Real)0.5;
53 Real originDotDirection =
Dot(origin, direction);
56 A.
SetRow(0, { (Real)-1, (Real) 0, (Real) 0 });
57 A.
SetRow(1, { (Real) 0, (Real)-1, (Real) 0 });
58 A.
SetRow(2, { (Real) 0, (Real) 0, (Real)-1 });
67 originDotDirection - halfHeight,
68 -originDotDirection - halfHeight
71 std::array<std::array<Real, 8>, 8> M;
72 for (
int r = 0;
r < 3; ++
r)
74 for (
int c = 0;
c < 3; ++
c)
79 for (
int c = 3, i = 0;
c < 8; ++
c, ++i)
85 for (
int r = 3, i = 0;
r < 8; ++
r, ++i)
87 for (
int c = 0;
c < 3; ++
c)
92 for (
int c = 3;
c < 8; ++
c)
98 std::array<Real, 8>
q;
99 for (
int r = 0;
r < 3; ++
r)
104 for (
int r = 3, i = 0;
r < 8; ++
r, ++i)
109 std::array<Real, 8>
w,
z;
111 if (LCP.Solve(q, M, w, z))
115 Real qform =
Dot(diff, P * diff);
116 result.intersect = (qform <= cylinder.radius * cylinder.radius);
120 result.intersect =
false;
GLubyte GLubyte GLubyte GLubyte w
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
GLdouble GLdouble GLdouble z
void SetRow(int r, Vector< NumCols, Real > const &vec)
GLdouble GLdouble GLdouble GLdouble q
Result operator()(Type0 const &primitive0, Type1 const &primitive1)
GMatrix< Real > OuterProduct(GVector< Real > const &U, GVector< Real > const &V)