Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Math API [Vector] [M] [F32_04].i_inc
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, 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:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution 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.
    The name of the author may not 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".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/* == Common ============================================================================================================================================================ */

/* ---- VECTOR 4 - INIT ------------------------------------------------------------------------------------------------------------------------------------------------- */

/* ---- V(MS_SET) ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(MS_SET)( const TYPE fX, const TYPE fy, const TYPE fZ, const TYPE fW )
{
    V(TgVEC) vResult = V(FS_SET)( fX, fy, fZ, fW );
    return vResult.m_mData;
}


/* ---- V(MS_SETP) ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(MS_SETP)( const TYPE fX, const TYPE fy, const TYPE fZ )
{
    V(TgVEC) vResult = V(FS_SETP)( fX, fy, fZ );
    return vResult.m_mData;
}


/* ---- V(MS_SETV) ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(MS_SETV)( const TYPE fX, const TYPE fy, const TYPE fZ )
{
    V(TgVEC) vResult = V(FS_SETV)( fX, fy, fZ );
    return vResult.m_mData;
}


/* ---- V(M_SETP) ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_SETP)( V(C_TgVEC_M) v0 )
{
    V(TgVEC) vResult = V(F_SETP)( (V(CP_TgVEC))&v0 );
    return vResult.m_mData;
}


/* ---- V(M_SETV) ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_SETV)( V(C_TgVEC_M) v0 )
{
    V(TgVEC) vResult = V(F_SETV)( (V(CP_TgVEC))&v0 );
    return vResult.m_mData;
}


/* ---- V(M_SPX) ------------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_SPX)( V(C_TgVEC_M) v0 )
{
    V(TgVEC) vResult = V(FS_SET1)( ((V(CP_TgVEC))&v0)->m_aData[0] );
    return vResult.m_mData;
}


/* ---- V(M_SPY) ------------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_SPY)( V(C_TgVEC_M) v0 )
{
    V(TgVEC) vResult = V(FS_SET1)( ((V(CP_TgVEC))&v0)->m_aData[1] );
    return vResult.m_mData;
}


/* ---- V(M_SPZ) ------------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_SPZ)( V(C_TgVEC_M) v0 )
{
    V(TgVEC) vResult = V(FS_SET1)( ((V(CP_TgVEC))&v0)->m_aData[2] );
    return vResult.m_mData;
}


/* ---- V(M_SPW) ------------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_SPW)( V(C_TgVEC_M) v0 )
{
    V(TgVEC) vResult = V(FS_SET1)( ((V(CP_TgVEC))&v0)->m_aData[3] );
    return vResult.m_mData;
}


/* ---- V(M_DOT3) ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_DOT3)( V(C_TgVEC_M) v0, V(C_TgVEC_M) v1 )
{
    V(TgVEC) vResult = V(FS_SET1)( V(F_DOT3)( (V(CP_TgVEC))&v0, (V(CP_TgVEC))&v1 ) );
    return vResult.m_mData;
}


/* ---- V(M_CX) -------------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_CX)( V(C_TgVEC_M) v0, V(C_TgVEC_M) v1 )
{
    V(TgVEC) vResult = V(F_CX)( (V(CP_TgVEC))&v0, (V(CP_TgVEC))&v1 );
    return vResult.m_mData;
}


/* ---- V(M_UCX) ------------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_UCX)( V(C_TgVEC_M) v0, V(C_TgVEC_M) v1 )
{
    V(TgVEC) vResult = V(F_UCX)( (V(CP_TgVEC))&v0, (V(CP_TgVEC))&v1 );
    return vResult.m_mData;
}


/* ---- V(M_UCX_LEN) --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_UCX_LEN)( V(PCU_TgVEC_M) pvLength, V(C_TgVEC_M) v0, V(C_TgVEC_M) v1 )
{
    V(TgVEC)                          vResult;
    TYPE                               fLength;

    vResult = V(F_UCX_LEN)( &fLength, (V(CP_TgVEC))&v0, (V(CP_TgVEC))&v1 );
    *pvLength = V(FS_SET1)( fLength ).m_mData;

    return vResult.m_mData;
}


/* ---- V(M_PRX3) ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgBOOL V(M_PRX3)( V(C_TgVEC_M) v0, V(C_TgVEC_M) v1 )
{
    return V(F_PRX3)( (V(CP_TgVEC))&v0, (V(CP_TgVEC))&v1 );
}


/* ---- V(M_PRX4) ------------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgBOOL V(M_PRX4)( V(C_TgVEC_M) v0, V(C_TgVEC_M) v1 )
{
    return V(F_PRX4)( (V(CP_TgVEC))&v0, (V(CP_TgVEC))&v1 );
}


/* ---- V(M_QT_INV) ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_QT_INV)( V(C_TgVEC_M) qR1 )
{
    V(TgVEC) vResult = V(F_QT_INV)( (V(CP_TgVEC))&qR1 );
    return vResult.m_mData;
}


/* ---- V(M_QT_MUL) ---------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_QT_MUL)( V(C_TgVEC_M) qR1, V(C_TgVEC_M) qR2 )
{
    V(TgVEC) vResult = V(F_QT_MUL)( (V(CP_TgVEC))&qR1, (V(CP_TgVEC))&qR2 );
    return vResult.m_mData;
}


/* ---- V(M_QT_SLERP) -------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_QT_SLERP)( V(C_TgVEC_M) vdT, V(C_TgVEC_M) qR1, V(C_TgVEC_M) qR2 )
{
    V(TgVEC) vResult = V(F_QT_SLERP)( ((V(CP_TgVEC))&vdT)->m_aData[0], (V(CP_TgVEC))&qR1, (V(CP_TgVEC))&qR2 );
    return vResult.m_mData;
}


/* ---- V(M_QT_VECTOR_TO_VECTOR) --------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_QT_VECTOR_TO_VECTOR)( V(C_TgVEC_M) vFrom, V(C_TgVEC_M) vTo )
{
    V(TgVEC) vResult = V(F_QT_VECTOR_TO_VECTOR)( (V(CP_TgVEC))&vFrom, (V(CP_TgVEC))&vTo );
    return vResult.m_mData;
}


/* ---- V(M_QT_TX) ----------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_QT_TX)( V(C_TgVEC_M) vV0, V(C_TgVEC_M) qR0 )
{
    V(TgVEC) vResult = V(F_QT_TX)( (V(CP_TgVEC))&vV0, (V(CP_TgVEC))&qR0);
    return vResult.m_mData;
}


/* ---- V(M_QT_INV_TX) ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC_M) V(M_QT_INV_TX)( V(C_TgVEC_M) vV0, V(C_TgVEC_M) qR0)
{
    V(TgVEC) vResult = V(F_QT_INV_TX)( (V(CP_TgVEC))&vV0, (V(CP_TgVEC))&qR0);
    return vResult.m_mData;
}