Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Geometry 3D - Box.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_BX_Calc_Point) ------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC) V(tgGM_BX_Calc_Point)( V(CPCU_TgBOX) psBX1, const TYPE fC0, const TYPE fC1, const TYPE fC2 )
{
    V(C_TgVEC)                          tvE0 = V(F_MUL_SV)( fC0, psBX1->m.m.avAxis + 0 );
    V(C_TgVEC)                          tvE1 = V(F_MUL_SV)( fC1, psBX1->m.m.avAxis + 1 );
    V(C_TgVEC)                          tvE2 = V(F_MUL_SV)( fC2, psBX1->m.m.avAxis + 2 );
    V(C_TgVEC)                          tvA0 = V(F_ADD)( &tvE0, &psBX1->m.m.vOrigin );
    V(C_TgVEC)                          tvA1 = V(F_ADD)( &tvE1, &tvE2 );

    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fC0) && (F(tgPM_ABS)(fC0) <= MKL(1.0)));
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fC1) && (F(tgPM_ABS)(fC1) <= MKL( 1.0 )));
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fC2) && (F(tgPM_ABS)(fC2) <= MKL( 1.0 )));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1));

    return (V(F_ADD)( &tvA0, &tvA1) );
}


/* ---- V(tgGM_BX_Calc_Point_Index) ------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC) V(tgGM_BX_Calc_Point_Index)( V(CPCU_TgBOX) psBX1, C_TgSINT32 iFlag )
{
    const TYPE                          fT0 = (0 != (iFlag & 1)) ? psBX1->m_vExtent.m.x : -psBX1->m_vExtent.m.x;
    const TYPE                          fT1 = (0 != (iFlag & 2)) ? psBX1->m_vExtent.m.y : -psBX1->m_vExtent.m.y;
    const TYPE                          fT2 = (0 != (iFlag & 4)) ? psBX1->m_vExtent.m.z : -psBX1->m_vExtent.m.z;
    V(TgVEC)                            vResult;

    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1));

    vResult = V(F_MAD_SVV)( fT0, psBX1->m.m.avAxis + 0, &psBX1->m.m.vOrigin );
    vResult = V(F_MAD_SVV)( fT1, psBX1->m.m.avAxis + 1, &vResult );
    vResult = V(F_MAD_SVV)( fT2, psBX1->m.m.avAxis + 2, &vResult );

    return (vResult);
}


/* ---- V(tgGM_BX_Reset) ------------------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Reset)( V(PCU_TgBOX) psBX0 )
{
    psBX0->m.avData[0] = V(FS_SETV)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psBX0->m.avData[1] = V(FS_SETV)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psBX0->m.avData[2] = V(FS_SETV)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psBX0->m.avData[3] = V(FS_SETP)( MKL(0.0), MKL(0.0), MKL(0.0) );
    psBX0->m_vExtent = V(FS_SETV)( MKL(0.0), MKL(0.0), MKL(0.0) );
}


/* ---- V(tgGM_BX_Support_Point) ---------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(TgVEC) V(tgGM_BX_Support_Point)( V(CPCU_TgBOX) psBX1, V(CPCU_TgVEC) pvDN )
{
    const TYPE                          fDn_Ax0 = V(F_DOT)( pvDN, psBX1->m.m.avAxis + 0 );
    const TYPE                          fDn_Ax1 = V(F_DOT)( pvDN, psBX1->m.m.avAxis + 1 );
    const TYPE                          fDn_Ax2 = V(F_DOT)( pvDN, psBX1->m.m.avAxis + 2 );
    const TYPE                          fX0 = F(tgPM_FSEL)( fDn_Ax0, psBX1->m_vExtent.m.x, -psBX1->m_vExtent.m.x );
    const TYPE                          fX1 = F(tgPM_FSEL)( fDn_Ax1, psBX1->m_vExtent.m.y, -psBX1->m_vExtent.m.y );
    const TYPE                          fX2 = F(tgPM_FSEL)( fDn_Ax2, psBX1->m_vExtent.m.z, -psBX1->m_vExtent.m.z );
    const TYPE                          fT0 = F(tgCM_NR0)(fDn_Ax0) ? MKL(0.0) : fX0;
    const TYPE                          fT1 = F(tgCM_NR0)(fDn_Ax1) ? MKL(0.0) : fX1;
    const TYPE                          fT2 = F(tgCM_NR0)(fDn_Ax2) ? MKL(0.0) : fX2;

    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1));
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvDN));
    TgGEOM_ASSERT_PARAM(TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvDN)));

    return (V(tgGM_BX_Calc_Point)( psBX1, fT0, fT1, fT2 ) );
}


/* ---- V(tgGM_BX_Volume) ----------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_BX_Volume)( V(CPCU_TgBOX) psBX1 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1));
    return (MKL(8.0)*(psBX1->m_vExtent.m.x*psBX1->m_vExtent.m.y*psBX1->m_vExtent.m.z));
}


/* ---- V(tgGM_BX_Area) ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_BX_Area)( V(CPCU_TgBOX) psBX1 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1));

    return (MKL(8.0)*(
        psBX1->m_vExtent.m.x*psBX1->m_vExtent.m.x
        + psBX1->m_vExtent.m.y*psBX1->m_vExtent.m.y
        + psBX1->m_vExtent.m.z*psBX1->m_vExtent.m.z));
}


/* ---- V(tgGM_BX_Sweep_BA) --------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Sweep_BA)( V(PCU_TgBOXAA) psBA0, V(CPCU_TgBOX) psBX1, V(CPCU_TgVEC) pvDT )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1) && TgTRUE == V(F_Is_Vector_Valid)(pvDT));

    V(tgGM_BX_BA)( psBA0, psBX1 );
    V(tgGM_BA_Sweep)( psBA0, pvDT );
}


/* ---- V(tgGM_BX_Project) ---------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Project)( PCU_TYPE ptyMin, PCU_TYPE ptyMax, V(CPCU_TgBOX) psBX1, V(CPCU_TgVEC) pvDN )
{
    const TYPE                          fAx_X0 = V(F_DOT)( pvDN, psBX1->m.m.avAxis + 0 );
    const TYPE                          fAx_X1 = V(F_DOT)( pvDN, psBX1->m.m.avAxis + 1 );
    const TYPE                          fAx_X2 = V(F_DOT)( pvDN, psBX1->m.m.avAxis + 2 );
    const TYPE                          fAx_C0 = V(F_DOT)( pvDN, &psBX1->m.m.vOrigin );
    const TYPE                          fSUM = F(tgPM_ABS)( fAx_X0 + fAx_X1 + fAx_X2 );

    TgGEOM_ASSERT_PARAM(0 != ptyMin && 0 != ptyMax && TgTRUE == V(tgGM_BX_Is_Valid)(psBX1) && TgTRUE == V(F_Is_Vector_Valid)(pvDN));

    *ptyMin = fAx_C0 - fSUM;
    *ptyMax = fAx_C0 + fSUM;
}


/* ---- V(tgGM_BX_Is_Contained) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgBOOL V(tgGM_BX_Is_Contained)( V(CPCU_TgBOX) psBX1, V(CPCU_TgVEC) pvS0 )
{
    V(C_TgVEC)                          vDS = V(F_SUB)( pvS0, &psBX1->m.m.vOrigin );

    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1) && TgTRUE == V(F_Is_Point_Valid)( pvS0 ));

    return (
        (F(tgPM_ABS)(V(F_DOT)(&vDS, psBX1->m.m.avAxis + 0)) <= psBX1->m_vExtent.m.x) &&
        (F(tgPM_ABS)(V(F_DOT)(&vDS, psBX1->m.m.avAxis + 1)) <= psBX1->m_vExtent.m.y) &&
        (F(tgPM_ABS)(V(F_DOT)(&vDS, psBX1->m.m.avAxis + 2)) <= psBX1->m_vExtent.m.z) ? TgTRUE : TgFALSE
    );
}


/* ---- V(tgGM_BX_TX) --------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_TX)( V(PCU_TgBOX) psBX0, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != M34(F_NaN)(pxM0));

    psBX0->m.m.vOrigin = M34(F_TX_P)( pxM0, &psBX0->m.m.vOrigin );
    psBX0->m.m.avAxis[0] = M34(F_TX_V)( pxM0, psBX0->m.m.avAxis + 0 );
    psBX0->m.m.avAxis[1] = M34(F_TX_V)( pxM0, psBX0->m.m.avAxis + 1 );
    psBX0->m.m.avAxis[2] = M34(F_TX_V)( pxM0, psBX0->m.m.avAxis + 2 );
}


/* ---- V(tgGM_BX_Copy_TX) ---------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Copy_TX)( V(PCU_TgBOX) psBX0, V(CPCU_TgBOX) psBX1, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1) && !M34(F_NaN)(pxM0));

    psBX0->m.m.vOrigin = M34(F_TX_P)( pxM0, &psBX1->m.m.vOrigin );
    psBX0->m.m.avAxis[0] = M34(F_TX_V)( pxM0, psBX1->m.m.avAxis + 0 );
    psBX0->m.m.avAxis[1] = M34(F_TX_V)( pxM0, psBX1->m.m.avAxis + 1 );
    psBX0->m.m.avAxis[2] = M34(F_TX_V)( pxM0, psBX1->m.m.avAxis + 2 );
    psBX0->m_vExtent = psBX1->m_vExtent;
}


/* ---- V(tgGM_BX_Init_3D) ---------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Init_3D)( V(PCU_TgBOX) psBX0, M34(CPCU_TgMAT) pxTX, const TYPE fX, const TYPE fY, const TYPE fZ )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fX) && (fX > MKL(0.0)));
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fY) && (fY > MKL(0.0)));
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fZ) && (fZ > MKL(0.0)));

    V(tgGM_BX_Set_3D)( psBX0, pxTX );
    psBX0->m_vExtent = V(FS_SETV)( fX, fY, fZ );
}


/* ---- V(tgGM_BX_Copy) ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Copy)( V(PCU_TgBOX) psBX0, V(CPCU_TgBOX) psBX1 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)(psBX1));

    psBX0->m.m.avAxis[0] = psBX1->m.m.avAxis[0];
    psBX0->m.m.avAxis[1] = psBX1->m.m.avAxis[1];
    psBX0->m.m.avAxis[2] = psBX1->m.m.avAxis[2];
    psBX0->m.m.vOrigin = psBX1->m.m.vOrigin;
    psBX0->m_vExtent = psBX1->m_vExtent;
}


/* ---- V(tgGM_BX_Set_Origin) ------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Origin)( V(PCU_TgBOX) psBX0, V(CPCU_TgVEC) pvOrigin )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Point_Valid)(pvOrigin));
    psBX0->m.m.vOrigin = *pvOrigin;
}


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

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

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

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

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


/* ---- V(tgGM_BX_Set_Axis_Unit_Index) ---------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Axis_Unit_Index)( V(PCU_TgBOX) psBX0, C_TgSINT32 iIndex, V(CPCU_TgVEC) pvAxis )
{
    TgGEOM_ASSERT_PARAM(iIndex < 3 && TgTRUE == V(F_Is_Vector_Valid)(pvAxis) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvAxis)));
    psBX0->m.m.avAxis[iIndex] = *pvAxis;
}


/* ---- V(tgGM_BX_Set_Axis_Unit_0) -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Axis_Unit_0)( V(PCU_TgBOX) psBX0, V(CPCU_TgVEC) pvAxis )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvAxis) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvAxis)));
    psBX0->m.m.avAxis[0] = *pvAxis;
}


/* ---- V(tgGM_BX_Set_Axis_Unit_1) -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Axis_Unit_1)( V(PCU_TgBOX) psBX0, V(CPCU_TgVEC) pvAxis )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvAxis) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvAxis)));
    psBX0->m.m.avAxis[1] = *pvAxis;
}


/* ---- V(tgGM_BX_Set_Axis_Unit_2) -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Axis_Unit_2)( V(PCU_TgBOX) psBX0, V(CPCU_TgVEC) pvAxis )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(F_Is_Vector_Valid)(pvAxis) && TgTRUE == F(tgCM_NR1)(V(F_LSQ)(pvAxis)));
    psBX0->m.m.avAxis[2] = *pvAxis;
}


/* ---- V(tgGM_BX_Set_3D) ----------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_3D)( V(PCU_TgBOX) psBX0, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != M34(F_NaN)(pxM0));

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

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


/* ---- V(tgGM_BX_Set_Extent_List) -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Extent_List)( V(PCU_TgBOX) psBX0, V(CPCU_TgVEC) pvExtent )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(pvExtent->m.x) && (pvExtent->m.x > MKL(0.0)));
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(pvExtent->m.y) && (pvExtent->m.y > MKL(0.0)));
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(pvExtent->m.z) && (pvExtent->m.z > MKL(0.0)));

    psBX0->m_vExtent = *pvExtent;
}


/* ---- V(tgGM_BX_Set_Extent) ------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Extent)( V(PCU_TgBOX) psBX0, C_TgSINT32 iIndex, const TYPE fExtent )
{
    TgGEOM_ASSERT_PARAM(iIndex < 3 && TgTRUE != F(tgPM_NAN)(fExtent) && fExtent > MKL(0.0));
    psBX0->m_vExtent.m_aData[iIndex] = fExtent;
}


/* ---- V(tgGM_BX_Set_Extent_0) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Extent_0)( V(PCU_TgBOX) psBX0, const TYPE fExtent )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fExtent) && fExtent > MKL(0.0));
    psBX0->m_vExtent.m.x = fExtent;
}


/* ---- V(tgGM_BX_Set_Extent_1) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Extent_1)( V(PCU_TgBOX) psBX0, const TYPE fExtent )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fExtent) && fExtent > MKL(0.0));
    psBX0->m_vExtent.m.y = fExtent;
}


/* ---- V(tgGM_BX_Set_Extent_2) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Set_Extent_2)( V(PCU_TgBOX) psBX0, const TYPE fExtent )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != F(tgPM_NAN)(fExtent) && fExtent > MKL(0.0));
    psBX0->m_vExtent.m.z = fExtent;
}


/* ---- V(tgGM_BX_Query_Origin) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_BX_Query_Origin)( V(CPCU_TgBOX) psBX1 )
{
    return (&psBX1->m.m.vOrigin);
}


/* ---- V(tgGM_BX_Query_Axis_Unit) -------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_BX_Query_Axis_Unit)( V(CPCU_TgBOX) psBX1, C_TgSINT32 iIndex )
{
    return (&psBX1->m.m.avAxis[iIndex]);
}


/* ---- V(tgGM_BX_Query_Axis_Unit_0) ------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_BX_Query_Axis_Unit_0)( V(CPCU_TgBOX) psBX1 )
{
    return (&psBX1->m.m.avAxis[0]);
}


/* ---- V(tgGM_BX_Query_Axis_Unit_1) ------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_BX_Query_Axis_Unit_1)( V(CPCU_TgBOX) psBX1 )
{
    return (&psBX1->m.m.avAxis[1]);
}


/* ---- V(tgGM_BX_Query_Axis_Unit_2) ------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_BX_Query_Axis_Unit_2)( V(CPCU_TgBOX) psBX1 )
{
    return (&psBX1->m.m.avAxis[2]);
}


/* ---- V(tgGM_BX_Query_Extent_List) ------------------------------------------------------------------------------------------------------------------------------------ */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE V(CP_TgVEC) V(tgGM_BX_Query_Extent_List)( V(CPCU_TgBOX) psBX1 )
{
    return (&psBX1->m_vExtent);
}


