//// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // //// //// Project: Talina Gaming System (TgS) (∂) //// File: TgS Collision - Box-Particle.cpp //// Author: Andrew Aye (EMail: andrew.aye@gmail.com, Web: http://www.andrewaye.com) //// Version: 3.11 ////// //// ------------------------------------------------------------------------------------------------------------------------------ // //// //// Copyright: © 2002-2008, Andrew Aye. All Rights Reserved. //// //// This software is free for non-commercial use. Redistribution and use in source and binary forms, with or without modification, //// are permitted provided that the following conditions are met: //// Redistributions of source code must retain this copyright notice, this list of conditions and the following disclaimers. //// Redistributions in binary form must reproduce this copyright notice, this list of conditions and the following //// disclaimers in the documentation and other materials provided with the distribution. //// //// Neither the names of the copyright owner nor the names of its contributors may be used to endorse or promote products derived //// from this software without specific prior written permission. //// //// The intellectual property rights of the algorithms used reside with Andrew Aye. You may not use this software, in whole or //// in part, in support of any commercial product without the express written consent of the author. //// //// There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is". //// //// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // // // // // //namespace TGS { // START TGS /////////////////////////////////////////////////////////////////////////////////////////////////////// //namespace COL { // START COL /////////////////////////////////////////////////////////////////////////////////////////////////////// // //// ============================================================================================================================== // // //template <typename TYPE, int DIM> //TgBOOL F_Contact_Test( TYPE *ptyT0, TYPE *ptyT1, CR_(BOX,DIM) tgBX0, CR_(PARTICLE,DIM) tgPC0 ) //{ // TgASSERT( tgBX0.Is_Valid() && tgPC0.Is_Valid() ); // // // Since this is only a boolean contact test, I'm going to use an interval test method to detect if the particle is in contact // // with the box at anytime during the test period. // // C_(VECTOR,DIM) tvDS = tgPC0.Query_Position() - tgBX0.Query_Origin(); // // const TYPE tyDS_X0 = tgBX0.Query_AxisUnit0()*tvDS; // const TYPE tyPV_X0 = tgBX0.Query_AxisUnit0()*tgPC0.Query_Velocity(); // const TYPE tyPA_X0 = tgBX0.Query_AxisUnit0()*tgPC0.Query_Acceleration(); // // if ( // (tyDS_X0 > tgBX0.Query_Extent0() && tyPV_X0 >= TYPE(0.0) && tyPA_X0 >= TYPE(0.0)) || // (tyDS_X0 < -tgBX0.Query_Extent0() && tyPV_X0 <= TYPE(0.0) && tyPA_X0 <= TYPE(0.0)) // ) { // return (TgFALSE); // }; // // const TYPE tyDS_X1 = tgBX0.Query_AxisUnit1()*tvDS; // const TYPE tyPV_X1 = tgBX0.Query_AxisUnit1()*tgPC0.Query_Velocity(); // const TYPE tyPA_X1 = tgBX0.Query_AxisUnit1()*tgPC0.Query_Acceleration(); // // if ( // (tyDS_X1 > tgBX0.Query_Extent1() && tyPV_X0 >= TYPE(0.0) && tyPA_X0 >= TYPE(0.0)) || // (tyDS_X1 < -tgBX0.Query_Extent1() && tyPV_X0 <= TYPE(0.0) && tyPA_X0 <= TYPE(0.0)) // ) { // return (TgFALSE); // }; // // const TYPE tyDS_X2 = tgBX0.Query_AxisUnit2()*tvDS; // const TYPE tyPV_X2 = tgBX0.Query_AxisUnit2()*tgPC0.Query_Velocity(); // const TYPE tyPA_X2 = tgBX0.Query_AxisUnit2()*tgPC0.Query_Acceleration(); // // if ( // (tyDS_X2 > tgBX0.Query_Extent2() && tyPV_X0 >= TYPE(0.0) && tyPA_X0 >= TYPE(0.0)) || // (tyDS_X2 < -tgBX0.Query_Extent2() && tyPV_X0 <= TYPE(0.0) && tyPA_X0 <= TYPE(0.0)) // ) { // return (TgFALSE); // }; // // T_(VECTOR,DIM) tvS, tvV, tvA; // // F_SETV( tvS, tyDS_X0, tyDS_X1, tyDS_X2 ); // F_SETV( tvV, tyPV_X0, tyPV_X1, tyPV_X2 ); // F_SETV( tvA, tyPA_X0, tyPA_X1, tyPA_X2 ); // // F_Contact_Test_BAPC( tyT0, tyT1, tgBX0.Query_ExtentList(), tvS,tvV,tvA ); //}; // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //// ============================================================================================================================== // // //}; // END COL ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //}; // END TGS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////