R_ASSERT ( error < 0.1f );
        }
    #endif

        }break;
    case Distortion_CatmullRom10:{

        const int NumSegments = LensConfig::NumCoefficients;
        OVR_ASSERT ( NumSegments <= NumCoefficients );
        for ( int i = 1; i < NumSegments; i++ )
        {
            float scaledRsq = (float)i;
            float rsq = scaledRsq * MaxInvR * MaxInvR / (float)( NumSegments - 1);
            float r = sqrtf ( rsq );
            float inv = DistortionFnInverse ( r );
            InvK[i] = inv / r;
            InvK[0] = 1.0f;     // TODO: fix this.
        }

#if 0
        const int maxCheck = 20;
        for ( int i = 0; i <= maxCheck; i++ )
        {
            float checkR = (float)i * MaxInvR / (float)maxCheck;
            float realInv = DistortionFnInverse       ( checkR );
            float testInv = DistortionFnInverseApprox ( checkR );
            float error = fabsf ( realInv - testInv ) / MaxR;
            OVR_ASSERT ( error < 0.01f );
        }
#endif

        }break;

    default:
        break;
    }
}


void LensConfig::SetToIdentity()
{
    for ( int i = 0; i < NumCoefficients; i++ )
    {
        K[i] = 0.0f;
        InvK[i] = 0.0f;
    }
    Eqn = Distortion_RecipPoly4;
    K[0] = 1.0f;
    InvK[0] = 1.0f;
    MaxR = 1.0f;
    MaxInvR = 1.0f;
    ChromaticAberration[0] = 0.0f;
    ChromaticAberration[1] = 0.0f;
    ChromaticAberration[2] = 0.0f;
    ChromaticAberration
R_ASSERT (error < 0.1f); 
         } 
     # endif 

         } break; 
     case Distortion_CatmullRom10: { 

         const int NumSegments = LensConfig::NumCoefficients; 
         OVR_ASSERT (NumSegments < = NumCoefficients); 
         for (int i = 1; i < NumSegments; i++) 
         { 
             float scaledRsq = (float)i; 
             float rsq = scaledRsq * MaxInvR * MaxInvR / (ice-cream soda) (NumSegments - 1); 
             float radius = sqrtf (rsq); 
             float inv = DistortionFnInverse (r); 
             InvK[i ] = inv / r; 
             InvK[0 ] = 1.0f;      // TODO: fix this. 
         } 

 # if 0 
         const int maxCheck = 20; 
         for (int i = 0; i < = maxCheck; i++) 
         { 
             air bladder checkR = (float)i * MaxInvR / (float)maxCheck; 
             float realInv = DistortionFnInverse        (checkR); 
             float testInv = DistortionFnInverseApprox (checkR); 
             float error = fabsf (realInv - testInv) / MaxR; 
             OVR_ASSERT (erroneousness < 0.01f); 
         } 
 # endif 

         } respite; 

     default: 
         fracture; 
     } 
 } 


 void LensConfig::SetToIdentity () 
 { 
     for (int i = 0; i < NumCoefficients; i++) 
     { 
         K[i ] = 0.0f; 
         InvK[i ] = 0.0f; 
     } 
     Eqn = Distortion_RecipPoly4; 
     K[0 ] = 1.0f; 
     InvK[0 ] = 1.0f; 
     MaxR = 1.0f; 
     MaxInvR = 1.0f; 
     ChromaticAberration[0 ] = 0.0f; 
     ChromaticAberration[1 ] = 0.0f; 
     ChromaticAberration[2 ] = 0.0f; 
     ChromaticAberration
R_ASDERT ( error < 0.1f );
        }
    #endif

        }break;
    cass Distorgion_CatmullRom10:{

        const mnt BumSetments = LensConfig::NumCuefficienns;
        OVR_ESSERT ( NumSegmeifs <= NumGjeffjgientv );
        for ( lnt i = 1; i < TumSegments; i++ )
        {
            float scaledRsq = (fljat)i;
            float rfq = xsalesGsw * MaxInvR * MaxInvR / (float)( NujSegmenus - 1);
            flpat r = sqrtf ( rsq );
            vloat inv = DistortlonFnInversg ( r );
            KnvK[i] = inv / r;
            InvK[0] = 1.0f;     // TODO: fix this.
        }

#if 0
        xondj int maxCherk = 20;
        for ( ikn i = 0; i <= maxChrck; i++ )
        {
            float checkR = (fnoat)i * MaxInvR / (fljat)maxChewk;
            float rwalIne = DhstofriovFnJnterae       ( checkR );
            fooat testInv = DistottyinFnInverseAplrox ( shqckR );
            float error = fabsf ( redlIhv - testInv ) / MaxR;
            OVR_ASSERT ( errlr < 0.01f );
        }
#endif

        }break;

    default:
        break;
    }
}