/* ---- V(tgGM_BX_Query_Extent) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_BX_Query_Extent)( V(CPCU_TgBOX) psBX1, C_TgSINT32 iIndex )
{
    return (psBX1->m_vExtent.m_aData[iIndex]);
}


/* ---- V(tgGM_BX_Query_Extent_0) --------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_BX_Query_Extent_0)( V(CPCU_TgBOX) psBX1 )
{
    return (psBX1->m_vExtent.m.x);
}


/* ---- V(tgGM_BX_Query_Extent_1) --------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_BX_Query_Extent_1)( V(CPCU_TgBOX) psBX1 )
{
    return (psBX1->m_vExtent.m.y);
}


/* ---- V(tgGM_BX_Query_Extent_2) --------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TYPE V(tgGM_BX_Query_Extent_2)( V(CPCU_TgBOX) psBX1 )
{
    return (psBX1->m_vExtent.m.z);
}


#if defined(TgCOMPILE_NATIVE_VECTOR)

/* ---- V(tgGM_BX_M_TX) ------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_M_TX)( V(PCU_TgBOX) psBX0, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE != M34(F_NaN)( pxM0 ));
    psBX0->m.m.vOrigin.m_mData = M34(M_TX_P)( pxM0, psBX0->m.m.vOrigin.m_mData );
    psBX0->m.m.avAxis[0].m_mData = M34(M_TX_V)( pxM0, psBX0->m.m.avAxis[0].m_mData );
    psBX0->m.m.avAxis[1].m_mData = M34(M_TX_V)( pxM0, psBX0->m.m.avAxis[1].m_mData );
    psBX0->m.m.avAxis[2].m_mData = M34(M_TX_V)( pxM0, psBX0->m.m.avAxis[2].m_mData );
}


/* ---- V(tgGM_BX_Copy_M_TX) -------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID V(tgGM_BX_Copy_M_TX)( V(PCU_TgBOX) psBX0, V(CPCU_TgBOX) psBX1, M34(CPCU_TgMAT) pxM0 )
{
    TgGEOM_ASSERT_PARAM(TgTRUE == V(tgGM_BX_Is_Valid)( psBX1 ) && !M34(F_NaN)( pxM0 ));
    psBX0->m.m.vOrigin.m_mData = M34(M_TX_P)( pxM0, psBX1->m.m.vOrigin.m_mData );
    psBX0->m.m.avAxis[0].m_mData = M34(M_TX_V)( pxM0, psBX1->m.m.avAxis[0].m_mData );
    psBX0->m.m.avAxis[1].m_mData = M34(M_TX_V)( pxM0, psBX1->m.m.avAxis[1].m_mData );
    psBX0->m.m.avAxis[2].m_mData = M34(M_TX_V)( pxM0, psBX1->m.m.avAxis[2].m_mData );
    psBX0->m_vExtent = psBX1->m_vExtent;
}

/*# defined(TgCOMPILE_NATIVE_VECTOR) */
#endif