[an error occurred while processing this directive]
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // // // Project: Talina Gaming System (TgS) (∂) // File: TgS Collision - Linear-Point.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". // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // // The linear collision tests are grouped into three families. The first returns only the minimal distance, the second and third // additionally respectively return the points of closest contact, or the linear extrapolation values. In each family of // functions its possible to return either the distance or the distance squared. // ============================================================================================================================== // // // Segment Definition: G0(α) = P0 + α•D0 | α ε [ 0, 1] // // Derivation: // Let the points of closest contact be Q0 = P0+γ•D0, and v = P1-Q0 // Geometrically we know that the vector connecting the two closest points of contact ( or the minimal distance // vector ) must be perpendicular to the line. Thus, D0•v=0, D1•v=0, DS=P1-P0, v=P1-(P0+γ•D0) // // 0 = D0_(P1-P0-γ•D0,DIM) // 0 = D0_(DS-γ•D0,DIM) // 0 = D0•DS-γ•D0•D0 // γ = D0•DS / D0•D0 // // However, we know that γ ε [ 0, 1], generating three cases: // // [1] γ ε (-∞, 0) || γ = 0 // Distance: The distance between P0 and P1 // = (P1-P0)T_(P1-P0,DIM) // = DS•DS // // [2] γ ε [ 0, 1] || γ = (DS•D0) / (D0•D0) // Distance: The distance value would be || v ||. // = || v || = v•v = (DS-γ•D0)T_(DS-γ•D0,DIM) // = DS•DS + γ•γ•D0•D0 - 2•γ•DS•D0 // = DS•DS + γ_(γ•D0•D0 - 2•DS•D0,DIM) // = DS•DS + γ_((DS•D0 / D0•D0,DIM)•D0•D0 - 2•DS•D0) // = DS•DS + γ_(DS•D0 - 2•DS•D0,DIM) // = DS•DS - γ_(DS•D0,DIM) // // [3] γ ε ( 1, ∞) || γ = 1 // Distance: The distance between P0+D0 and P1 // = (P1-P0-D0)T_(P1-P0-D0,DIM) // = (DS-D0)T_(DS-D0,DIM) // = DS•DS - 2•DS•D0 + D0•D0 // // ============================================================================================================================== // namespace TGS { // START TGS /////////////////////////////////////////////////////////////////////////////////////////////////////// namespace COL { // START COL /////////////////////////////////////////////////////////////////////////////////////////////////////// // ============================================================================================================================== // template struct TTgFSQ_LNPT<TgFLOAT32,4,0,0>; template struct TTgFSQ_LNPT<TgFLOAT32,4,1,0>; template struct TTgFSQ_LNPT<TgFLOAT32,4,1,1>; template struct TTgCSQ_LNPT<TgFLOAT32,4,0,0>; template struct TTgCSQ_LNPT<TgFLOAT32,4,1,0>; template struct TTgCSQ_LNPT<TgFLOAT32,4,1,1>; // ============================================================================================================================== // }; // END COL ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; // END TGS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[an error occurred while processing this directive]