25 #ifdef BT_USE_DOUBLE_PRECISION    26 #define btVector3Data btVector3DoubleData    27 #define btVector3DataName "btVector3DoubleData"    29 #define btVector3Data btVector3FloatData    30 #define btVector3DataName "btVector3FloatData"    31 #endif //BT_USE_DOUBLE_PRECISION    33 #if defined BT_USE_SSE    38 #pragma warning(disable: 4556) // value of intrinsic immediate argument '4294967239' is out of range '0 - 255'    42 #define BT_SHUFFLE(x,y,z,w) ((w)<<6 | (z)<<4 | (y)<<2 | (x))    44 #define bt_pshufd_ps( _a, _mask ) _mm_shuffle_ps((_a), (_a), (_mask) )    45 #define bt_splat3_ps( _a, _i ) bt_pshufd_ps((_a), BT_SHUFFLE(_i,_i,_i, 3) )    46 #define bt_splat_ps( _a, _i )  bt_pshufd_ps((_a), BT_SHUFFLE(_i,_i,_i,_i) )    48 #define btv3AbsiMask (_mm_set_epi32(0x00000000, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF))    49 #define btvAbsMask (_mm_set_epi32( 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF))    50 #define btvFFF0Mask (_mm_set_epi32(0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF))    51 #define btv3AbsfMask btCastiTo128f(btv3AbsiMask)    52 #define btvFFF0fMask btCastiTo128f(btvFFF0Mask)    53 #define btvxyzMaskf btvFFF0fMask    54 #define btvAbsfMask btCastiTo128f(btvAbsMask)    57 #define btvMzeroMask (_mm_set_ps(-0.0f, -0.0f, -0.0f, -0.0f))    58 #define v1110            (_mm_set_ps(0.0f, 1.0f, 1.0f, 1.0f))    59 #define vHalf            (_mm_set_ps(0.5f, 0.5f, 0.5f, 0.5f))    60 #define v1_5             (_mm_set_ps(1.5f, 1.5f, 1.5f, 1.5f))    71 const float32x4_t 
ATTRIBUTE_ALIGNED16(btvMzeroMask) = (float32x4_t){-0.0f, -0.0f, -0.0f, -0.0f};
    73         static_cast<int32_t>(0xFFFFFFFF), 
static_cast<int32_t>(0xFFFFFFFF), 0x0};
    74 const int32x4_t 
ATTRIBUTE_ALIGNED16(btvAbsMask) = (int32x4_t){0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF};
    75 const int32x4_t 
ATTRIBUTE_ALIGNED16(btv3AbsMask) = (int32x4_t){0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x0};
    89 #if defined (__SPU__) && defined (__CELLOS_LV2__)    94                 return *((
const vec_float4*)&m_floats[0]);
    97 #else //__CELLOS_LV2__ __SPU__    98     #if defined (BT_USE_SSE) || defined(BT_USE_NEON) // _WIN32 || ARM   100             btSimdFloat4      mVec128;
   114 #endif //__CELLOS_LV2__ __SPU__   139 #if (defined (BT_USE_SSE_IN_API) && defined (BT_USE_SSE) )|| defined (BT_USE_NEON)   149                 mVec128 = rhs.mVec128;
   160 #endif // #if defined (BT_USE_SSE_IN_API) || defined (BT_USE_NEON)    166 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   167                 mVec128 = _mm_add_ps(mVec128, v.mVec128);
   168 #elif defined(BT_USE_NEON)   169                 mVec128 = vaddq_f32(mVec128, v.mVec128);
   183 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   184                 mVec128 = _mm_sub_ps(mVec128, v.mVec128);
   185 #elif defined(BT_USE_NEON)   186                 mVec128 = vsubq_f32(mVec128, v.mVec128);
   199 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   200                 __m128  vs = _mm_load_ss(&s);   
   201                 vs = bt_pshufd_ps(vs, 0x80);    
   202                 mVec128 = _mm_mul_ps(mVec128, vs);
   203 #elif defined(BT_USE_NEON)   204                 mVec128 = vmulq_n_f32(mVec128, s);
   219 #if 0 //defined(BT_USE_SSE_IN_API)   221                 __m128 vs = _mm_load_ss(&s);
   222                 vs = _mm_div_ss(v1110, vs);
   223                 vs = bt_pshufd_ps(vs, 0x00);    
   225                 mVec128 = _mm_mul_ps(mVec128, vs);
   237 #if defined BT_USE_SIMD_VECTOR3 && defined (BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   238                 __m128 vd = _mm_mul_ps(mVec128, v.mVec128);
   239                 __m128 z = _mm_movehl_ps(vd, vd);
   240                 __m128 y = _mm_shuffle_ps(vd, vd, 0x55);
   241                 vd = _mm_add_ss(vd, y);
   242                 vd = _mm_add_ss(vd, z);
   243                 return _mm_cvtss_f32(vd);
   244 #elif defined(BT_USE_NEON)   245                 float32x4_t vd = vmulq_f32(mVec128, v.mVec128);
   246                 float32x2_t x = vpadd_f32(vget_low_f32(vd), vget_low_f32(vd));  
   247                 x = vadd_f32(x, vget_high_f32(vd));
   248                 return vget_lane_f32(x, 0);
   250                 return  m_floats[0] * v.
