Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Collision - F - Sphere-Linear.c_inc
    »Keywords«  Collision;Distance;Closest;Intersect;Penetrate;Sweep;Sphere;Line;Ray;Segment;
    »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".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */

MSVC_WARN_DISABLE_PUSH( 6235 ) /* Analysis - (<non-zero constant> || <expression>) is always a non-zero constant */


/*   Sphere Definition: |S(v) - C0| < R0                                                                                                                                  */
/*     Line Definition: L1(α) = P1 + α•D1 | α ε [ 0, 1]                                                                                                                   */
/*                                                                                                                                                                        */
/* Derivation: Let C0 be the centre of sphere S0 with radius R0                                                                                                           */
/*             Let L1 = P1 + α•D1 | α ε [ 0, 1]                                                                                                                           */
/*             Let Q1 = P1 + γ•D1 by the closest point of contact                                                                                                         */
/*             Let  V = C0 - Q1, the vector connecting the closest points of contact ( the minimal distance vector )                                                      */
/*                                                                                                                                                                        */
/* Minimal distance vector, by definition must be perpendicular to the line.                                                                                              */
/* Therefore, D1•v=0, DS=C0-P1, v=DS-γ•D1                                                                                                                                 */
/*                                                                                                                                                                        */
/*      0 = D1_(DS-γ•D1,DIM)                                                                                                                                              */
/*      0 = DS•D1-γ•D1•D1                                                                                                                                                 */
/*      γ = DS•D1 / D1•D1                                                                                                                                                 */
/*                                                                                                                                                                        */
/* However, we know that γ ε [ 0, 1], generating three cases:                                                                                                             */
/*                                                                                                                                                                        */
/* [1] γ ε (-∞, 0) || γ = 0                                                                                                                                               */
/*    Distance: The distance between P1 and C0                                                                                                                            */
/*       = (C0-P1)T_(C0-P1,DIM)                                                                                                                                           */
/*       = DS•DS                                                                                                                                                          */
/*                                                                                                                                                                        */
/* [2] γ ε [ 0, 1] || γ = (DS•D1) / (D1•D1)                                                                                                                               */
/*    Distance: The distance value would be || v ||.                                                                                                                      */
/*       = || v || = v•v = (DS-γ•D1)T_(DS-γ•D1,DIM)                                                                                                                       */
/*       = DS•DS + γ•γ•D1•D1 - 2•γ•DS•D1                                                                                                                                  */
/*       = DS•DS + γ_(γ•D1•D1 - 2•DS•D1,DIM)                                                                                                                              */
/*       = DS•DS + γ_((DS•D1 / D1•D1,DIM)•D1•D1 - 2•DS•D1)                                                                                                                */
/*       = DS•DS + γ_(DS•D1 - 2•DS•D1,DIM)                                                                                                                                */
/*       = DS•DS - γ_(DS•D1,DIM)                                                                                                                                          */
/*                                                                                                                                                                        */
/* [3] γ ε ( 1, ∞) || γ = 1                                                                                                                                               */
/*    Distance: The distance between P1+D1 and C0                                                                                                                         */
/*       = (C0-P1-D1)T_(C0-P1-D1,DIM)                                                                                                                                     */
/*       = (DS-D1)T_(DS-D1,DIM)                                                                                                                                           */
/*       = DS•DS - 2•DS•D1 + D1•D1                                                                                                                                        */
/*                                                                                                                                                                        */
/*    Form a right-sided triangle.                                                                                                                                        */
/*      (a) The hypotenuse is the sphere radius.                                                                                                                          */
/*      (b) The known edge is the segment from the centre of the sphere to the closest point on the line.                                                                 */
/*      (c) The length of the remaining side (along L1) is the distance from the point of closest proximity and the                                                       */
/*          points of contact between the sphere and the line.                                                                                                            */
/*                                                                                                                                                                        */
/*                              .(C0)                                                      .(C0)                                                                          */
/*                             /|\                                                        /|\                                                                             */
/*                            / | \                                                      / | \                                                                            */
/*                           /  |  \                                                    /  |  \                                                                           */
/*                          /   |   \                                                  /   |   \                                                                          */
/*                         /    |    \                                                /    |    \                                                                         */
/*                        /(R0) |     \(R0)                                 (R0)     /     |     \      (R0)                                                              */
/*                              |                                       .----.------/------.------\------.----> (D1)                                                      */
/*                              |                                      (P1) (Q2)   /      (Q1)     \    (Q3)                                                              */
/*           .------------.-----.--------------> (D1)                             /        |        \                                                                     */
/*          (P1)         (Q2)  (Q1)                                              /(R0)     |         \(R0)                                                                */
/*                                                                                                                                                                        */
/*   Contact can not occur under the following conditions:                                                                                                                */
/*    Given that the point on the line closest to the sphere centre is at γ = DS•D1 / D1•D1                                                                               */
/*    The squared distance of Q1-C0 is φ = DS•DS - γ•γ•D1•D1 = DS•DS - γ_(DS•D1,DIM)                                                                                      */
/*    Thus, if DS•DS - γ_(DS•D1,DIM) > R0•R0, intersection can not occur.                                                                                                 */
/*   Otherwise: Intersection has definitely occurred.                                                                                                                     */
/*     By definition (sphere) it is known that                                                                                                                            */
/*         R0•R0 = ||C0 - P1 - β•D1||, for β ε (-∞, ∞)                                                                                                                    */
/*               = ||DS - β•D1||                                                                                                                                          */
/*             0 = β•β•D1•D1 - β•2•DS•D1 + DS•DS - R0•R0                                                                                                                  */
/*         Solving using the quadratic formula                                                                                                                            */
/*             β = (2_(DS•D1,DIM) ± √(4_(DS•D1,DIM)T_(DS•D1,DIM) - 4_(D1•D1,DIM)(DS•DS - R0•R0))) / (2_(D1•D1,DIM))                                                       */
/*             β = ((DS•D1) ± √((DS•D1)T_(DS•D1,DIM) - (D1•D1)(DS•DS - R0•R0))) / (D1•D1)                                                                                 */
/*          If the discriminant ((DS•D1)T_(DS•D1,DIM) - (D1•D1)(DS•DS - R0•R0)) is zero, there is only                                                                    */
/*         one point of intersection                                                                                                                                      */
/*                                                                                                                                                                        */
/*                                                                                                                                                                        */
/*                                                                                                                                                                        */
/* Derivation: Let C0 be the centre of sphere S0 with radius R0                                                                                                           */
/*             Let L1 = P1 + α•D1 | α ε [ 0, 1]                                                                                                                           */
/*                                                                                                                                                                        */
/* R0² = |(P1 + α•D1) - C0|²                                                                                                                                              */
/*     = ((P1-C0) + α•D1) • ((P1-C0) + α•D1)                                                                                                                              */
/*     = (DS + α•D1)T_(DS + α•D1,DIM)                                                                                                                                     */
/*     = DS•DS + 2•α•D1•DS + α•α•D1•D1                                                                                                                                    */
/*                                                                                                                                                                        */
/* Solve for α                                                                                                                                                            */
/*     = (-2•D1•DS ± √(4_(D1•DS,DIM)T_(D1•DS,DIM) - 4•D1•D1•DS•DS)) / 2•D1•D1                                                                                             */
/*     = (-D1•DS ± √((D1•DS)T_(D1•DS,DIM) - D1•D1•DS•DS)) / D1•D1                                                                                                         */


