Returns true if the intersection of the ray and the solid box is non-empty.
341 switch (ray.classification) {
344 if ((ray.m_origin.x < box.lo.x) || (ray.m_origin.y < box.lo.y) || (ray.m_origin.z < box.lo.z)
345 || (ray.jbyi * box.lo.x - box.hi.y + ray.c_xy > 0)
346 || (ray.ibyj * box.lo.y - box.hi.x + ray.c_yx > 0)
347 || (ray.jbyk * box.lo.z - box.hi.y + ray.c_zy > 0)
348 || (ray.kbyj * box.lo.y - box.hi.z + ray.c_yz > 0)
349 || (ray.kbyi * box.lo.x - box.hi.z + ray.c_xz > 0)
350 || (ray.ibyk * box.lo.z - box.hi.x + ray.c_zx > 0)) {
356 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
357 float t1 = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
362 float t2 = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
372 if ((ray.m_origin.x < box.lo.x) || (ray.m_origin.y < box.lo.y) || (ray.m_origin.z > box.hi.z)
373 || (ray.jbyi * box.lo.x - box.hi.y + ray.c_xy > 0)
374 || (ray.ibyj * box.lo.y - box.hi.x + ray.c_yx > 0)
375 || (ray.jbyk * box.hi.z - box.hi.y + ray.c_zy > 0)
376 || (ray.kbyj * box.lo.y - box.lo.z + ray.c_yz < 0)
377 || (ray.kbyi * box.lo.x - box.lo.z + ray.c_xz < 0)
378 || (ray.ibyk * box.hi.z - box.hi.x + ray.c_zx > 0)) {
382 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
383 float t1 = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
387 float t2 = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;
397 if ((ray.m_origin.x < box.lo.x) || (ray.m_origin.y > box.hi.y) || (ray.m_origin.z < box.lo.z)
398 || (ray.jbyi * box.lo.x - box.lo.y + ray.c_xy < 0)
399 || (ray.ibyj * box.hi.y - box.hi.x + ray.c_yx > 0)
400 || (ray.jbyk * box.lo.z - box.lo.y + ray.c_zy < 0)
401 || (ray.kbyj * box.hi.y - box.hi.z + ray.c_yz > 0)
402 || (ray.kbyi * box.lo.x - box.hi.z + ray.c_xz > 0)
403 || (ray.ibyk * box.lo.z - box.hi.x + ray.c_zx > 0)) {
407 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
408 float t1 = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
412 float t2 = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
422 if ((ray.m_origin.x < box.lo.x) || (ray.m_origin.y > box.hi.y) || (ray.m_origin.z > box.hi.z)
423 || (ray.jbyi * box.lo.x - box.lo.y + ray.c_xy < 0)
424 || (ray.ibyj * box.hi.y - box.hi.x + ray.c_yx > 0)
425 || (ray.jbyk * box.hi.z - box.lo.y + ray.c_zy < 0)
426 || (ray.kbyj * box.hi.y - box.lo.z + ray.c_yz < 0)
427 || (ray.kbyi * box.lo.x - box.lo.z + ray.c_xz < 0)
428 || (ray.ibyk * box.hi.z - box.hi.x + ray.c_zx > 0)) {
432 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
433 float t1 = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
437 float t2 = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;
447 if ((ray.m_origin.x > box.hi.x) || (ray.m_origin.y < box.lo.y) || (ray.m_origin.z < box.lo.z)
448 || (ray.jbyi * box.hi.x - box.hi.y + ray.c_xy > 0)
449 || (ray.ibyj * box.lo.y - box.lo.x + ray.c_yx < 0)
450 || (ray.jbyk * box.lo.z - box.hi.y + ray.c_zy > 0)
451 || (ray.kbyj * box.lo.y - box.hi.z + ray.c_yz > 0)
452 || (ray.kbyi * box.hi.x - box.hi.z + ray.c_xz > 0)
453 || (ray.ibyk * box.lo.z - box.lo.x + ray.c_zx < 0)) {
457 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
458 float t1 = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
462 float t2 = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
473 if ((ray.m_origin.x > box.hi.x) || (ray.m_origin.y < box.lo.y) || (ray.m_origin.z > box.hi.z)
474 || (ray.jbyi * box.hi.x - box.hi.y + ray.c_xy > 0)
475 || (ray.ibyj * box.lo.y - box.lo.x + ray.c_yx < 0)
476 || (ray.jbyk * box.hi.z - box.hi.y + ray.c_zy > 0)
477 || (ray.kbyj * box.lo.y - box.lo.z + ray.c_yz < 0)
478 || (ray.kbyi * box.hi.x - box.lo.z + ray.c_xz < 0)
479 || (ray.ibyk * box.hi.z - box.lo.x + ray.c_zx < 0)) {
483 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
484 float t1 = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
488 float t2 = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;
498 if ((ray.m_origin.x > box.hi.x) || (ray.m_origin.y > box.hi.y) || (ray.m_origin.z < box.lo.z)
499 || (ray.jbyi * box.hi.x - box.lo.y + ray.c_xy < 0)
500 || (ray.ibyj * box.hi.y - box.lo.x + ray.c_yx < 0)
501 || (ray.jbyk * box.lo.z - box.lo.y + ray.c_zy < 0)
502 || (ray.kbyj * box.hi.y - box.hi.z + ray.c_yz > 0)
503 || (ray.kbyi * box.hi.x - box.hi.z + ray.c_xz > 0)
504 || (ray.ibyk * box.lo.z - box.lo.x + ray.c_zx < 0)) {
508 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
509 float t1 = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
513 float t2 = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
523 if ((ray.m_origin.x > box.hi.x) || (ray.m_origin.y > box.hi.y) || (ray.m_origin.z > box.hi.z)
524 || (ray.jbyi * box.hi.x - box.lo.y + ray.c_xy < 0)
525 || (ray.ibyj * box.hi.y - box.lo.x + ray.c_yx < 0)
526 || (ray.jbyk * box.hi.z - box.lo.y + ray.c_zy < 0)
527 || (ray.kbyj * box.hi.y - box.lo.z + ray.c_yz < 0)
528 || (ray.kbyi * box.hi.x - box.lo.z + ray.c_xz < 0)
529 || (ray.ibyk * box.hi.z - box.lo.x + ray.c_zx < 0)) {
533 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
534 float t1 = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
538 float t2 = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;
548 if((ray.m_origin.x < box.lo.x) || (ray.m_origin.x > box.hi.x)
549 || (ray.m_origin.y < box.lo.y) || (ray.m_origin.z < box.lo.z)
550 || (ray.jbyk * box.lo.z - box.hi.y + ray.c_zy > 0)
551 || (ray.kbyj * box.lo.y - box.hi.z + ray.c_yz > 0)) {
555 time = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
556 float t2 = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
566 if((ray.m_origin.x < box.lo.x) || (ray.m_origin.x > box.hi.x)
567 || (ray.m_origin.y < box.lo.y) || (ray.m_origin.z > box.hi.z)
568 || (ray.jbyk * box.hi.z - box.hi.y + ray.c_zy > 0)
569 || (ray.kbyj * box.lo.y - box.lo.z + ray.c_yz < 0)) {
573 time = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
574 float t2 = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;
584 if((ray.m_origin.x < box.lo.x) || (ray.m_origin.x > box.hi.x)
585 || (ray.m_origin.y > box.hi.y) || (ray.m_origin.z < box.lo.z)
586 || (ray.jbyk * box.lo.z - box.lo.y + ray.c_zy < 0)
587 || (ray.kbyj * box.hi.y - box.hi.z + ray.c_yz > 0)) {
591 time = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
592 float t2 = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
602 if((ray.m_origin.x < box.lo.x) || (ray.m_origin.x > box.hi.x)
603 || (ray.m_origin.y > box.hi.y) || (ray.m_origin.z > box.hi.z)
604 || (ray.jbyk * box.hi.z - box.lo.y + ray.c_zy < 0)
605 || (ray.kbyj * box.hi.y - box.lo.z + ray.c_yz < 0)) {
609 time = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
610 float t2 = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;
621 if((ray.m_origin.y < box.lo.y) || (ray.m_origin.y > box.hi.y)
622 || (ray.m_origin.x < box.lo.x) || (ray.m_origin.z < box.lo.z)
623 || (ray.kbyi * box.lo.x - box.hi.z + ray.c_xz > 0)
624 || (ray.ibyk * box.lo.z - box.hi.x + ray.c_zx > 0)) {
628 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
629 float t2 = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
640 if((ray.m_origin.y < box.lo.y) || (ray.m_origin.y > box.hi.y)
641 || (ray.m_origin.x < box.lo.x) || (ray.m_origin.z > box.hi.z)
642 || (ray.kbyi * box.lo.x - box.lo.z + ray.c_xz < 0)
643 || (ray.ibyk * box.hi.z - box.hi.x + ray.c_zx > 0)) {
647 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
648 float t2 = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;
658 if((ray.m_origin.y < box.lo.y) || (ray.m_origin.y > box.hi.y)
659 || (ray.m_origin.x > box.hi.x) || (ray.m_origin.z < box.lo.z)
660 || (ray.kbyi * box.hi.x - box.hi.z + ray.c_xz > 0)
661 || (ray.ibyk * box.lo.z - box.lo.x + ray.c_zx < 0)) {
665 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
666 float t2 = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
677 if((ray.m_origin.y < box.lo.y) || (ray.m_origin.y > box.hi.y)
678 || (ray.m_origin.x > box.hi.x) || (ray.m_origin.z > box.hi.z)
679 || (ray.kbyi * box.hi.x - box.lo.z + ray.c_xz < 0)
680 || (ray.ibyk * box.hi.z - box.lo.x + ray.c_zx < 0)) {
684 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
685 float t2 = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;
695 if((ray.m_origin.z < box.lo.z) || (ray.m_origin.z > box.hi.z)
696 || (ray.m_origin.x < box.lo.x) || (ray.m_origin.y < box.lo.y)
697 || (ray.jbyi * box.lo.x - box.hi.y + ray.c_xy > 0)
698 || (ray.ibyj * box.lo.y - box.hi.x + ray.c_yx > 0)) {
702 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
703 float t1 = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
713 if((ray.m_origin.z < box.lo.z) || (ray.m_origin.z > box.hi.z)
714 || (ray.m_origin.x < box.lo.x) || (ray.m_origin.y > box.hi.y)
715 || (ray.jbyi * box.lo.x - box.lo.y + ray.c_xy < 0)
716 || (ray.ibyj * box.hi.y - box.hi.x + ray.c_yx > 0)) {
720 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
721 float t1 = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
732 if((ray.m_origin.z < box.lo.z) || (ray.m_origin.z > box.hi.z)
733 || (ray.m_origin.x > box.hi.x) || (ray.m_origin.y < box.lo.y)
734 || (ray.jbyi * box.hi.x - box.hi.y + ray.c_xy > 0)
735 || (ray.ibyj * box.lo.y - box.lo.x + ray.c_yx < 0)) {
739 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
740 float t1 = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
750 if((ray.m_origin.z < box.lo.z) || (ray.m_origin.z > box.hi.z)
751 || (ray.m_origin.x > box.hi.x) || (ray.m_origin.y > box.hi.y)
752 || (ray.jbyi * box.hi.x - box.lo.y + ray.c_xy < 0)
753 || (ray.ibyj * box.hi.y - box.lo.x + ray.c_yx < 0)) {
757 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
758 float t1 = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
769 if((ray.m_origin.x < box.lo.x)
770 || (ray.m_origin.y < box.lo.y) || (ray.m_origin.y > box.hi.y)
771 || (ray.m_origin.z < box.lo.z) || (ray.m_origin.z > box.hi.z)) {
775 time = (box.hi.x - ray.m_origin.x) * ray.m_invDirection.x;
781 if ((ray.m_origin.x > box.hi.x)
782 || (ray.m_origin.y < box.lo.y) || (ray.m_origin.y > box.hi.y)
783 || (ray.m_origin.z < box.lo.z) || (ray.m_origin.z > box.hi.z)) {
787 time = (box.lo.x - ray.m_origin.x) * ray.m_invDirection.x;
793 if ((ray.m_origin.y < box.lo.y)
794 || (ray.m_origin.x < box.lo.x) || (ray.m_origin.x > box.hi.x)
795 || (ray.m_origin.z < box.lo.z) || (ray.m_origin.z > box.hi.z)) {
799 time = (box.hi.y - ray.m_origin.y) * ray.m_invDirection.y;
805 if ((ray.m_origin.y > box.hi.y)
806 || (ray.m_origin.x < box.lo.x) || (ray.m_origin.x > box.hi.x)
807 || (ray.m_origin.z < box.lo.z) || (ray.m_origin.z > box.hi.z)) {
811 time = (box.lo.y - ray.m_origin.y) * ray.m_invDirection.y;
818 if ((ray.m_origin.z < box.lo.z)
819 || (ray.m_origin.x < box.lo.x) || (ray.m_origin.x > box.hi.x)
820 || (ray.m_origin.y < box.lo.y) || (ray.m_origin.y > box.hi.y)) {
824 time = (box.hi.z - ray.m_origin.z) * ray.m_invDirection.z;
830 if ((ray.m_origin.z > box.hi.z)
831 || (ray.m_origin.x < box.lo.x) || (ray.m_origin.x > box.hi.x)
832 || (ray.m_origin.y < box.lo.y) || (ray.m_origin.y > box.hi.y)) {
836 time = (box.lo.z - ray.m_origin.z) * ray.m_invDirection.z;