m_floats[0] + 
   295                 int maxIndex = absVec.
maxAxis();
   296                 if (absVec[maxIndex]>0)
   298                         *
this /= absVec[maxIndex];
   312 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)             314                 __m128 vd = _mm_mul_ps(mVec128, mVec128);
   315                 __m128 z = _mm_movehl_ps(vd, vd);
   316                 __m128 y = _mm_shuffle_ps(vd, vd, 0x55);
   317                 vd = _mm_add_ss(vd, y);
   318                 vd = _mm_add_ss(vd, z);
   321         vd = _mm_sqrt_ss(vd);
   322                 vd = _mm_div_ss(v1110, vd);
   323                 vd = bt_splat_ps(vd, 0x80);
   324                 mVec128 = _mm_mul_ps(mVec128, vd);
   328         y = _mm_rsqrt_ss(vd); 
   332         vd = _mm_mul_ss(vd, vHalf); 
   334         vd = _mm_mul_ss(vd, y); 
   335         vd = _mm_mul_ss(vd, y); 
   336         z = _mm_sub_ss(z, vd);  
   338         y = _mm_mul_ss(y, z);   
   340                 y = bt_splat_ps(y, 0x80);
   341                 mVec128 = _mm_mul_ps(mVec128, y);
   373 #if defined BT_USE_SIMD_VECTOR3 && defined (BT_USE_SSE_IN_API) && defined (BT_USE_SSE)    374                 return btVector3(_mm_and_ps(mVec128, btv3AbsfMask));
   375 #elif defined(BT_USE_NEON)   389 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   392                 T = bt_pshufd_ps(mVec128, BT_SHUFFLE(1, 2, 0, 3));      
   393                 V = bt_pshufd_ps(v.mVec128, BT_SHUFFLE(1, 2, 0, 3));    
   395                 V = _mm_mul_ps(V, mVec128);
   396                 T = _mm_mul_ps(T, v.mVec128);
   397                 V = _mm_sub_ps(V, T);
   399                 V = bt_pshufd_ps(V, BT_SHUFFLE(1, 2, 0, 3));
   401 #elif defined(BT_USE_NEON)   404                 float32x2_t Tlow = vget_low_f32(mVec128);
   405                 float32x2_t Vlow = vget_low_f32(v.mVec128);
   406                 T = vcombine_f32(vext_f32(Tlow, vget_high_f32(mVec128), 1), Tlow);
   407                 V = vcombine_f32(vext_f32(Vlow, vget_high_f32(v.mVec128), 1), Vlow);
   409                 V = vmulq_f32(V, mVec128);
   410                 T = vmulq_f32(T, v.mVec128);
   412                 Vlow = vget_low_f32(V);
   414                 V = vcombine_f32(vext_f32(Vlow, vget_high_f32(V), 1), Vlow);
   415                 V = (float32x4_t)vandq_s32((int32x4_t)V, btvFFF0Mask);
   428 #if defined BT_USE_SIMD_VECTOR3 && defined (BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   430                 __m128 T = _mm_shuffle_ps(v1.mVec128, v1.mVec128, BT_SHUFFLE(1, 2, 0, 3));      
   431                 __m128 V = _mm_shuffle_ps(v2.mVec128, v2.mVec128, BT_SHUFFLE(1, 2, 0, 3));      
   433                 V = _mm_mul_ps(V, v1.mVec128);
   434                 T = _mm_mul_ps(T, v2.mVec128);
   435                 V = _mm_sub_ps(V, T);
   437                 V = _mm_shuffle_ps(V, V, BT_SHUFFLE(1, 2, 0, 3));
   440                 V = _mm_mul_ps(V, mVec128);
   441                 __m128 z = _mm_movehl_ps(V, V);
   442                 __m128 y = _mm_shuffle_ps(V, V, 0x55);
   443                 V = _mm_add_ss(V, y);
   444                 V = _mm_add_ss(V, z);
   445                 return _mm_cvtss_f32(V);
   447 #elif defined(BT_USE_NEON)   451                 float32x2_t Tlow = vget_low_f32(v1.mVec128);
   452                 float32x2_t Vlow = vget_low_f32(v2.mVec128);
   453                 T = vcombine_f32(vext_f32(Tlow, vget_high_f32(v1.mVec128), 1), Tlow);
   454                 V = vcombine_f32(vext_f32(Vlow, vget_high_f32(v2.mVec128), 1), Vlow);
   456                 V = vmulq_f32(V, v1.mVec128);
   457                 T = vmulq_f32(T, v2.mVec128);
   459                 Vlow = vget_low_f32(V);
   461                 V = vcombine_f32(vext_f32(Vlow, vget_high_f32(V), 1), Vlow);
   464                 V = vmulq_f32(mVec128, V);
   465                 float32x2_t x = vpadd_f32(vget_low_f32(V), vget_low_f32(V));  
   466                 x = vadd_f32(x, vget_high_f32(V));
   467                 return vget_lane_f32(x, 0);
   480                 return m_floats[0] < m_floats[1] ? (m_floats[0] <m_floats[2] ? 0 : 2) : (m_floats[1] <m_floats[2] ? 1 : 2);
   487                 return m_floats[0] < m_floats[1] ? (m_floats[1] <m_floats[2] ? 2 : 1) : (m_floats[0] <m_floats[2] ? 2 : 0);
   492                 return absolute().minAxis();
   497                 return absolute().maxAxis();
   503 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   504                 __m128  vrt = _mm_load_ss(&rt); 
   506                 __m128  vs = _mm_load_ss(&s);   
   507                 vs = bt_pshufd_ps(vs, 0x80);    
   508                 __m128 r0 = _mm_mul_ps(v0.mVec128, vs);
   509                 vrt = bt_pshufd_ps(vrt, 0x80);  
   510                 __m128 r1 = _mm_mul_ps(v1.mVec128, vrt);
   511                 __m128 tmp3 = _mm_add_ps(r0,r1);
   513 #elif defined(BT_USE_NEON)   514                 float32x4_t vl = vsubq_f32(v1.mVec128, v0.mVec128);
   515                 vl = vmulq_n_f32(vl, rt);
   516                 mVec128 = vaddq_f32(vl, v0.mVec128);
   532 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   533                 __m128  vt = _mm_load_ss(&t);   
   534                 vt = bt_pshufd_ps(vt, 0x80);    
   535                 __m128 vl = _mm_sub_ps(v.mVec128, mVec128);
   536                 vl = _mm_mul_ps(vl, vt);
   537                 vl = _mm_add_ps(vl, mVec128);
   540 #elif defined(BT_USE_NEON)   541                 float32x4_t vl = vsubq_f32(v.mVec128, mVec128);
   542                 vl = vmulq_n_f32(vl, t);
   543                 vl = vaddq_f32(vl, mVec128);
   549                                                 m_floats[1] + (v.
m_floats[1] - m_floats[1]) * t,
   550                                                 m_floats[2] + (v.
m_floats[2] - m_floats[2]) * t);
   558 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   559                 mVec128 = _mm_mul_ps(mVec128, v.mVec128);
   560 #elif defined(BT_USE_NEON)   561                 mVec128 = vmulq_f32(mVec128, v.mVec128);
   601 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   602         return (0xf == _mm_movemask_ps((__m128)_mm_cmpeq_ps(mVec128, other.mVec128)));
   604                 return ((m_floats[3]==other.
m_floats[3]) && 
   613                 return !(*
this == other);
   621 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   622                 mVec128 = _mm_max_ps(mVec128, other.mVec128);
   623 #elif defined(BT_USE_NEON)   624                 mVec128 = vmaxq_f32(mVec128, other.mVec128);
   638 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   639                 mVec128 = _mm_min_ps(mVec128, other.mVec128);
   640 #elif defined(BT_USE_NEON)   641                 mVec128 = vminq_f32(mVec128, other.mVec128);
   660 #if defined BT_USE_SIMD_VECTOR3 && defined (BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   662                 __m128 V  = _mm_and_ps(mVec128, btvFFF0fMask);
   663                 __m128 V0 = _mm_xor_ps(btvMzeroMask, V);
   664                 __m128 V2 = _mm_movelh_ps(V0, V);
   666                 __m128 V1 = _mm_shuffle_ps(V, V0, 0xCE);
   668         V0 = _mm_shuffle_ps(V0, V, 0xDB);
   669                 V2 = _mm_shuffle_ps(V2, V, 0xF9);
   683 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   684                 mVec128 = (__m128)_mm_xor_ps(mVec128, mVec128);
   685 #elif defined(BT_USE_NEON)   686                 int32x4_t vi = vdupq_n_s32(0); 
   687                 mVec128 = vreinterpretq_f32_s32(vi);
   731 #if defined BT_USE_SIMD_VECTOR3 && defined (BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   733         __m128 a0 = _mm_mul_ps( v0.mVec128, this->mVec128 );
   734         __m128 a1 = _mm_mul_ps( v1.mVec128, this->mVec128 );
   735         __m128 a2 = _mm_mul_ps( v2.mVec128, this->mVec128 );
   736         __m128 b0 = _mm_unpacklo_ps( a0, a1 );
   737         __m128 b1 = _mm_unpackhi_ps( a0, a1 );
   738         __m128 b2 = _mm_unpacklo_ps( a2, _mm_setzero_ps() );
   739         __m128 r = _mm_movelh_ps( b0, b2 );
   740         r = _mm_add_ps( r, _mm_movehl_ps( b2, b0 ));
   741         a2 = _mm_and_ps( a2, btvxyzMaskf);
   742         r = _mm_add_ps( r, btCastdTo128f (_mm_move_sd( btCastfTo128d(a2), btCastfTo128d(b1) )));
   745 #elif defined(BT_USE_NEON)   746         static const uint32x4_t xyzMask = (
const uint32x4_t){ 
static_cast<uint32_t>(-1), static_cast<uint32_t>(-1), 
static_cast<uint32_t>(-1), 0 };
   747         float32x4_t a0 = vmulq_f32( v0.mVec128, this->mVec128);
   748         float32x4_t a1 = vmulq_f32( v1.mVec128, this->mVec128);
   749         float32x4_t a2 = vmulq_f32( v2.mVec128, this->mVec128);
   750         float32x2x2_t zLo = vtrn_f32( vget_high_f32(a0), vget_high_f32(a1));
   751         a2 = (float32x4_t) vandq_u32((uint32x4_t) a2, xyzMask );
   752         float32x2_t b0 = vadd_f32( vpadd_f32( vget_low_f32(a0), vget_low_f32(a1)), zLo.val[0] );
   753         float32x2_t b1 = vpadd_f32( vpadd_f32( vget_low_f32(a2), vget_high_f32(a2)), vdup_n_f32(0.0f));
   754         return btVector3( vcombine_f32(b0, b1) );
   765 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   766         return btVector3(_mm_add_ps(v1.mVec128, v2.mVec128));
   767 #elif defined(BT_USE_NEON)   768         return btVector3(vaddq_f32(v1.mVec128, v2.mVec128));
   781 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   782         return btVector3(_mm_mul_ps(v1.mVec128, v2.mVec128));
   783 #elif defined(BT_USE_NEON)   784         return btVector3(vmulq_f32(v1.mVec128, v2.mVec128));
   797 #if defined BT_USE_SIMD_VECTOR3 && (defined(BT_USE_SSE_IN_API)  && defined(BT_USE_SSE))   800         __m128 r = _mm_sub_ps(v1.mVec128, v2.mVec128);
   801         return btVector3(_mm_and_ps(r, btvFFF0fMask));
   802 #elif defined(BT_USE_NEON)   803         float32x4_t r = vsubq_f32(v1.mVec128, v2.mVec128);
   804         return btVector3((float32x4_t)vandq_s32((int32x4_t)r, btvFFF0Mask));
   817 #if defined BT_USE_SIMD_VECTOR3 && (defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE))   818         __m128 r = _mm_xor_ps(v.mVec128, btvMzeroMask);
   819         return btVector3(_mm_and_ps(r, btvFFF0fMask)); 
   820 #elif defined(BT_USE_NEON)   821         return btVector3((btSimdFloat4)veorq_s32((int32x4_t)v.mVec128, (int32x4_t)btvMzeroMask));
   831 #if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   832         __m128  vs = _mm_load_ss(&s);   
   833         vs = bt_pshufd_ps(vs, 0x80);    
   834         return btVector3(_mm_mul_ps(v.mVec128, vs));
   835 #elif defined(BT_USE_NEON)   836         float32x4_t r = vmulq_n_f32(v.mVec128, s);
   837         return btVector3((float32x4_t)vandq_s32((int32x4_t)r, btvFFF0Mask));
   855 #if 0 //defined(BT_USE_SSE_IN_API)   857         __m128 vs = _mm_load_ss(&s);
   858     vs = _mm_div_ss(v1110, vs);
   859         vs = bt_pshufd_ps(vs, 0x00);    
   861         return btVector3(_mm_mul_ps(v.mVec128, vs));
   871 #if defined BT_USE_SIMD_VECTOR3 && (defined(BT_USE_SSE_IN_API)&& defined (BT_USE_SSE))   872         __m128 vec = _mm_div_ps(v1.mVec128, v2.mVec128);
   873         vec = _mm_and_ps(vec, btvFFF0fMask);
   875 #elif defined(BT_USE_NEON)   876         float32x4_t x, y, v, m;
   882         m = vrecpsq_f32(y, v);          
   884         m = vrecpsq_f32(y, v);          
   947         return v1.