/* == Collision ========================================================================================================================================================= */

/* ---- VI(tgCO_FI_SP_Intersect_LR) ------------------------------------------------------------------------------------------------------------------------------------- */
/* Input:  tgPacket: The current series of contact points for this query-series, and contact generation parameters.                                                       */
/* Input:  psSP0: Sphere primitive                                                                                                                                        */
/* Input:  vS0,vD0: Origin and Direction for Linear                                                                                                                       */
/* Output: tgPacket: Points of intersection between the two primitives are added to it                                                                                    */
/* Return: Result Code                                                                                                                                                    */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgRESULT VI(tgCO_FI_SP_Intersect_LR)( V(PC_STg2_CO_Packet) psPacket, V(CPC_TgSPHERE) psSP0, V(CPC_TgVEC) pvS0, V(CPC_TgVEC) pvD0 )
{
    TYPE                                fLN0, fLN1;
    V(TgVEC)                            vN0, vN1;
    V(P_STg2_CO_Contact)                psContact;
    TgRESULT                            iResult;

    /* Check to make sure that a valid contact, and contact packet exist. */

    if (0 == psPacket->m_niMaxContact || psPacket->m_niContact >= psPacket->m_niMaxContact || nullptr == psPacket->m_psContact)
    {
        return (KTgE_FAIL);
    };

    if (TgFAILED( iResult = VI(tgCO_FI_SP_Param_LR)(&fLN0, &fLN1, &vN0, &vN1, psSP0, pvS0, pvD0) ))
    {
        return (iResult);
    };

    /* Limit the variable to the cap regions */

    if (LN_CAP_0 && fLN0 < MKL(0.0))
    {
        if (fLN1 <= MKL(0.0))
        {
            return (KTgE_NO_INTERSECT);
        };

        if (LN_CAP_1 && fLN1 > MKL(1.0))
        {
            return (KTgE_NO_INTERSECT);
        };
    }
    else if (!LN_CAP_1 || fLN0 <= MKL(1.0))
    {
        V(C_TgVEC)                          vK0 = V(F_MUL_SV)(fLN0, pvD0);

        psContact = psPacket->m_psContact + psPacket->m_niContact;

        psContact->m_vS0 = V(F_ADD)(pvS0, &vK0);
        psContact->m_vN0 = vN0;
        psContact->m_fT0 = fLN0;
        psContact->m_fDepth = MKL(0.0);

        ++psPacket->m_niContact;
    };

    if (LN_CAP_1 && fLN1 > MKL(1.0))
    {
        if (fLN0 >= MKL(1.0))
        {
            return (KTgE_NO_INTERSECT);
        };
    }
    else
    {
        V(C_TgVEC)                          vK0 = V(F_MUL_SV)(fLN1, pvD0);

        if (psPacket->m_niContact >= psPacket->m_niMaxContact)
        {
            return (KTgE_MAX_CONTACTS);
        };

        psContact = psPacket->m_psContact + psPacket->m_niContact;

        psContact->m_vS0 = V(F_ADD)(pvS0, &vK0);
        psContact->m_vN0 = vN1;
        psContact->m_fT0 = fLN1;
        psContact->m_fDepth = MKL(0.0);

        ++psPacket->m_niContact;
    };

    return (KTgS_OK);
}


