26 #include "intersect.h" 68 bool Intersect<2>(
const RotBox<2>& r,
const AxisBox<2>& b,
bool proper)
70 const AxisBox<2> b2 = r.boundingBox();
71 if(!Intersect(b2, b, proper))
74 RotMatrix<2> m = r.m_orient.inverse();
76 const AxisBox<2> b3 = RotBox<2>(Point<2>(b.m_low).rotate(m, r.m_corner0),
77 b.m_high - b.m_low, m).boundingBox();
78 const AxisBox<2> b4(r.m_corner0, r.m_corner0 + r.m_size);
79 return Intersect(b3, b4, proper);
113 bool Intersect<3>(
const RotBox<3>& r,
const AxisBox<3>& b,
bool proper)
119 const AxisBox<3> b2 = r.boundingBox();
120 if(!Intersect(b2, b, proper))
123 RotMatrix<3> minv = r.m_orient.inverse();
124 Vector<3> b_size = b.m_high - b.m_low;
126 const AxisBox<3> b3 = RotBox<3>(Point<3>(b.m_low).rotate(minv, r.m_corner0),
127 b_size, minv).boundingBox();
128 const AxisBox<3> b4(r.m_corner0, r.m_corner0 + r.m_size);
129 if(!Intersect(b3, b4, proper))
134 Vector<3> sep = b.m_low - r.m_corner0;
135 const RotMatrix<3> &m = r.m_orient;
139 for(
int i = 0; i < 3; ++i) {
144 for(
int j = 0; j < 3; ++j) {
152 axis[1] = -m.elem(i, 2);
153 axis[2] = m.elem(i, 1);
156 axis[0] = m.elem(i, 2);
158 axis[2] = -m.elem(i, 0);
161 axis[0] = -m.elem(i, 1);
162 axis[1] = m.elem(i, 0);
182 const int next[] = {1, 2, 0};
184 CoordType b_low, b_high, r_low, r_high, dist;
191 val = axis[k] * b_size[k];
204 val = axis[k] * b_size[k];
215 val = Dot(m.row(k), axis) * r.m_size[k];
228 val = Dot(m.row(k), axis) * r.m_size[k];
237 dist = Dot(sep, axis);
239 if(_Greater(r_low - dist, b_high, proper)
240 || _Less(r_high - dist, b_low, proper))
250 template bool Intersect<2>(
const Point<2>&,
const Point<2>&, bool);
251 template bool Intersect<3>(
const Point<3>&,
const Point<3>&, bool);
252 template bool Contains<2>(
const Point<2>&,
const Point<2>&, bool);
253 template bool Contains<3>(
const Point<3>&,
const Point<3>&, bool);
255 template bool Intersect<Point<2>,AxisBox<2> >(
const Point<2>&,
const AxisBox<2>&, bool);
256 template bool Intersect<Point<3>,AxisBox<3> >(
const Point<3>&,
const AxisBox<3>&, bool);
257 template bool Contains<2>(
const Point<2>&,
const AxisBox<2>&, bool);
258 template bool Contains<3>(
const Point<3>&,
const AxisBox<3>&, bool);
259 template bool Intersect<2>(
const AxisBox<2>&,
const Point<2>&, bool);
260 template bool Intersect<3>(
const AxisBox<3>&,
const Point<3>&, bool);
261 template bool Contains<2>(
const AxisBox<2>&,
const Point<2>&, bool);
262 template bool Contains<3>(
const AxisBox<3>&,
const Point<3>&, bool);
264 template bool Intersect<2>(
const AxisBox<2>&,
const AxisBox<2>&, bool);
265 template bool Intersect<3>(
const AxisBox<3>&,
const AxisBox<3>&, bool);
266 template bool Contains<2>(
const AxisBox<2>&,
const AxisBox<2>&, bool);
267 template bool Contains<3>(
const AxisBox<3>&,
const AxisBox<3>&, bool);
269 template bool Intersect<Point<2>,Ball<2> >(
const Point<2>&,
const Ball<2>&, bool);
270 template bool Intersect<Point<3>,Ball<3> >(
const Point<3>&,
const Ball<3>&, bool);
271 template bool Contains<2>(
const Point<2>&,
const Ball<2>&, bool);
272 template bool Contains<3>(
const Point<3>&,
const Ball<3>&, bool);
273 template bool Intersect<2>(
const Ball<2>&,
const Point<2>&, bool);
274 template bool Intersect<3>(
const Ball<3>&,
const Point<3>&, bool);
275 template bool Contains<2>(
const Ball<2>&,
const Point<2>&, bool);
276 template bool Contains<3>(
const Ball<3>&,
const Point<3>&, bool);
278 template bool Intersect<AxisBox<2>,Ball<2> >(
const AxisBox<2>&,
const Ball<2>&, bool);
279 template bool Intersect<AxisBox<3>,Ball<3> >(
const AxisBox<3>&,
const Ball<3>&, bool);
280 template bool Contains<2>(
const AxisBox<2>&,
const Ball<2>&, bool);
281 template bool Contains<3>(
const AxisBox<3>&,
const Ball<3>&, bool);
282 template bool Intersect<2>(
const Ball<2>&,
const AxisBox<2>&, bool);
283 template bool Intersect<3>(
const Ball<3>&,
const AxisBox<3>&, bool);
284 template bool Contains<2>(
const Ball<2>&,
const AxisBox<2>&, bool);
285 template bool Contains<3>(
const Ball<3>&,
const AxisBox<3>&, bool);
287 template bool Intersect<2>(
const Ball<2>&,
const Ball<2>&, bool);
288 template bool Intersect<3>(
const Ball<3>&,
const Ball<3>&, bool);
289 template bool Contains<2>(
const Ball<2>&,
const Ball<2>&, bool);
290 template bool Contains<3>(
const Ball<3>&,
const Ball<3>&, bool);
292 template bool Intersect<Point<2>,Segment<2> >(
const Point<2>&,
const Segment<2>&, bool);
293 template bool Intersect<Point<3>,Segment<3> >(
const Point<3>&,
const Segment<3>&, bool);
294 template bool Contains<2>(
const Point<2>&,
const Segment<2>&, bool);
295 template bool Contains<3>(
const Point<3>&,
const Segment<3>&, bool);
296 template bool Intersect<2>(
const Segment<2>&,
const Point<2>&, bool);
297 template bool Intersect<3>(
const Segment<3>&,
const Point<3>&, bool);
298 template bool Contains<2>(
const Segment<2>&,
const Point<2>&, bool);
299 template bool Contains<3>(
const Segment<3>&,
const Point<3>&, bool);
301 template bool Intersect<AxisBox<2>,Segment<2> >(
const AxisBox<2>&,
const Segment<2>&, bool);
302 template bool Intersect<AxisBox<3>,Segment<3> >(
const AxisBox<3>&,
const Segment<3>&, bool);
303 template bool Contains<2>(
const AxisBox<2>&,
const Segment<2>&, bool);
304 template bool Contains<3>(
const AxisBox<3>&,
const Segment<3>&, bool);
305 template bool Intersect<2>(
const Segment<2>&,
const AxisBox<2>&, bool);
306 template bool Intersect<3>(
const Segment<3>&,
const AxisBox<3>&, bool);
307 template bool Contains<2>(
const Segment<2>&,
const AxisBox<2>&, bool);
308 template bool Contains<3>(
const Segment<3>&,
const AxisBox<3>&, bool);
310 template bool Intersect<Ball<2>,Segment<2> >(
const Ball<2>&,
const Segment<2>&, bool);
311 template bool Intersect<Ball<3>,Segment<3> >(
const Ball<3>&,
const Segment<3>&, bool);
312 template bool Contains<2>(
const Ball<2>&,
const Segment<2>&, bool);
313 template bool Contains<3>(
const Ball<3>&,
const Segment<3>&, bool);
314 template bool Intersect<2>(
const Segment<2>&,
const Ball<2>&, bool);
315 template bool Intersect<3>(
const Segment<3>&,
const Ball<3>&, bool);
316 template bool Contains<2>(
const Segment<2>&,
const Ball<2>&, bool);
317 template bool Contains<3>(
const Segment<3>&,
const Ball<3>&, bool);
319 template bool Intersect<2>(
const Segment<2>&,
const Segment<2>&, bool);
320 template bool Intersect<3>(
const Segment<3>&,
const Segment<3>&, bool);
321 template bool Contains<2>(
const Segment<2>&,
const Segment<2>&, bool);
322 template bool Contains<3>(
const Segment<3>&,
const Segment<3>&, bool);
324 template bool Intersect<Point<2>,RotBox<2> >(
const Point<2>&,
const RotBox<2>&, bool);
325 template bool Intersect<Point<3>,RotBox<3> >(
const Point<3>&,
const RotBox<3>&, bool);
326 template bool Contains<2>(
const Point<2>&,
const RotBox<2>&, bool);
327 template bool Contains<3>(
const Point<3>&,
const RotBox<3>&, bool);
328 template bool Intersect<2>(
const RotBox<2>&,
const Point<2>&, bool);
329 template bool Intersect<3>(
const RotBox<3>&,
const Point<3>&, bool);
330 template bool Contains<2>(
const RotBox<2>&,
const Point<2>&, bool);
331 template bool Contains<3>(
const RotBox<3>&,
const Point<3>&, bool);
333 template bool Intersect<AxisBox<2>,RotBox<2> >(
const AxisBox<2>&,
const RotBox<2>&, bool);
334 template bool Intersect<AxisBox<3>,RotBox<3> >(
const AxisBox<3>&,
const RotBox<3>&, bool);
335 template bool Contains<2>(
const AxisBox<2>&,
const RotBox<2>&, bool);
336 template bool Contains<3>(
const AxisBox<3>&,
const RotBox<3>&, bool);
337 template bool Contains<2>(
const RotBox<2>&,
const AxisBox<2>&, bool);
338 template bool Contains<3>(
const RotBox<3>&,
const AxisBox<3>&, bool);
340 template bool Intersect<Ball<2>,RotBox<2> >(
const Ball<2>&,
const RotBox<2>&, bool);
341 template bool Intersect<Ball<3>,RotBox<3> >(
const Ball<3>&,
const RotBox<3>&, bool);
342 template bool Contains<2>(
const Ball<2>&,
const RotBox<2>&, bool);
343 template bool Contains<3>(
const Ball<3>&,
const RotBox<3>&, bool);
344 template bool Intersect<2>(
const RotBox<2>&,
const Ball<2>&, bool);
345 template bool Intersect<3>(
const RotBox<3>&,
const Ball<3>&, bool);
346 template bool Contains<2>(
const RotBox<2>&,
const Ball<2>&, bool);
347 template bool Contains<3>(
const RotBox<3>&,
const Ball<3>&, bool);
349 template bool Intersect<Segment<2>,RotBox<2> >(
const Segment<2>&,
const RotBox<2>&, bool);
350 template bool Intersect<Segment<3>,RotBox<3> >(
const Segment<3>&,
const RotBox<3>&, bool);
351 template bool Contains<2>(
const Segment<2>&,
const RotBox<2>&, bool);
352 template bool Contains<3>(
const Segment<3>&,
const RotBox<3>&, bool);
353 template bool Intersect<2>(
const RotBox<2>&,
const Segment<2>&, bool);
354 template bool Intersect<3>(
const RotBox<3>&,
const Segment<3>&, bool);
355 template bool Contains<2>(
const RotBox<2>&,
const Segment<2>&, bool);
356 template bool Contains<3>(
const RotBox<3>&,
const Segment<3>&, bool);
358 template bool Intersect<2>(
const RotBox<2>&,
const RotBox<2>&, bool);
359 template bool Intersect<3>(
const RotBox<3>&,
const RotBox<3>&, bool);
360 template bool Contains<2>(
const RotBox<2>&,
const RotBox<2>&, bool);
361 template bool Contains<3>(
const RotBox<3>&,
const RotBox<3>&, bool);
Generic library namespace.
static FloatType epsilon()
This is the attempted precision of the library.
double CoordType
Basic floating point type.