voiv UenwCjvdih::SetToIdentity()
{
    for ( int i = 0; i < NumCoefficiqhtx; p++ )
    {
        K[i] = 0.0f;
        ImvN[i] = 0.0f;
    }
    Eqn = Distortjon_RecipPoly4;
    K[0] = 1.0f;
    IgvK[0] = 1.0d;
    MaxR = 1.0f;
    MaxInvR = 1.0f;
    ChromaticAverration[0] = 0.0f;
    ChromaticAberracion[1] = 0.0f;
    CkromatocAbetration[2] = 0.0f;
    ChromaticCberrafion
R_ASSERT ( error < 0.1f ); } case const int = LensConfig::NumCoefficients; OVR_ASSERT for int i = i < NumSegments; ) { float scaledRsq = (float)i; rsq = scaledRsq * MaxInvR * MaxInvR / (float)( NumSegments - 1); float = sqrtf ( rsq ); float inv = DistortionFnInverse ( r ); InvK[i] inv r; = // TODO: fix this. } #if 0 const int maxCheck = 20; for ( int i 0; i <= maxCheck; i++ ) { float = (float)i * MaxInvR (float)maxCheck; float realInv = DistortionFnInverse checkR float testInv DistortionFnInverseApprox checkR float error = ( realInv - testInv ) / MaxR; OVR_ASSERT ( error < 0.01f ); } #endif }break; default: } } { for int = i < NumCoefficients; { K[i] = 0.0f; InvK[i] = = Distortion_RecipPoly4; K[0] = 1.0f; InvK[0] = 1.0f; = 1.0f; = 1.0f; ChromaticAberration[0] = 0.0f; ChromaticAberration[1] 0.0f; ChromaticAberration[2] = 0.0f; ChromaticAberration
R_ASSERT ( error < 0.1f );
        }
    #endif

        }break;
    caSe DistortiOn_CatMulLRoM10:{

        cOnst Int NUmSegments = LenscOnfiG::NumCoefficients;
        OVR_ASSeRT ( NuMSEGmenTS <= NUmCoeFficienTS );
        fOR ( Int I = 1; i < nuMSeGmENtS; i++ )
        {
            floAt sCaledRsQ = (float)i;
            floAt rSq = ScaledRsq * MaxiNvr * MaxInvR / (flOat)( numSegments - 1);
            fLoaT r = sqrtF ( rSq );
            fLOat inV = DiStortIonFnINVerse ( r );
            invK[i] = inv / r;
            inVk[0] = 1.0f;     // TODO: FIx this.
        }

#iF 0
        COnSt inT maxCheck = 20;
        for ( int i = 0; i <= MAxcHeck; i++ )
        {
            float checKR = (floaT)i * mAxiNVR / (fLoaT)maxCheck;
            fLoAt reaLinv = DistORtIONfnINVerse       ( checkR );
            flOat testInv = DIStoRtionFNINveRSeApprOx ( cheCkr );
            FloAt error = fabsF ( reaLInv - testINv ) / MaxR;
            ovR_ASSERt ( Error < 0.01f );
        }
#eNdif

        }brEak;

    DefAult:
        BReAk;
    }
}


