daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Aug 12th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const double Pi                    = 3.14159265358979323846264;
  2. const double TWO_Pi                = Pi*2.0;
  3. const double HALF_Pi            = Pi/2.0;
  4. const double QUARTER_Pi            = Pi/4.0;
  5. const double Deg2Rad            = Pi/180.0;
  6. const double Rad2Deg            = 180.0/Pi;
  7. const float  fDeg2Rad            = static_cast(Deg2Rad);
  8. const float  fRad2Deg            = static_cast(Rad2Deg);
  9. const double OneThird            = 1.0/3.0;
  10. const double One3point6th        = 1.0/3.6;
  11. const double OneTwelfth            = 1.0/12.0;
  12. const double OneThirtysixth        = 1.0/36.0;
  13. const double One1760th            = 1.0/1760;
  14. const double One5280th            = 1.0/5280;
  15. const double One63360th            = 1.0/63360.0;
  16. const double One25Pt4th            = 1.0/25.4;                // 0.0393700787401575        mm -> inches
  17. const double One2Pt54th            = 1.0/2.54;                // 0.393700787401575        cm -> inches
  18. const double OnePt0254th        = 1.0/0.0254;            // 39.3700787401575            m  -> inches
  19. const double OnePt0000254th        = 1.0/0.0000254;        // 39370.0787401575            km -> inches
  20. const double One2Pt20462262185th= 1.0/2.20462262185;    // 0.453592369999748        Lbs-> Kg
  21. const double One304Pt8th        = 1.0/304.8;            // 0.00328083989501312        mm -> feet
  22. const double One30Pt48th        = 1.0/30.48;            // 0.0328083989501312        cm -> feet
  23. const double OnePt3048th        = 1.0/.3048;            // 3.28083989501312            m  -> feet
  24. const double OnePt0003048th        = 1.0/.0003048;            // 3280.83989501312            km -> feet
  25. const double One914Pt4th        = 1.0/914.4;            // 0.00109361329833771        mm -> yards
  26. const double One91Pt44th        = 1.0/91.44;            // 0.0109361329833771        cm -> yards
  27. const double OnePt9144th        = 1.0/.9144;            // 1.09361329833771            m  -> yards
  28. const double OnePt0009144th        = 1.0/.0009144;            // 1093.61329833771            km -> yards
  29. const double One1609344th        = 1.0/1609344;            // 0.000000621371192237334    mm -> Miles
  30. const double One160934Pt4th        = 1.0/160934.4;            // 0.00000621371192237334    cm -> Miles
  31. const double One1609Pt344th        = 1.0/1609.344;            // 0.000621371192237334        m  -> Miles
  32. const double One1Pt609344th        = 1.0/1.609344;            // 0.621371192237334        km -> Miles
  33. const double One4Pt44822th        = 1.0/4.44822161525;    // 0.224808943100241        Nt -> LbForce
  34. const double OnePt737562th        = 1.0/0.7375621493;        // 1.35581794828961            FtLbs -> NtM
  35. const double OnePt44704th        = 1.0/0.44704;            // 2.2369362920544            Mps -> Mph
  36. const double One3Pt785411th        = 1.0/3.78541178401;    // 0.264172052357451        Liters -> Gallons
  37.  
  38. inline double Inches2Feet( const double &i )        { return i*OneTwelfth; }            // 1/12
  39. inline double Inches2Yards( const double &i )        { return i*OneThirtysixth; }        // 1/36
  40. inline double Inches2Miles( const double &i )        { return i*One63360th; }            // 1/63360.0
  41. inline double Inches2MM( const double &i )            { return i*25.4; }
  42. inline double Inches2CM( const double &i )            { return i*2.54; }
  43. inline double Inches2Meters( const double &i )        { return i*.0254; }
  44. inline double Inches2KM( const double &i )            { return i*.0000254; }
  45.  
  46. inline double Feet2Inches( const double &f )        { return f*12.0; }
  47. inline double Feet2Yards( const double &f )            { return f*OneThird; }                // 1/3
  48. inline double Feet2Miles( const double &f )            { return f*One5280th; }                // 1/5280
  49. inline double Feet2MM( const double &f )            { return f*304.8; }
  50. inline double Feet2CM( const double &f )            { return f*30.48; }
  51. inline double Feet2Meters( const double &f )        { return f*0.3048; }
  52. inline double Feet2KM( const double &f )            { return f*0.0003048; }
  53.  
  54. inline double Yards2Inches( const double &y )        { return y*36.0; }
  55. inline double Yards2Feet( const double &y )            { return y*3.0; }
  56. inline double Yards2Miles( const double &y )        { return y*One1760th; }                // 1/1760.0
  57. inline double Yards2MM( const double &y )            { return y*914.4; }
  58. inline double Yards2CM( const double &y )            { return y*91.44; }
  59. inline double Yards2Meters( const double &y )        { return y*.9144; }
  60. inline double Yards2KM( const double &y )            { return y*.0009144; }
  61.  
  62. inline double Miles2Inches( const double &mi )        { return mi*63360.0; }
  63. inline double Miles2Feet( const double &mi )        { return mi*5280; }
  64. inline double Miles2Yards( const double &mi )        { return mi*1760.0; }
  65. inline double Miles2MM( const double &mi )            { return mi*1609344.0; }
  66. inline double Miles2CM( const double &mi )            { return mi*160934.4; }
  67. inline double Miles2Meters( const double &mi )        { return mi*1609.344; }
  68. inline double Miles2KM( const double &mi )            { return mi*1.609344; }
  69.  
  70. inline double MM2CM( const double &mm )                { return mm*.1; }
  71. inline double MM2Meters( const double &mm )            { return mm*.001; }
  72. inline double MM2KM( const double &mm )                { return mm*.000001; }
  73. inline double MM2Inches( const double &mm )            { return mm*One25Pt4th; }            // 0.0393700787401575
  74. inline double MM2Feet( const double &mm )            { return mm*One304Pt8th; }            // 0.00328083989501312
  75. inline double MM2Yards( const double &mm )            { return mm*One914Pt4th; }            // 0.00109361329833771
  76. inline double MM2Miles( const double &mm )            { return mm*One1609344th; }            // 0.000000621371192237334
  77.  
  78. inline double CM2MM( const double &cm )                { return cm*10.0; }
  79. inline double CM2Meters( const double &cm )            { return cm*.01; }
  80. inline double CM2KM( const double &cm )                { return cm*.00001; }
  81. inline double CM2Inches( const double &cm )            { return cm*One2Pt54th; }            // 0.393700787401575
  82. inline double CM2Feet( const double &cm )            { return cm*One30Pt48th; }            // 0.0328083989501312
  83. inline double CM2Yards( const double &cm )            { return cm*One91Pt44th; }            // 0.0109361329833771
  84. inline double CM2Miles( const double &cm )            { return cm*One160934Pt4th; }        // 0.00000621371192237334
  85.  
  86. inline double Meters2MM( const double &m )            { return m*1000.0; }
  87. inline double Meters2CM( const double &m )            { return m*100.0; }
  88. inline double Meters2KM( const double &m )            { return m*.001; }
  89. inline double Meters2Inches( const double &m )        { return m*OnePt0254th; }            // 39.3700787401575
  90. inline double Meters2Feet( const double &m )        { return m*OnePt3048th; }            // 3.28083989501312
  91. inline double Meters2Yards( const double &m )        { return m*OnePt9144th; }            // 1.09361329833771
  92. inline double Meters2Miles( const double &m )        { return m*One1609Pt344th; }        // 0.000621371192237334
  93.  
  94. inline double KM2Meters( const double &km )            { return km*1000.0; }
  95. inline double KM2CM( const double &km )                { return km*100000.0; }
  96. inline double KM2MM( const double &km )                { return km*1000000.0; }
  97. inline double KM2Inches( const double &km )            { return km*OnePt0000254th; }        // 39370.0787401575
  98. inline double KM2Feet( const double &km )            { return km*OnePt0003048th; }        // 3280.83989501312
  99. inline double KM2Yards( const double &km )            { return km*OnePt0009144th; }        // 1093.61329833771
  100. inline double KM2Miles( const double &km )            { return km*One1Pt609344th; }        // 0.621371192237334
  101.  
  102. inline double Kph2Mph( const double &kph )            { return kph*One1Pt609344th; }        // 0.621371192237334
  103. inline double Mph2Kph( const double &mph )            { return mph*1.609344; }
  104.  
  105. inline double Kph2Mps( const double &kph )            { return kph*One3point6th; }        // 1/3.6
  106. inline double Mph2Mps( const double &mph )            { return mph*0.44704; }
  107. inline double Fps2Mps( const double &fps )            { return fps*0.3048; }
  108.  
  109. inline double Mps2Mph( const double &mps )            { return mps*OnePt44704th; }        // 2.2369362920544
  110. inline double Mps2Kph( const double &mps )            { return mps*3.6; }
  111. inline double Mps2Fps( const double &mps )            { return mps*OnePt3048th; }            // 3.28083989501312
  112.  
  113. inline double Lbs2Kg( const double &lbs )            { return lbs*One2Pt20462262185th; }    // 0.453592369999748
  114. inline double Kg2Lbs( const double &kg )            { return kg*2.20462262185; }
  115.  
  116. inline double LbForce2Newtons( const double &lbs )    { return lbs*4.44822161525; }
  117. inline double Newtons2LbForce( const double &nt )    { return nt*One4Pt44822th; }        // 0.224808943100241
  118. inline double FtLbs2NtMeters( const double &ftlbs )    { return ftlbs*OnePt737562th; }        // 1.35581794828961
  119. inline double NtMeters2FtLbs( const double &ntm )    { return ntm*0.7375621493; }
  120.  
  121. inline double Gallons2Liters( const double &l )        { return l*3.78541178401; }
  122. inline double Liters2Gallons( const double &g )        { return g*One3Pt785411th; }        // 0.264172052357451
  123.  
  124. inline double Radians2Degrees( const double &r )    { return r*Rad2Deg; }                // rad*180/Pi
  125. inline double Degrees2Radians( const double &d )    { return d*Deg2Rad; }                // deg*Pi/180
  126. inline double Rad2DegreesIfloat( const float &r )    { return double(r*fRad2Deg); }        // rad*180/Pi
  127. inline double Deg2RadiansIfloat( const float &d )    { return double(d*fDeg2Rad); }        // deg*Pi/180
  128. inline float  floatRadians2Degrees(const double &r)    { return float(r*Rad2Deg); }        // rad*180/Pi
  129. inline float  floatDegrees2Radians(const double &d)    { return float(d*Deg2Rad); }        // deg*Pi/180
  130. inline float  floatRad2Degrees( const float &r )    { return r*fRad2Deg; }                // rad*180/Pi
  131. inline float  floatDeg2Radians( const float &d )    { return d*fDeg2Rad; }                // deg*Pi/180
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top