lerp(v2, t);
   954         return (v - *
this).length2();
   959         return (v - *
this).length();
   973 #if defined BT_USE_SIMD_VECTOR3 && defined (BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   975     __m128 O = _mm_mul_ps(wAxis.mVec128, mVec128);
   977     __m128 C = wAxis.
cross( mVec128 ).mVec128;
   978         O = _mm_and_ps(O, btvFFF0fMask);
   981         __m128 vsin = _mm_load_ss(&ssin);       
   982     __m128 vcos = _mm_load_ss(&scos);   
   984         __m128 Y = bt_pshufd_ps(O, 0xC9);       
   985         __m128 Z = bt_pshufd_ps(O, 0xD2);       
   986         O = _mm_add_ps(O, Y);
   987         vsin = bt_pshufd_ps(vsin, 0x80);        
   988         O = _mm_add_ps(O, Z);
   989     vcos = bt_pshufd_ps(vcos, 0x80);    
   992         O = O * wAxis.mVec128; 
   993         __m128 X = mVec128 - O; 
  1005         _y = wAxis.
cross( *
this );
  1007         return ( o + _x * 
btCos( _angle ) + _y * 
btSin( _angle ) );
  1013 #if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON)  1014     #if defined _WIN32 || defined (BT_USE_SSE)  1015         const long scalar_cutoff = 10;
  1016         long _maxdot_large( 
const float *array, 
const float *vec, 
unsigned long array_count, 
float *dotOut );
  1017     #elif defined BT_USE_NEON  1018         const long scalar_cutoff = 4;
  1019         extern long (*_maxdot_large)( 
const float *array, 
const float *vec, 
unsigned long array_count, 
float *dotOut );
  1021     if( array_count < scalar_cutoff )   
  1027         for( i = 0; i < array_count; i++ )
  1041 #if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON)  1042     return _maxdot_large( (