/* ---- VI(tgCO_FI_SP_Param_LR) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* Input:  psSP0: Sphere primitive                                                                                                                                        */
/* Input:  vS0,vD0: Origin and Direction for Linear                                                                                                                       */
/* Output: fLN0,fLN1: Parametric parameter to generate the two points of the linear in contact with the extended tube surface                                             */
/* Output: vN0, vN1: Tube surface normal at the points of contact between the two primitives                                                                              */
/* Return: Result Code                                                                                                                                                    */
/*   The internal functions do not clip the linear.  All passed in linears are treated as lines - the boolean markers are used to                                         */
/*  generate possible quick-out logic to avoid further processing.                                                                                                        */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgRESULT VI(tgCO_FI_SP_Param_LR)( TYPE *pfLN0, TYPE *pfLN1, V(PC_TgVEC) pvN0, V(PC_TgVEC) pvN1, V(CPC_TgSPHERE) psSP0, V(CPC_TgVEC) pvS0, V(CPC_TgVEC) pvD0 )
{
    V(C_TgVEC)                          vDS = V(F_SUB)(&psSP0->m_vOrigin, pvS0);
    const TYPE                          fD0_D0 = V(F_LSQ)(pvD0);
    const TYPE                          fDS_DS = V(F_LSQ)(&vDS);

    TgERROR( V(tgGM_SP_Is_Valid)(psSP0) && V(F_Is_Point_Valid)(pvS0) && V(F_Is_Vector_Valid)(pvD0) );

    if (fD0_D0 > F(KTgEPS))
    {   /* [1] [DS•DS - γ_(DS•D0,DIM)] */

        const TYPE                          fDS_D0 = V(F_DOT)(&vDS, pvD0);

        if (LN_CAP_0 && fDS_DS > psSP0->m_fRadiusSq && fDS_D0 < MKL(0.0))
        {
            return (KTgE_NO_INTERSECT);
        };

        if (LN_CAP_1 && fDS_DS > psSP0->m_fRadiusSq + fD0_D0)
        {
            return (KTgE_NO_INTERSECT);
        }
        else
        {
            const TYPE                          fInvD0_D0 = MKL(1.0) / fD0_D0;
            const TYPE                          fT0 = fDS_D0*fInvD0_D0;
            const TYPE                          fDSC = fDS_D0*fDS_D0 - fD0_D0*(fDS_DS - psSP0->m_fRadiusSq);

            if (fDSC > F(KTgEPS))
            {
                const TYPE                          fRoot = F(tgPM_SQRT)(fDSC)*fInvD0_D0;

                V(C_TgVEC)                          vK0 = V(F_SUB)(pvS0, &psSP0->m_vOrigin);
                V(C_TgVEC)                          vK1 = V(F_MUL_SV)(fT0 + fRoot, pvD0);
                V(C_TgVEC)                          vK2 = V(F_MUL_SV)(fT0 - fRoot, pvD0);
                V(C_TgVEC)                          vK3 = V(F_ADD)(&vK0, &vK1);
                V(C_TgVEC)                          vK4 = V(F_ADD)(&vK0, &vK2);

                *pvN0 = V(F_NORM)(&vK3);
                *pfLN0 = fT0 + fRoot;
                *pvN1 = V(F_NORM)(&vK4);
                *pfLN1 = fT0 - fRoot;

                return (KTgS_OK);
            }
            else if (fDSC > -F(KTgEPS))
            {
                V(C_TgVEC)                          vK0 = V(F_SUB)(pvS0, &psSP0->m_vOrigin);
                V(C_TgVEC)                          vK1 = V(F_MUL_SV)(fT0, pvD0);
                V(C_TgVEC)                          vK3 = V(F_ADD)(&vK0, &vK1);
                V(C_TgVEC)                          vK2 = V(F_NORM)(&vK3);

                *pvN0 = vK2;
                *pvN1 = vK2;
                *pfLN0 = *pfLN1 = fT0;

                return (KTgS_OK);
            };

            return (KTgE_NO_INTERSECT);
        };
    }
    else
    {
        if (fDS_DS > F(KTgEPS))
        {
            const TYPE                          fVal = psSP0->m_fRadiusSq / fDS_DS;

            if (F(tgCM_NR1)(fVal))
            {
                V(C_TgVEC)                          vK1 = V(F_SUB)(pvS0, &psSP0->m_vOrigin);
                V(C_TgVEC)                          vK0 = V(F_NORM)(&vK1);

                *pvN0 = vK0;
                *pvN1 = vK0;
                *pfLN0 = *pfLN1 = MKL(0.0);

                return (KTgS_OK);
            };
        };
    };

    return (KTgE_NO_INTERSECT);
}


