MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / testIntersects

Function testIntersects

src/ImathTest/testBox.cpp:442–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440
441template <class T>
442void
443testIntersects (const char* type)
444{
445 cout << " intersects() for type " << type << endl;
446
447 IMATH_INTERNAL_NAMESPACE::Rand32 rand (0);
448
449 //
450 // Intersect point with empty box.
451 //
452 {
453 IMATH_INTERNAL_NAMESPACE::Box<T> b;
454 T p (1);
455
456 assert (!b.intersects (p));
457 }
458
459 //
460 // Intersect point with non-empty, has-volume box.
461 //
462 {
463 IMATH_INTERNAL_NAMESPACE::Box<T> b (T (-1), T (1));
464 T p0 (0);
465 T p1 (5);
466 T p2 (-5);
467
468 assert (b.intersects (p0));
469 assert (!b.intersects (p1));
470 assert (!b.intersects (p2));
471 }
472
473 //
474 // Intersect point with non-empty, no-volume box.
475 // Boxes are:
476 // 2D: [(0, 0), (0, 1) ]
477 // 3D: [(0, 0, 0), (0, 0, 1) ]
478 // 4D: [(0, 0, 0, 0), (0, 0, 0, 1)]
479 //
480 {
481 T min (0);
482 T max = min;
483 max[T::dimensions () - 1] = 1;
484
485 T p0 (0);
486 T p1 (5);
487 IMATH_INTERNAL_NAMESPACE::Box<T> b (min, max);
488
489 assert (b.intersects (p0));
490 assert (!b.intersects (p1));
491 }
492
493 //
494 // Intersect empty box with empty box.
495 //
496 {
497 IMATH_INTERNAL_NAMESPACE::Box<T> b0;
498 IMATH_INTERNAL_NAMESPACE::Box<T> b1;
499

Callers

nothing calls this directly

Calls 2

TClass · 0.50
dimensionsFunction · 0.50

Tested by

no test coverage detected