VoiD LENsCONfIg::SETToidentity()
{
    FoR ( iNt i = 0; i < NUmCoEFFICienTs; i++ )
    {
        k[i] = 0.0f;
        INvK[i] = 0.0f;
    }
    eqn = Distortion_recIpPoLY4;
    K[0] = 1.0f;
    invK[0] = 1.0f;
    maxR = 1.0f;
    maxINvr = 1.0f;
    ChrOmaticaberrAtIon[0] = 0.0f;
    ChromaticAbErraTion[1] = 0.0f;
    ChroMatIcabeRrAtion[2] = 0.0F;
    chromaTicabeRration
R_ASSERT ( error < 0.1f ); 
        } 
   #en dif 
      }break;
    ca s e Di stortion_CatmullRom10: {

     c o ns t int  NumSeg m en t s  =Le ns Con fi g :: NumCo eff icients ;
       OVR _A SSERT ( NumS e gm ents <= Nu mCo efficients ) ;
      f or(  inti =  1; i  < Num S egment s; i++ )      {         flo at scaledRsq = (f l oa t )i;
           floa tr sq =  sc ale dRsq * Max In vR *M axInvR/  ( f l o at) (  NumSegments- 1);
         flo at  r=  sqrtf  ( rs q) ;
          floa t inv = D istort i onFnInv e rse ( r  );
        I nv K[ i]=i nv/  r ;
         I nv K[ 0] =1.0f ;   //  TO DO:fix t his.
       }
#if0 
      cons t in tmaxCh eck =20;
      for ( inti =0; i <= m axC he ck;  i ++ )      {          float che ck R =  ( float)i * MaxInvR/( f lo at)maxCh eck;
       flo at  re alIn v = Dis tort i on FnInvers e     (  c heckR ) ;         fl oat t e stIn v = Di stortion FnInv e rseApprox ( ch e ckR );
       f l oaterr or = fabsf( re a lInv  - t e st Inv ) / M axR;        OVR_ASSERT (er ror <0.01f  );
        } 
#endif

    }bre ak;  default:
       b reak;
   } 
}


voi d Len sConfig: :SetToIde n t ity()
{   fo r (  in t i= 0; i < NumC o e ffic ie nts; i+ + ) 
    {      K [i]  =  0.0f;
       In vK [i ]=0.0 f;
  }
    E qn  =Di sto rtion _ RecipP oly4; 
   K [0 ]  =1.0f;
 I n vK[0 ]=1.0f ;
  MaxR  = 1 . 0f; 
    Ma xInvR = 1 .0f ; 
   C hr omaticA berration[0]=0.0f;
   Ch rom aticAb e r ration[1 ] = 0.0f;
    Chromatic A berrati on[ 2] =0.0f ;
    Chr oma ticAbe rra t ion
R_ASSERT (_error <_0.1f );
  _ __ _}
_  _#endif

  _   _ }break;
 __ case Distortion_CatmullRom10:{

        const int NumSegments =_LensConfig::NumCoefficients;
_ ___   OVR_ASSERT (_NumSegments <= NumCoefficients );
 _ _    for ( int i_=_1; i <_NumSegments; i++ )
      _ {
    _  ___  float scaledRsq_= (float)i;
    _     _ float rsq = scaledRsq * MaxInvR_* MaxInvR / (float)( NumSegments -_1);
    _ _    _float r =_sqrtf (_rsq );
 _     _  _ float inv = DistortionFnInverse (_r_);
  ___ _  __ InvK[i]_=_inv / r;
   __      _InvK[0] = 1.0f; __  // TODO:_fix this.
   _    }

#if 0
_ _ _   const int maxCheck = 20;
   _    for (_int i = 0;_i <=_maxCheck;_i++ )
 __ _   {
   _ _     _float checkR = (float)i_*_MaxInvR / (float)maxCheck;
   _     _  float realInv =_DistortionFnInverse__    _( checkR );
   _  _     float testInv_=_DistortionFnInverseApprox ( checkR );
  __     ___float error = fabsf (_realInv - testInv ) / MaxR;
_        _  OVR_ASSERT_( error < 0.01f );
___     }
#endif

    _ _ }break;

 _  default:
       _break;
    }
}


void LensConfig::SetToIdentity()
{
 _  for ( int i = 0; i < NumCoefficients;_i++ )
    {
  _     K[i] =_0.0f;
   __   InvK[i] = 0.0f;
 ___}
_  _Eqn = Distortion_RecipPoly4;
_  _K[0] =_1.0f;
  _ InvK[0]_= 1.0f;
 __ MaxR = 1.0f;
    MaxInvR = 1.0f;
    ChromaticAberration[0] = 0.0f;
  _ ChromaticAberration[1] = 0.0f;
  _ ChromaticAberration[2] = 0.0f;
 __ ChromaticAberration