/* ---- VI(tgCO_FI_SP_Penetrate_LR) ------------------------------------------------------------------------------------------------------------------------------------- */
/* Input:  tgPacket: The current series of contact points for this query-series, and contact generation parameters.                                                       */
/* Input:  vD0: Direction of the Linear                                                                                                                                   */
/* Input:  psSP0: Sphere primitive                                                                                                                                        */
/* Input:  vP1: Point of closest proximity to the sphere origin on the linear                                                                                             */
/* Input:  fDistSq: Minimal distance squared between the linear and sphere origin                                                                                         */
/* Output: tgPacket: Points of penetration between the two primitives are added to it                                                                                     */
/* Return: Result Code                                                                                                                                                    */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgRESULT VI(tgCO_FI_SP_Penetrate_LR)( V(PC_STg2_CO_Packet) psPacket, V(CPC_TgVEC) pvD0, V(CPC_TgSPHERE) psSP0, V(CPC_TgVEC) pvP1, const TYPE fDistSq )
{
    V(TgVEC)                            vNormal, vT0;
    TYPE                                fNM;
    V(P_STg2_CO_Contact)                psContact;

    if (fDistSq <= F(KTgEPS))
    {
        if (F(tgCM_NR0)(pvD0->m.z))
        {
            vNormal = V(FS_SETV)(-pvD0->m.y, pvD0->m.x, MKL(0.0));
        }
        else
        {
            vNormal = V(FS_SETV)(MKL(0.0), pvD0->m.z, -pvD0->m.y);
        };
        vNormal = V(F_NORM)(&vNormal);
        fNM = MKL(0.0);
    }
    else
    {
        V(C_TgVEC)                          vK0 = V(F_SUB)(&psSP0->m_vOrigin, pvP1);

        vNormal = V(F_NORM_LEN)(&fNM, &vK0);
    };

    psContact = psPacket->m_psContact + psPacket->m_niContact;

    vT0 = V(F_MUL_SV)(psSP0->m_fRadius, &vNormal);

    psContact->m_vS0 = V(F_SUB)(&psSP0->m_vOrigin, &vT0);
    psContact->m_vN0 = vNormal;
    psContact->m_fT0 = MKL(0.0);
    psContact->m_fDepth = psSP0->m_fRadius - fNM;

    ++psPacket->m_niContact;

    return (KTgS_OK);
}


