[an error occurred while processing this directive]
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // // // Project: Talina Gaming System (TgS) (∂) // File: TgS Collision - Triangle-Linear.inl // 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". // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // #if !defined(_TGS_COLLISION_TRIANGLE_LINEAR_INL_) #define _TGS_COLLISION_TRIANGLE_LINEAR_INL_ #pragma once // ============================================================================================================================== // // Functions used for internal use - primitive based functions should be the primary system calls. // A linear is a generic term used to describe the set of 1D primitives. To avoid code duplication these functions are normally // created through templates where two boolean template parameters are used to indicate if the free variable is closed on a // particular side of the number line. // tgET0 Edge Triangle (Input) // tgST0 Space Triangle (Input) // tvS0 Point (Input) // tvD0 Direction (Input) // tgPacket Container of points resulting from a contact generator. Generation parameters provided as well. (Input/Ouput) // tgPacket Container of points resulting from a contact generator. Generation parameters provided as well. (Input/Ouput) // tvST0 The point of closest proximity on the parallelogram. (Output) // tvLN0 The point of closest proximity on the line. (Output) // tyLN0 Parametric parameter to generate point of interest #1 based on the line. (Output) // tyLN1 Parametric parameter to generate point of interest #2 based on the line. (Output) // ============================================================================================================================== // namespace TGS { // START TGS /////////////////////////////////////////////////////////////////////////////////////////////////////// namespace COL { // START COL /////////////////////////////////////////////////////////////////////////////////////////////////////// // ============================================================================================================================== // // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // // ETRI // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // // ============================================================================================================================== // template <typename TYPE, int DIM, bool bC0, bool bC1> TgRESULT TTgINT_ETLN<TYPE,DIM,bC0,bC1>::DO( PC_(CONTACT_PACKET,DIM) ptgPacket, CR_(ETRI,DIM) tgET0, M_(VECTOR,DIM) tvS0, M_(VECTOR,DIM) tvD0 ) { TYPE tyET0,tyET1, tyG1; C_TgRESULT tgResult = DO( &tyET0,&tyET1, &tyG1, tgET0, tvS0,tvD0 ); if (TgFAILED(tgResult)) { return (tgResult); }; P_(CONTACT,DIM) ptgContact; ptgContact = (P_(CONTACT,DIM))((PC_TgUINT08)ptgPacket->m_ptgContact + ptgPacket->m_niContact*ptgPacket->m_iStride); ptgContact->m_tvPos = MATH::F_ADD( tvS0, MATH::F_MUL( tyG1, tvD0 ) ); ptgContact->m_tvNormal = tgET0.Query_Normal(); ptgContact->m_tyT0 = tyG1; ptgContact->m_tyDepth = TYPE(0.0); ++ptgPacket->m_niContact; return (TgS_OK); }; // ============================================================================================================================== // // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // // STRI // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // // ============================================================================================================================== // template <typename TYPE, int DIM, bool bC0, bool bC1> TgFORCEINLINE TYPE TTgFSQ_STLN<TYPE,DIM,bC0,bC1>::DO( CR_(STRI,DIM) tgST0, M_(VECTOR,DIM) tvS0, M_(VECTOR,DIM) tvD0 ) { TYPE tyET0,tyET1, tyG1; return (TTgCSQ_STLN<TYPE,DIM,bC0,bC1>::DO( &tyET0,&tyET1, &tyG1, tgST0, tvS0,tvD0 )); }; template <typename TYPE, int DIM, bool bC0, bool bC1> TgFORCEINLINE TYPE TTgCSQ_STLN<TYPE,DIM,bC0,bC1>::DO( PC_(VECTOR,DIM) ptvST0, PC_(VECTOR,DIM) ptvLN0, CR_(STRI,DIM) tgST0, M_(VECTOR,DIM) tvS0, M_(VECTOR,DIM) tvD0 ) { TYPE tyET0,tyET1, tyLN0, tyDistSq; tyDistSq = DO( &tyET0,&tyET1, &tyLN0, tgST0, tvS0,tvD0 ); C_(VECTOR,DIM) tvK0 = MATH::F_MUL( tyET0, tgST0.Query_Edge0() ); C_(VECTOR,DIM) tvK1 = MATH::F_MUL( tyET1, tgST0.Query_Edge2() ); *ptvLN0 = MATH::F_ADD( tvS0, MATH::F_MUL( tyLN0, tvD0 ) ); *ptvST0 = MATH::F_SUB( MATH::F_ADD( tgST0.Query_Origin(), tvK0 ), tvK1 ); return (P::FSEL( tyDistSq, tyDistSq, -LIMITS<TYPE>::MAX )); }; template <typename TYPE, int DIM, bool bC0, bool bC1> TgFORCEINLINE TgRESULT TTgCLP_STLN<TYPE,DIM,bC0,bC1>::DO( TYPE *ptyLN0, TYPE *ptyLN1, CR_(STRI,DIM) tgST1, M_(VECTOR,DIM) tvS0, M_(VECTOR,DIM) tvD0 ) { TgINT iCode; return (TTgCLF_STLN<TYPE,DIM,bC0,bC1>::DO( ptyLN0, ptyLN1, &iCode, tgST1, tvS0, tvD0 )); }; // ============================================================================================================================== // }; // END COL ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; // END TGS ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endif // END ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[an error occurred while processing this directive]