2015-12-08 07:31:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-07-19 17:35:25 +00:00
|
|
|
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
2021-01-02 21:05:29 +00:00
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2015-12-08 07:31:57 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
/**
|
2021-01-03 22:23:00 +00:00
|
|
|
* @file bbox_3d_ray.cpp
|
|
|
|
* @brief 3D bounding box ray intersection tests.
|
2015-12-08 07:31:57 +00:00
|
|
|
*/
|
|
|
|
|
2021-01-03 22:23:00 +00:00
|
|
|
#include "bbox_3d.h"
|
2021-01-05 22:19:00 +00:00
|
|
|
#include "../ray.h"
|
2015-12-08 07:31:57 +00:00
|
|
|
#include <wx/debug.h>
|
|
|
|
|
|
|
|
// This BBOX Ray intersection test have the following credits:
|
|
|
|
|
|
|
|
// "This source code accompanies the Journal of Graphics Tools paper:
|
|
|
|
//
|
2016-07-27 12:52:04 +00:00
|
|
|
// "Fast Ray / Axis-Aligned Bounding Box Overlap Tests using Ray Slopes"
|
|
|
|
// by Martin Eisemann, Thorsten Grosch, Stefan Müller and Marcus Magnor
|
|
|
|
// Computer Graphics Lab, TU Braunschweig, Germany and
|
|
|
|
// University of Koblenz-Landau, Germany
|
2015-12-08 07:31:57 +00:00
|
|
|
//
|
2016-07-27 12:52:04 +00:00
|
|
|
// This source code is public domain, but please mention us if you use it."
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
|
2021-01-02 21:05:29 +00:00
|
|
|
bool BBOX_3D::Intersect( const RAY& aRay, float* t ) const
|
2015-12-08 07:31:57 +00:00
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
switch( aRay.m_Classification )
|
2015-12-08 07:31:57 +00:00
|
|
|
{
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MMM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_max.x + aRay.c_yx > 0 )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_max.z + aRay.c_yz > 0 )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
// compute the intersection distance
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MMP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_max.x + aRay.c_yx > 0 )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_min.z + aRay.c_yz < 0 )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MPM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_max.x + aRay.c_yx > 0 )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_max.z + aRay.c_yz > 0 )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MPP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_max.x + aRay.c_yx > 0 )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_min.z + aRay.c_yz < 0 )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PMM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_min.x + aRay.c_yx < 0 )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_max.z + aRay.c_yz > 0 )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PMP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_min.x + aRay.c_yx < 0 )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_min.z + aRay.c_yz < 0 )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PPM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_min.x + aRay.c_yx < 0 )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_max.z + aRay.c_yz > 0 )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PPP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_min.x + aRay.c_yx < 0 )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_min.z + aRay.c_yz < 0 )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OMM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.x > m_max.x )
|
|
|
|
|| ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_max.z + aRay.c_yz > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OMP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.x > m_max.x )
|
|
|
|
|| ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_min.z + aRay.c_yz < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OPM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.x > m_max.x )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_max.z + aRay.c_yz > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OPP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.x > m_max.x )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_min.z + aRay.c_yz < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MOM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MOP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::POM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::POP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t2 = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t2 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t2;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MMO:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_max.x + aRay.c_yx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MPO:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_max.x + aRay.c_yx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PMO:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_min.x + aRay.c_yx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PPO:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_min.x + aRay.c_yx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
float t1 = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-07-27 12:52:04 +00:00
|
|
|
if( t1 > *t )
|
2016-06-07 12:42:42 +00:00
|
|
|
*t = t1;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MOO:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::POO:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.x - aRay.m_Origin.x ) * aRay.m_InvDir.x;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OMO:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.x < m_min.x )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OPO:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.x < m_min.x )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.y - aRay.m_Origin.y ) * aRay.m_InvDir.y;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OOM:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.x < m_min.x )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_max.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OOP:
|
2016-06-07 12:42:42 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z > m_max.z ) || ( aRay.m_Origin.x < m_min.x )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
*t = ( m_min.z - aRay.m_Origin.z ) * aRay.m_InvDir.z;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-06-07 12:42:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-02 21:05:29 +00:00
|
|
|
bool BBOX_3D::Intersect( const RAY& aRay ) const
|
2015-12-08 07:31:57 +00:00
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
switch( aRay.m_Classification )
|
2015-12-08 07:31:57 +00:00
|
|
|
{
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MMM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_max.x + aRay.c_yx > 0 )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_max.z + aRay.c_yz > 0 )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MMP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_max.x + aRay.c_yx > 0 )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_min.z + aRay.c_yz < 0 )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MPM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_max.x + aRay.c_yx > 0 )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_max.z + aRay.c_yz > 0 )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MPP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_max.x + aRay.c_yx > 0 )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_min.z + aRay.c_yz < 0 )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_max.x + aRay.c_zx > 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PMM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_min.x + aRay.c_yx < 0 )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_max.z + aRay.c_yz > 0 )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PMP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_min.x + aRay.c_yx < 0 )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_min.z + aRay.c_yz < 0 )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PPM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_min.x + aRay.c_yx < 0 )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_max.z + aRay.c_yz > 0 )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PPP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_min.x + aRay.c_yx < 0 )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_min.z + aRay.c_yz < 0 )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_min.x + aRay.c_zx < 0 ) )
|
2016-07-27 12:52:04 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OMM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.x > m_max.x )
|
|
|
|
|| ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_max.z + aRay.c_yz > 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OMP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.x > m_max.x )
|
|
|
|
|| ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_max.y + aRay.c_zy > 0 )
|
|
|
|
|| ( aRay.kbyj * m_min.y - m_min.z + aRay.c_yz < 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OPM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.x > m_max.x )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.jbyk * m_min.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_max.z + aRay.c_yz > 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OPP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.x > m_max.x )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.jbyk * m_max.z - m_min.y + aRay.c_zy < 0 )
|
|
|
|
|| ( aRay.kbyj * m_max.y - m_min.z + aRay.c_yz < 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MOM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_max.x + aRay.c_zx > 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MOP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.kbyi * m_min.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_max.x + aRay.c_zx > 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::POM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_max.z + aRay.c_xz > 0 )
|
|
|
|
|| ( aRay.ibyk * m_min.z - m_min.x + aRay.c_zx < 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::POP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.kbyi * m_max.x - m_min.z + aRay.c_xz < 0 )
|
|
|
|
|| ( aRay.ibyk * m_max.z - m_min.x + aRay.c_zx < 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MMO:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_max.x + aRay.c_yx > 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MPO:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.jbyi * m_min.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_max.x + aRay.c_yx > 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PMO:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_max.y + aRay.c_xy > 0 )
|
|
|
|
|| ( aRay.ibyj * m_min.y - m_min.x + aRay.c_yx < 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::PPO:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.z > m_max.z )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y > m_max.y )
|
|
|
|
|| ( aRay.jbyi * m_max.x - m_min.y + aRay.c_xy < 0 )
|
|
|
|
|| ( aRay.ibyj * m_max.y - m_min.x + aRay.c_yx < 0 ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::MOO:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x < m_min.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::POO:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OMO:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y < m_min.y ) || ( aRay.m_Origin.x < m_min.x )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OPO:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.y > m_max.y ) || ( aRay.m_Origin.x < m_min.x )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.z < m_min.z )
|
|
|
|
|| ( aRay.m_Origin.z > m_max.z ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OOM:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z < m_min.z ) || ( aRay.m_Origin.x < m_min.x )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
case RAY_CLASSIFICATION::OOP:
|
2016-07-27 12:52:04 +00:00
|
|
|
{
|
2020-12-11 13:51:42 +00:00
|
|
|
if( ( aRay.m_Origin.z > m_max.z ) || ( aRay.m_Origin.x < m_min.x )
|
|
|
|
|| ( aRay.m_Origin.x > m_max.x ) || ( aRay.m_Origin.y < m_min.y )
|
|
|
|
|| ( aRay.m_Origin.y > m_max.y ) )
|
2015-12-08 07:31:57 +00:00
|
|
|
return false;
|
2016-07-27 12:52:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|