26 template <
typename Real>
43 template <
typename Real>
51 Real lineParameter[2];
67 static bool Clip(Real denom, Real numer, Real&
t0, Real&
t1);
71 template <
typename Real>
79 box.GetCenteredForm(boxCenter, boxExtent);
85 DoQuery(lineOrigin, line.direction, boxExtent, result);
89 template <
typename Real>
102 if (
std::abs(WxD[0]) > boxExtent[1] * absWdU[2] + boxExtent[2] * absWdU[1])
104 result.intersect =
false;
108 if (
std::abs(WxD[1]) > boxExtent[0] * absWdU[2] + boxExtent[2] * absWdU[0])
110 result.intersect =
false;
114 if (
std::abs(WxD[2]) > boxExtent[0] * absWdU[1] + boxExtent[1] * absWdU[0])
116 result.intersect =
false;
120 result.intersect =
true;
123 template <
typename Real>
131 box.GetCenteredForm(boxCenter, boxExtent);
137 DoQuery(lineOrigin, line.direction, boxExtent, result);
138 for (
int i = 0; i < result.numPoints; ++i)
141 line.origin + result.lineParameter[i] * line.direction;
146 template <
typename Real>
157 Real
t0 = -std::numeric_limits<Real>::max();
158 Real
t1 = std::numeric_limits<Real>::max();
159 if (Clip(+lineDirection[0], -lineOrigin[0] - boxExtent[0], t0, t1) &&
160 Clip(-lineDirection[0], +lineOrigin[0] - boxExtent[0], t0, t1) &&
161 Clip(+lineDirection[1], -lineOrigin[1] - boxExtent[1], t0, t1) &&
162 Clip(-lineDirection[1], +lineOrigin[1] - boxExtent[1], t0, t1) &&
163 Clip(+lineDirection[2], -lineOrigin[2] - boxExtent[2], t0, t1) &&
164 Clip(-lineDirection[2], +lineOrigin[2] - boxExtent[2], t0, t1))
166 result.intersect =
true;
169 result.numPoints = 2;
170 result.lineParameter[0] =
t0;
171 result.lineParameter[1] =
t1;
175 result.numPoints = 1;
176 result.lineParameter[0] =
t0;
177 result.lineParameter[1] =
t0;
182 result.intersect =
false;
183 result.numPoints = 0;
186 template <
typename Real>
188 Real numer, Real&
t0, Real&
t1)
192 if (numer > denom*t1)
196 if (numer > denom*t0)
202 else if (denom < (Real)0)
204 if (numer > denom*t0)
208 if (numer > denom*t1)
216 return numer <= (Real)0;
gte::BSNumber< UIntegerType > abs(gte::BSNumber< UIntegerType > const &number)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
DualQuaternion< Real > Cross(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Result operator()(Type0 const &primitive0, Type1 const &primitive1)