[an error occurred while processing this directive]
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //
//
//  Project:   Talina Gaming System (TgS) (∂)
//  File:      TgS Collision - Linear-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_LINEAR_LINEAR_INL_)
#define _TGS_COLLISION_LINEAR_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.

// tvS0         Point (Input)
// tvD0         Direction (Input)
// tvS1         Point (Input)
// tvD1         Direction (Input)

// ============================================================================================================================== //




namespace TGS { // START TGS ///////////////////////////////////////////////////////////////////////////////////////////////////////
namespace COL { // START COL ///////////////////////////////////////////////////////////////////////////////////////////////////////

// ============================================================================================================================== //

template <typename TYPE, int DIM, bool bC0, bool bC1, bool bC2, bool bC3> TgFORCEINLINE
TgBOOL TTgTST_LNLN<TYPE,DIM,bC0,bC1,bC2,bC3>::DO( M_(VECTOR,DIM) tvS0, M_(VECTOR,DIM) tvD0, M_(VECTOR,DIM) tvS1, M_(VECTOR,DIM) tvD1 )
{
        C_(VECTOR,DIM)                      tvDS = MATH::F_SUB( tvS1, tvS0 );
        C_(VECTOR,DIM)                      tvN = MATH::F_CX(tvD0,tvD1);
        const TYPE                          tyTA = MATH::F_LSQ( tvN );

        const TYPE                          tyT0 = MATH::F_DOT( tvD1, MATH::F_CX( tvN, tvDS ) ) / tyTA;
        const TYPE                          tyT1 = MATH::F_DOT( tvD0, MATH::F_CX( tvN, tvDS ) ) / tyTA;

        C_(VECTOR,DIM)                      tvK0 = MATH::F_MUL( tyT1, tvD1 );
        C_(VECTOR,DIM)                      tvK1 = MATH::F_MUL( tyT0, tvD0 );

        return (!Near_Zero( tyTA ) && MATH::F_LSQ( MATH::F_SUB( MATH::F_ADD( tvDS, tvK0 ), tvK1 ) ) <= LIMITS<TYPE>::ROOTEPSILON);
};


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //

template <typename TYPE, int DIM, bool bC0, bool bC1, bool bC2, bool bC3>
TgFORCEINLINE TYPE TTgFSQ_LNLN<TYPE,DIM,bC0,bC1,bC2,bC3>::DO( M_(VECTOR,DIM) tvS0, M_(VECTOR,DIM) tvD0, M_(VECTOR,DIM) tvS1, M_(VECTOR,DIM) tvD1 )
{
    TYPE                                tyT0,tyT1;

    return (TTgCSQ_LNLN<TYPE,DIM,bC0,bC1,bC2,bC3>::DO( &tyT0,&tyT1, tvS0,tvD0, tvS1,tvD1 ));
};


// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //

template <typename TYPE, int DIM, bool bC0, bool bC1, bool bC2, bool bC3>
TgFORCEINLINE TYPE TTgCSQ_LNLN<TYPE,DIM,bC0,bC1,bC2,bC3>::DO(
    PC_(VECTOR,DIM) ptvT0, PC_(VECTOR,DIM) ptvT1, M_(VECTOR,DIM) tvS0, M_(VECTOR,DIM) tvD0, M_(VECTOR,DIM) tvS1, M_(VECTOR,DIM) tvD1
) {
    TYPE                                tyT0,tyT1;
    const TYPE                          tyDistSq = DO( &tyT0,&tyT1, tvS0,tvD0, tvS1,tvD1 );

    *ptvT0 = MATH::F_ADD( tvS0, MATH::F_MUL( tyT0, tvD0 ) );
    *ptvT1 = MATH::F_ADD( tvS1, MATH::F_MUL( tyT1, tvD1 ) );

    return (tyDistSq);
};


// ============================================================================================================================== //

}; // END COL //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}; // END TGS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif //  END  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[an error occurred while processing this directive]