float*) array, (
float*) &
m_floats[0], array_count, &dotOut );
  1048 #if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON)  1049     #if defined BT_USE_SSE  1050         const long scalar_cutoff = 10;
  1051         long _mindot_large( 
const float *array, 
const float *vec, 
unsigned long array_count, 
float *dotOut );
  1052     #elif defined BT_USE_NEON  1053         const long scalar_cutoff = 4;
  1054         extern long (*_mindot_large)( 
const float *array, 
const float *vec, 
unsigned long array_count, 
float *dotOut );
  1056         #error unhandled arch!  1059     if( array_count < scalar_cutoff )
  1066         for( i = 0; i < array_count; i++ )
  1081 #if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON)  1082     return _mindot_large( (
float*) array, (
float*) &
m_floats[0], array_count, &dotOut );
  1083 #endif//BT_USE_SIMD_VECTOR3  1100 #if (defined (BT_USE_SSE_IN_API)&& defined (BT_USE_SSE)) || defined (BT_USE_NEON)   1108                 mVec128 = rhs.mVec128;
  1114                 mVec128 = v.mVec128;
  1117 #endif // #if defined (BT_USE_SSE_IN_API) || defined (BT_USE_NEON)   1121 #if defined BT_USE_SIMD_VECTOR3 && defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)   1122                 return btVector4(_mm_and_ps(mVec128, btvAbsfMask));
  1123 #elif defined(BT_USE_NEON)  1198                 return absolute4().maxAxis4();
  1239         #ifdef BT_USE_DOUBLE_PRECISION  1240         unsigned char* dest = (