/* ---- VI(tgCO_FI_SP_Sweep_LR) ----------------------------------------------------------------------------------------------------------------------------------------- */
/* Input:  tgPacket: The current series of contact points for this query-series, and contact generation parameters.                                                       */
/* Input:  fPM: Current normalized time of first contact.                                                                                                                 */
/* Input:  bP: If the swept primitives are in penetration, if true the function will return points of penetration.                                                        */
/* Input:  vS0,vD0: Origin and Direction for Linear                                                                                                                       */
/* Input:  psSP0: Sphere primitive                                                                                                                                        */
/* Input:  psDT: A structure holding the swept primitive displacement for the entire duration of the test period                                                          */
/* Output: tgPacket: Contact points are added or replace the current set depending on the time comparison and given parameters                                            */
/* Output: fPM: New normalized time of first contact                                                                                                                      */
/* Return: Result Code                                                                                                                                                    */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgRESULT VI(tgCO_FI_SP_Sweep_LR)( V(PC_STg2_CO_Packet) psPacket, TYPE *pfPM, V(CPC_TgVEC) pvS0, V(CPC_TgVEC) pvD0, V(CPC_TgSPHERE) psSP0, V(CPC_TgDELTA) psDT )
{
    TgPARAM_CHECK( V(tgGM_DT_Is_Valid)(psDT) && V(tgGM_SP_Is_Valid)(psSP0) );
    TgPARAM_CHECK( V(F_Is_Point_Valid)(pvS0) && V(F_Is_Vector_Valid)(pvD0) );

    if (0 == psPacket->m_niMaxContact || psPacket->m_niContact >= psPacket->m_niMaxContact || nullptr == psPacket->m_psContact)
    {
        return (KTgE_FAIL);
    }
    else
    {
        TYPE                                fLN1;
        const TYPE                          fDistSq = VI2(tgCO_F_LR,ParamSq_VT)( &fLN1, pvS0, pvD0, &psSP0->m_vOrigin );

        if (fDistSq <= psSP0->m_fRadiusSq)
        {
            C_TgBOOL                            bPenetrate = TgTRUE == psPacket->m_bReport_Penetration;
            V(C_TgVEC)                          vK1 = V(F_MUL_SV)(fLN1, pvD0);
            V(C_TgVEC)                          vK0 = V(F_ADD)(pvS0, &vK1);

            if (*pfPM > psPacket->m_fSweepTol)
            {
                psPacket->m_niContact = 0;
            };

            *pfPM = MKL(0.0);

            if (bPenetrate && KTgE_MAX_CONTACTS == VI(tgCO_FI_SP_Penetrate_LR)(psPacket, pvD0, psSP0, &vK0, fDistSq))
            {
                return (KTgE_MAX_CONTACTS);
            };

            return (KTgE_PREPENETRATION);
        }
        else
        {
            TYPE                                fExtent;
            V(TgVEC)                            vB0, vB1;
            V(TgTUBE)                           sTB0;
            V(STg2_CO_Packet)                   sTMP_Packet;
            V(STg2_CO_Contact)                  asTMP_Contact[2];
            TgRESULT                            iResult;

            V(C_TgVEC)                          vUD0 = V(F_NORM_LEN)(&fExtent, pvD0);

            fExtent *= MKL(0.5);

            V(F_Init_Basis_From_Vector)(&vB0, &vB1, &vUD0);

            V(tgGM_TB_Init)(&sTB0, &vB0, &vUD0, &vB1, pvS0, fExtent, psSP0->m_fRadius);

            sTMP_Packet.m_psContact = asTMP_Contact;
            sTMP_Packet.m_niContact = 0;
            sTMP_Packet.m_niMaxContact = 2;

            iResult = VI2(tgCO_FI_TB,Intersect_LR11)( &sTMP_Packet, MKL(0.0), &sTB0, &psSP0->m_vOrigin, &psDT->m_vDT );

            if (TgFAILED( iResult ))
            {
                return (iResult);
            }
            else
            {
                TYPE                                fMin = F(KTgMAX);
                TgSINT32                            iMin = -1;
                TgSINT32                            iIdx;
                V(P_STg2_CO_Contact)                psContact;

                for (iIdx = 0; iIdx < sTMP_Packet.m_niContact; ++iIdx)
                {
                    if (asTMP_Contact[iIdx].m_fT0 < fMin)
                    {
                        fMin = asTMP_Contact[iMin].m_fT0;
                        iMin = iIdx;
                    };
                };

                if (iMin < 0 || (fMin > *pfPM + psPacket->m_fSweepTol))
                {
                    return (KTgE_NO_INTERSECT);
                }
                else
                {
                    V(C_TgVEC)                          vK0 = V(F_MUL_SV)(psSP0->m_fRadius, &asTMP_Contact[iMin].m_vN0);

                    if (fMin < *pfPM - psPacket->m_fSweepTol)
                    {
                        psPacket->m_niContact = 0;
                        *pfPM = fMin;
                    };

                    psContact = psPacket->m_psContact + psPacket->m_niContact;

                    psContact->m_vS0 = V(F_SUB)(&asTMP_Contact[iMin].m_vS0, &vK0);
                    psContact->m_vN0 = asTMP_Contact[iMin].m_vN0;
                    psContact->m_fT0 = asTMP_Contact[iMin].m_fT0;
                    psContact->m_fDepth = MKL(0.0);
                    TgERROR( asTMP_Contact[iMin].m_fDepth == MKL(0.0) );

                    ++psPacket->m_niContact;

                    return (iResult);
                };
            };
        };
    };
}


MSVC_WARN_DISABLE_POP( 6235 )