Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Geometry 3D - Tube.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 ============================================================================================================================================================ */

/* ---- V(tgGM_TB_Reset) ------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Reset)( V(PCU_TgTUBE) psTB0 )
{
    psTB0->m.m.vU_Basis0 = V(FS_SETV)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psTB0->m.m.vU_HAX = V(FS_SETV)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psTB0->m.m.vU_Basis1 = V(FS_SETV)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psTB0->m.m.vOrigin = V(FS_SETP)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psTB0->m_vHAX = V(FS_SETV)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psTB0->m_fExtent = MKL(0.0);
    psTB0->m_fRadius = MKL(0.0);
    psTB0->m_fRadiusSq = MKL(0.0);

    V(tgGM_SG_Reset)( &psTB0->m_sAX );
}


/* ---- V(tgGM_TB_Is_Valid) --------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgBOOL V(tgGM_TB_Is_Valid)( V(CPCU_TgTUBE) psTB1 )
{
    if (TgTRUE != V(F_Is_Point_Valid)(&psTB1->m.m.vOrigin) || TgTRUE != V(F_Is_Point_Valid)(&psTB1->m_sAX.m_vOrigin))
    {
        return (TgFALSE);
    };

    if (TgTRUE != V(F_Is_Vector_Valid)(&psTB1->m_sAX.m_vDirN) || TgTRUE == F(tgPM_NAN)(psTB1->m_fRadiusSq))
    {
        return (TgFALSE);
    };

    if (TgTRUE != V(F_Is_Vector_Valid)(&psTB1->m_vHAX) || TgTRUE != V(F_Is_Vector_Valid)(&psTB1->m.m.vU_HAX) || !(psTB1->m_fRadius > MKL(0.0)))
    {
        return (TgFALSE);
    };

    if (TgTRUE != V(F_Is_Vector_Valid)(&psTB1->m.m.vU_Basis0) || TgTRUE != V(F_Is_Vector_Valid)(&psTB1->m.m.vU_Basis1))
    {
        return (TgFALSE);
    };

    if (TgTRUE == F(tgPM_NAN)(psTB1->m_fExtent) || !(psTB1->m_fExtent > MKL(0.0)) || TgTRUE == F(tgPM_NAN)(psTB1->m_fRadius))
    {
        return (TgFALSE);
    };

    return (TgTRUE);
}


/* ---- V(tgGM_TB_TX) --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_TX)( V(PCU_TgTUBE) psTB0, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != M34(F_NaN)(pxM0));

    psTB0->m.m.vU_Basis0 = M34(F_TX_V)( pxM0, &psTB0->m.m.vU_Basis0 );
    psTB0->m.m.vU_HAX = M34(F_TX_V)( pxM0, &psTB0->m.m.vU_HAX );
    psTB0->m.m.vU_Basis1 = M34(F_TX_V)( pxM0, &psTB0->m.m.vU_Basis1 );
    psTB0->m.m.vOrigin = M34(F_TX_P)( pxM0, &psTB0->m.m.vOrigin );
    psTB0->m_vHAX = M34(F_TX_V)( pxM0, &psTB0->m_vHAX );

    {
        V(C_TgVEC)                          vS0 = V(F_SUB)( &psTB0->m.m.vOrigin, &psTB0->m_vHAX );
        V(C_TgVEC)                          vD0 = V(F_ADD)( &psTB0->m_vHAX, &psTB0->m_vHAX );

        V(tgGM_SG_Init)( &psTB0->m_sAX, &vS0, &vD0 );
    };
}


/* ---- V(tgGM_TB_Copy_TX) ---------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Copy_TX)( V(PCU_TgTUBE) psTB0, V(CPCU_TgTUBE) psTB1, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != M34(F_NaN)(pxM0));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_TB_Is_Valid)(psTB1));

    psTB0->m.m.vU_Basis0 = M34(F_TX_V)( pxM0, &psTB1->m.m.vU_Basis0 );
    psTB0->m.m.vU_HAX = M34(F_TX_V)( pxM0, &psTB1->m.m.vU_HAX );
    psTB0->m.m.vU_Basis1 = M34(F_TX_V)( pxM0, &psTB1->m.m.vU_Basis1 );
    psTB0->m.m.vOrigin = M34(F_TX_P)( pxM0, &psTB1->m.m.vOrigin );
    psTB0->m_vHAX = M34(F_TX_V)( pxM0, &psTB1->m_vHAX );
    psTB0->m_fExtent = psTB1->m_fExtent;
    psTB0->m_fRadius = psTB1->m_fRadius;
    psTB0->m_fRadiusSq = psTB1->m_fRadiusSq;

    {
        V(C_TgVEC)                          vS0 = V(F_SUB)( &psTB0->m.m.vOrigin, &psTB0->m_vHAX );
        V(C_TgVEC)                          vD0 = V(F_ADD)( &psTB0->m_vHAX, &psTB0->m_vHAX );

        V(tgGM_SG_Init)( &psTB0->m_sAX, &vS0, &vD0 );
    };
}


/* ---- V(tgGM_TB_Init) ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Init)( V(PCU_TgTUBE) psTB0, V(CPCU_TgVEC) pvUB0, V(CPCU_TgVEC) pvUAX, V(CPCU_TgVEC) pvUB1, V(CPCU_TgVEC) pvOG, const TYPE fExtent, const TYPE fRadius)
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvUB0) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvUB0)));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvUAX) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvUAX)));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvUB1) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvUB1)));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Point_Valid)(pvOG));
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fExtent) && (fExtent > MKL(0.0)) && TgTRUE != F(tgPM_NAN)(fRadius) && (fRadius > MKL(0.0)));

    psTB0->m.m.vU_Basis0 = *pvUB0;
    psTB0->m.m.vU_HAX = *pvUAX;
    psTB0->m.m.vU_Basis1 = *pvUB1;
    psTB0->m.m.vOrigin = *pvOG;
    psTB0->m_vHAX = V(F_MUL_VS)( &psTB0->m.m.vU_HAX, fExtent );
    psTB0->m_fExtent = fExtent;
    psTB0->m_fRadius = fRadius;
    psTB0->m_fRadiusSq = fRadius*fRadius;

    {
        V(C_TgVEC)                          vS0 = V(F_SUB)( &psTB0->m.m.vOrigin, &psTB0->m_vHAX );
        V(C_TgVEC)                          vD0 = V(F_ADD)( &psTB0->m_vHAX, &psTB0->m_vHAX );

        V(tgGM_SG_Init)( &psTB0->m_sAX, &vS0, &vD0 );
    };
}


/* ---- V(tgGM_TB_Init_3D) ---------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Init_3D)( V(PCU_TgTUBE) psTB0, M34(CPCU_TgMAT) pxM0, const TYPE fExtent, const TYPE fRadius )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fExtent) && (fExtent > MKL(0.0)));

    psTB0->m_fExtent = fExtent;
    V(tgGM_TB_Set_3D)( psTB0, pxM0 );
    V(tgGM_TB_Set_Radius)( psTB0, fRadius );
}


/* ---- V(tgGM_TB_Copy) ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Copy)( V(PCU_TgTUBE) psTB0, V(CPCU_TgTUBE) psTB1 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_TB_Is_Valid)(psTB1));

    psTB0->m.m.vU_Basis0 = psTB1->m.m.vU_Basis0;
    psTB0->m.m.vU_HAX = psTB1->m.m.vU_HAX;
    psTB0->m.m.vU_Basis1 = psTB1->m.m.vU_Basis1;
    psTB0->m.m.vOrigin = psTB1->m.m.vOrigin;
    psTB0->m_vHAX = psTB1->m_vHAX;
    psTB0->m_fExtent = psTB1->m_fExtent;
    psTB0->m_fRadius = psTB1->m_fRadius;
    psTB0->m_fRadiusSq = psTB1->m_fRadiusSq;

    V(tgGM_SG_Copy)( &psTB0->m_sAX, &psTB1->m_sAX );
}


/* ---- V(tgGM_TB_Set_Origin) ------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Origin)( V(PCU_TgTUBE) psTB0, V(CPCU_TgVEC) pvOrigin )
{
    V(C_TgVEC)                          vS0 = V(F_SUB)( pvOrigin, &psTB0->m_vHAX );

    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Point_Valid)(pvOrigin) && TgTRUE == V(F_Is_Point_Valid)(&vS0));

    psTB0->m.m.vOrigin = *pvOrigin;

    V(tgGM_SG_Set_Origin)( &psTB0->m_sAX, &vS0 );
}


/* ---- V(tgGM_TB_Set_Axes_Unit) ---------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Axes_Unit)( V(PCU_TgTUBE) psTB0, V(CPCU_TgVEC) pvB0, V(CPCU_TgVEC) pvAX, V(CPCU_TgVEC) pvB1 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvB0) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvB0)));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvAX) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvAX)));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvB1) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvB1)));

    psTB0->m.m.vU_Basis0 = *pvB0;
    psTB0->m.m.vU_HAX = *pvAX;
    psTB0->m.m.vU_Basis1 = *pvB1;
    psTB0->m_vHAX = V(F_MUL_VS)( pvAX, psTB0->m_fExtent );

    {
        V(C_TgVEC)                          vS0 = V(F_SUB)( &psTB0->m.m.vOrigin, &psTB0->m_vHAX );
        V(C_TgVEC)                          vD0 = V(F_ADD)( &psTB0->m_vHAX, &psTB0->m_vHAX );

        V(tgGM_SG_Init)( &psTB0->m_sAX, &vS0, &vD0 );
    };
}


/* ---- V(tgGM_TB_Set_Axes_Unit_3D) ------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Axes_Unit_3D)( V(PCU_TgTUBE) psTB0, M34(CPCU_TgMAT) pxM0 )
{
    V(C_TgVEC)                          vS0 = psTB0->m.avData[3];

    TgGEOM_ASSERT_PARAM(TgTRUE != M34(F_NaN)(pxM0));

    M34(F_TR)(&psTB0->m.xData, pxM0);

    psTB0->m.avData[3] = vS0;

    psTB0->m_vHAX = V(F_MUL_VS)( &psTB0->m.m.vU_HAX, psTB0->m_fExtent );

    {
        V(C_TgVEC)                          tvS1 = V(F_SUB)( &psTB0->m.m.vOrigin, &psTB0->m_vHAX );
        V(C_TgVEC)                          vD0 = V(F_ADD)( &psTB0->m_vHAX, &psTB0->m_vHAX );

        V(tgGM_SG_Init)( &psTB0->m_sAX, &tvS1, &vD0 );
    };
}


/* ---- V(tgGM_TB_Set_Half_Axis) ---------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Half_Axis)( V(PCU_TgTUBE) psTB0, V(CPCU_TgVEC) pvA )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvA));

    psTB0->m.m.vU_HAX = V(F_NORM_LEN)( &psTB0->m_fExtent, pvA );
    psTB0->m_vHAX = *pvA;
}


/* ---- V(tgGM_TB_Set_Axis_Unit) ---------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Axis_Unit)( V(PCU_TgTUBE) psTB0, V(CPCU_TgVEC) pvUA )
{
    TgGEOM_ASSERT_PARAM(F(tgCM_NR1)(V(F_LSQ)(pvUA)) && TgTRUE == V(F_Is_Vector_Valid)(pvUA));

    psTB0->m.m.vU_HAX = *pvUA;
    psTB0->m_vHAX = V(F_MUL_VS)( pvUA, psTB0->m_fExtent );

    {
        V(C_TgVEC)                          vS0 = V(F_SUB)( &psTB0->m.m.vOrigin, &psTB0->m_vHAX );
        V(C_TgVEC)                          vD0 = V(F_ADD)( &psTB0->m_vHAX, &psTB0->m_vHAX );

        V(tgGM_SG_Init)( &psTB0->m_sAX, &vS0, &vD0 );
    };
}


/* ---- V(tgGM_TB_Set_Basis_Unit_0) ------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Basis_Unit_0)( V(PCU_TgTUBE) psTB0, V(CPCU_TgVEC) pvUA )
{
    TgGEOM_ASSERT_PARAM(F(tgCM_NR1)(V(F_LSQ)(pvUA)) && TgTRUE == V(F_Is_Vector_Valid)(pvUA));
    psTB0->m.m.vU_Basis0 = *pvUA;
}


/* ---- V(tgGM_TB_Set_Basis_Unit_1) ------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Basis_Unit_1)( V(PCU_TgTUBE) psTB0, V(CPCU_TgVEC) pvUA )
{
    TgGEOM_ASSERT_PARAM(F(tgCM_NR1)(V(F_LSQ)(pvUA)) && TgTRUE == V(F_Is_Vector_Valid)(pvUA));
    psTB0->m.m.vU_Basis1 = *pvUA;
}


/* ---- V(tgGM_TB_Set_3D) ----------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_3D)( V(PCU_TgTUBE) psTB0, M34(CPCU_TgMAT) pxM0 )
{
    V(TgVEC)                            vS0;
    V(TgVEC)                            vD0;

    TgGEOM_ASSERT_PARAM(TgTRUE != M34(F_NaN)(pxM0));

    M34(F_TR)(&psTB0->m.xData, pxM0);

    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(psTB0->m.avData + 0) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(psTB0->m.avData + 0)));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(psTB0->m.avData + 1) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(psTB0->m.avData + 1)));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(psTB0->m.avData + 2) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(psTB0->m.avData + 2)));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Point_Valid)(psTB0->m.avData + 3));

    psTB0->m_vHAX = V(F_MUL_VS)( &psTB0->m.m.vU_HAX, psTB0->m_fExtent );

    vS0 = V(F_SUB)( &psTB0->m.m.vOrigin, &psTB0->m_vHAX );
    vD0 = V(F_ADD)( &psTB0->m_vHAX, &psTB0->m_vHAX );
    V(tgGM_SG_Init)( &psTB0->m_sAX, &vS0, &vD0 );
}


/* ---- V(tgGM_TB_Set_Extent) ------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Extent)( V(PCU_TgTUBE) psTB0, const TYPE fExtent )
{
    V(TgVEC)                            vS0;
    V(TgVEC)                            vD0;

    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fExtent) && fExtent > MKL(0.0));
    psTB0->m_fExtent = fExtent;
    psTB0->m_vHAX = V(F_MUL_VS)( &psTB0->m.m.vU_HAX, fExtent );

    vS0 = V(F_SUB)( &psTB0->m.m.vOrigin, &psTB0->m_vHAX );
    vD0 = V(F_ADD)( &psTB0->m_vHAX, &psTB0->m_vHAX );
    V(tgGM_SG_Init)( &psTB0->m_sAX, &vS0, &vD0 );
}


/* ---- V(tgGM_TB_Set_Radius) ------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Set_Radius)( V(PCU_TgTUBE) psTB0, const TYPE fRadius )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fRadius) && fRadius > MKL(0.0));
    psTB0->m_fRadius = fRadius;
    psTB0->m_fRadiusSq = fRadius * fRadius;
}


/* ---- V(tgGM_TB_Query_Origin) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_TB_Query_Origin)( V(CPCU_TgTUBE) psTB1 )
{
    return (&psTB1->m.m.vOrigin);
}


/* ---- V(tgGM_TB_Query_Half_Axis) -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_TB_Query_Half_Axis)( V(CPCU_TgTUBE) psTB1 )
{
    return (&psTB1->m_vHAX);
}


/* ---- V(tgGM_TB_Query_Segment) ---------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgSEGMENT) V(tgGM_TB_Query_Segment)( V(CPCU_TgTUBE) psTB1 )
{
    return (&psTB1->m_sAX);
}


/* ---- V(tgGM_TB_Query_Axis_Unit) -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_TB_Query_Axis_Unit)( V(CPCU_TgTUBE) psTB1 )
{
    return (&psTB1->m.m.vU_HAX);
}


/* ---- V(tgGM_TB_Query_Basis_Unit_0) ----------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_TB_Query_Basis_Unit_0)( V(CPCU_TgTUBE) psTB1 )
{
    return (&psTB1->m.m.vU_Basis0);
}


/* ---- V(tgGM_TB_Query_Basis_Unit_1) ----------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_TB_Query_Basis_Unit_1)( V(CPCU_TgTUBE) psTB1 )
{
    return (&psTB1->m.m.vU_Basis1);
}


/* ---- V(tgGM_TB_Query_Extent) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_TB_Query_Extent)( V(CPCU_TgTUBE) psTB1 )
{
    return (psTB1->m_fExtent);
}


/* ---- V(tgGM_TB_Query_Radius) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_TB_Query_Radius)( V(CPCU_TgTUBE) psTB1 )
{
    return (psTB1->m_fRadius);
}


/* ---- V(tgGM_TB_Query_Radius_Sq) -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_TB_Query_Radius_Sq)( V(CPCU_TgTUBE) psTB1 )
{
    return (psTB1->m_fRadiusSq);
}


#if defined(TgCOMPILE_NATIVE_VECTOR)

/* ---- V(tgGM_TB_M_TX) ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_M_TX)( V(PCU_TgTUBE) psTB0, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(!M34(F_NaN)( pxM0 ));

    psTB0->m.m.vU_Basis0.m_mData = M34(M_TX_V)( pxM0, psTB0->m.m.vU_Basis0.m_mData );
    psTB0->m.m.vU_HAX.m_mData = M34(M_TX_V)( pxM0, psTB0->m.m.vU_HAX.m_mData );
    psTB0->m.m.vU_Basis1.m_mData = M34(M_TX_V)( pxM0, psTB0->m.m.vU_Basis1.m_mData );
    psTB0->m.m.vOrigin.m_mData = M34(M_TX_P)( pxM0, psTB0->m.m.vOrigin.m_mData );
    psTB0->m_vHAX.m_mData = M34(M_TX_V)( pxM0, psTB0->m_vHAX.m_mData );
    psTB0->m_sAX.m_vOrigin.m_mData = V(M_SUB)( psTB0->m.m.vOrigin.m_mData, psTB0->m_vHAX.m_mData );
    psTB0->m_sAX.m_vDirN.m_mData = V(M_ADD)( psTB0->m_vHAX.m_mData, psTB0->m_vHAX.m_mData );
}


/* ---- V(tgGM_TB_Copy_M_TX) -------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_TB_Copy_M_TX)( V(PCU_TgTUBE) psTB0, V(CPCU_TgTUBE) psTB1, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != M34( F_NaN )(pxM0 ));

    psTB0->m.m.vU_Basis0.m_mData = M34(M_TX_V)( pxM0, psTB1->m.m.vU_Basis0.m_mData );
    psTB0->m.m.vU_HAX.m_mData = M34(M_TX_V)( pxM0, psTB1->m.m.vU_HAX.m_mData );
    psTB0->m.m.vU_Basis1.m_mData = M34(M_TX_V)( pxM0, psTB1->m.m.vU_Basis1.m_mData );
    psTB0->m.m.vOrigin.m_mData = M34(M_TX_P)( pxM0, psTB1->m.m.vOrigin.m_mData );
    psTB0->m_vHAX.m_mData = M34(M_TX_V)( pxM0, psTB1->m_vHAX.m_mData );
    psTB0->m_fExtent = psTB1->m_fExtent;
    psTB0->m_fRadius = psTB1->m_fRadius;
    psTB0->m_fRadiusSq = psTB1->m_fRadiusSq;
    psTB0->m_sAX.m_vOrigin.m_mData = V(M_SUB)( psTB1->m.m.vOrigin.m_mData, psTB1->m_vHAX.m_mData );
    psTB0->m_sAX.m_vDirN.m_mData = V(M_ADD)( psTB1->m_vHAX.m_mData, psTB1->m_vHAX.m_mData );
}

/*# defined(TgCOMPILE_NATIVE_VECTOR) */
#endif