unsigned char*) &destVal;
  1241         unsigned char* src  = (
unsigned char*) &sourceVal;
  1251         unsigned char* dest = (
unsigned char*) &destVal;
  1252         unsigned char* src  = (
unsigned char*) &sourceVal;
  1257 #endif //BT_USE_DOUBLE_PRECISION  1262         for (
int i=0;i<4;i++)
  1274         for (
int i=0;i<4;i++)
  1278         vector = swappedVec;
  1286     btScalar a = n[1]*n[1] + n[2]*n[2];
  1298     btScalar a = n[0]*n[0] + n[1]*n[1];
  1325         for (
int i=0;i<4;i++)
  1331         for (
int i=0;i<4;i++)
  1339         for (
int i=0;i<4;i++)
  1345         for (
int i=0;i<4;i++)
  1353         for (
int i=0;i<4;i++)
  1359         for (
int i=0;i<4;i++)
  1363 #endif //BT_VECTOR3_H 
btScalar length(const btQuaternion &q)
Return the length of a quaternion. 
btVector3 & operator*=(const btVector3 &v)
Elementwise multiply this vector by the other. 
void deSerializeDouble(const struct btVector3DoubleData &dataIn)
btScalar norm() const
Return the norm (length) of the vector. 
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
btVector3 & operator+=(const btVector3 &v)
Add a vector to this one. 
btVector3 dot3(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2) const
btVector3 operator*(const btVector3 &v1, const btVector3 &v2)
Return the elementwise product of two vectors. 
btScalar btAngle(const btVector3 &v1, const btVector3 &v2)
Return the angle between two vectors. 
btScalar btSin(btScalar x)
btScalar length2() const
Return the length of the vector squared. 
void setZ(btScalar _z)
Set the z value. 
void deSerialize(const struct btVector3Data &dataIn)
void btPlaneSpace1(const T &n, T &p, T &q)
btScalar btSqrt(btScalar y)
void serializeFloat(struct btVector3FloatData &dataOut) const
btVector4(const btScalar &_x, const btScalar &_y, const btScalar &_z, const btScalar &_w)
#define SIMD_FORCE_INLINE
const btScalar & getY() const
Return the y value. 
long minDot(const btVector3 *array, long array_count, btScalar &dotOut) const
returns index of minimum dot product between this and vectors in array[] 
void btSwapScalarEndian(const btScalar &sourceVal, btScalar &destVal)
btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization ...
btVector3 & safeNormalize()
btVector3 & operator/=(const btScalar &s)
Inversely scale the vector. 
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1. 
btVector3 normalized() const
Return a normalized version of this vector. 
void serializeDouble(struct btVector3DoubleData &dataOut) const
void btSetMin(T &a, const T &b)
btVector3()
No initialization constructor. 
btVector3 btCross(const btVector3 &v1, const btVector3 &v2)
Return the cross product of two vectors. 
const btScalar & getZ() const
Return the z value. 
long maxDot(const btVector3 *array, long array_count, btScalar &dotOut) const
returns index of maximum dot product between this and vectors in array[] 
btScalar btDistance(const btVector3 &v1, const btVector3 &v2)
Return the distance between two vectors. 
void setX(btScalar _x)
Set the x value. 
int minAxis() const
Return the axis with the smallest value Note return values are 0,1,2 for x, y, or z...
const btScalar & x() const
Return the x value. 
btScalar distance2(const btVector3 &v) const
Return the distance squared between the ends of this and another vector This is symantically treating...
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector. 
void getSkewSymmetricMatrix(btVector3 *v0, btVector3 *v1, btVector3 *v2) const
btScalar dot(const btVector3 &v) const
Return the dot product. 
void setW(btScalar _w)
Set the w value. 
void setY(btScalar _y)
Set the y value. 
const btScalar & y() const
Return the y value. 
const btScalar & z() const
Return the z value. 
void btUnSwapVector3Endian(btVector3 &vector)
btUnSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization ...
const btScalar & w() const
Return the w value. 
btVector3 rotate(const btVector3 &wAxis, const btScalar angle) const
Return a rotated version of this vector. 
void btSetMax(T &a, const T &b)
btVector3 & operator*=(const btScalar &s)
Scale the vector. 
btVector3 can be used to represent 3D points and vectors. 
#define ATTRIBUTE_ALIGNED16(a)
btScalar btAcos(btScalar x)
btVector3 absolute() const
Return a vector will the absolute values of each element. 
void serialize(struct btVector3Data &dataOut) const
btVector4 absolute4() const
btScalar angle(const btVector3 &v) const
Return the angle between this and another vector. 
btVector3(const btScalar &_x, const btScalar &_y, const btScalar &_z)
Constructor from scalars. 
btVector3 operator+(const btVector3 &v1, const btVector3 &v2)
Return the sum of two vectors (Point symantics) 
btScalar distance(const btVector3 &v) const
Return the distance between the ends of this and another vector This is symantically treating the vec...
bool operator!=(const btVector3 &other) const
#define BT_DECLARE_ALIGNED_ALLOCATOR()
int maxAxis() const
Return the axis with the largest value Note return values are 0,1,2 for x, y, or z. 
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions. 
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors. 
void setMax(const btVector3 &other)
Set each element to the max of the current values and the values of another btVector3. 
void deSerializeFloat(const struct btVector3FloatData &dataIn)
btScalar btDistance2(const btVector3 &v1, const btVector3 &v2)
Return the distance squared between two vectors. 
btVector3 operator/(const btVector3 &v, const btScalar &s)
Return the vector inversely scaled by s. 
btVector3 operator-(const btVector3 &v1, const btVector3 &v2)
Return the difference between two vectors. 
void setInterpolate3(const btVector3 &v0, const btVector3 &v1, btScalar rt)
btScalar btTriple(const btVector3 &v1, const btVector3 &v2, const btVector3 &v3)
bool operator==(const btVector3 &other) const
btVector3 lerp(const btVector3 &v, const btScalar &t) const
Return the linear interpolation between this and another vector. 
btScalar triple(const btVector3 &v1, const btVector3 &v2) const
btVector3 & operator-=(const btVector3 &v)
Subtract a vector from this one. 
void btSwapVector3Endian(const btVector3 &sourceVec, btVector3 &destVec)
btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization ...
btVector3 lerp(const btVector3 &v1, const btVector3 &v2, const btScalar &t)
Return the linear interpolation between two vectors. 
const btScalar & getX() const
Return the x value. 
void setMin(const btVector3 &other)
Set each element to the min of the current values and the values of another btVector3. 
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btCos(btScalar x)
btScalar safeNorm() const
Return the norm (length) of the vector. 
btScalar length() const
Return the length of the vector. 
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z, const btScalar &_w)
Set x,y,z and zero w. 
btScalar btFabs(btScalar x)