16 template <
typename Real>
35 template <
typename Real>
67 Real ray0Parameter[2], ray1Parameter[2];
75 template <
typename Real>
84 auto llResult = llQuery(line0, line1);
85 if (llResult.numIntersections == 1)
88 if (llResult.line0Parameter[0] >= (Real)0
89 && llResult.line1Parameter[0] >= (Real)0)
91 result.intersect =
true;
92 result.numIntersections = 1;
96 result.intersect =
false;
97 result.numIntersections = 0;
100 else if (llResult.numIntersections == std::numeric_limits<int>::max())
102 if (
Dot(ray0.direction, ray1.direction) > (Real)0)
106 result.intersect =
true;
107 result.numIntersections = std::numeric_limits<int>::max();
115 Real
t =
Dot(ray0.direction, diff);
118 result.intersect =
true;
119 result.numIntersections = 2;
121 else if (t < (Real)0)
123 result.intersect =
false;
124 result.numIntersections = 0;
128 result.intersect =
true;
129 result.numIntersections = 1;
135 result.intersect =
false;
136 result.numIntersections = 0;
142 template <
typename Real>
151 auto llResult = llQuery(line0, line1);
152 if (llResult.numIntersections == 1)
155 if (llResult.line0Parameter[0] >= (Real)0
156 && llResult.line1Parameter[0] >= (Real)0)
158 result.intersect =
true;
159 result.numIntersections = 1;
160 result.ray0Parameter[0] = llResult.line0Parameter[0];
161 result.ray1Parameter[0] = llResult.line1Parameter[0];
162 result.point[0] = llResult.point;
166 result.intersect =
false;
167 result.numIntersections = 0;
170 else if (llResult.numIntersections == std::numeric_limits<int>::max())
173 Real maxReal = std::numeric_limits<Real>::max();
175 Real
t =
Dot(ray0.direction, diff);
176 if (
Dot(ray0.direction, ray1.direction) > (Real)0)
180 result.intersect =
true;
181 result.numIntersections = std::numeric_limits<int>::max();
184 result.ray0Parameter[0] =
t;
185 result.ray0Parameter[1] = maxReal;
186 result.ray1Parameter[0] = (Real)0;
187 result.ray1Parameter[1] = maxReal;
188 result.point[0] = ray1.origin;
192 result.ray0Parameter[0] = (Real)0;
193 result.ray0Parameter[1] = maxReal;
194 result.ray1Parameter[0] = -
t;
195 result.ray1Parameter[1] = maxReal;
196 result.point[0] = ray0.origin;
206 result.intersect =
true;
207 result.numIntersections = 2;
208 result.ray0Parameter[0] = (Real)0;
209 result.ray0Parameter[1] =
t;
210 result.ray1Parameter[0] = (Real)0;
211 result.ray1Parameter[1] =
t;
212 result.point[0] = ray0.origin;
213 result.point[1] = ray1.origin;
217 result.intersect =
false;
218 result.numIntersections = 0;
224 result.intersect =
false;
225 result.numIntersections = 0;
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Result operator()(Type0 const &primitive0, Type1 const &primitive1)