FBX SDK Reference Guide: const.h Source File
00001 /**************************************************************************************
00002 
00003  Copyright © 1998 - 2008 Autodesk, Inc. and/or its licensors.
00004  All Rights Reserved.
00005 
00006  The coded instructions, statements, computer programs, and/or related material 
00007  (collectively the "Data") in these files contain unpublished information 
00008  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00009  Canada and United States of America federal copyright law and by international 
00010  treaties. 
00011  
00012  The Data may not be disclosed or distributed to third parties, in whole or in
00013  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00014 
00015  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00016  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00017  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00018  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00019  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00020  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00021  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00022  
00023  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00024  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00025  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00026  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00027  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00028  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00029  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00030  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00031  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00032  OR DAMAGE. 
00033 
00034 **************************************************************************************/
00035 
00036 #ifndef FBXFILESDK_COMPONENTS_KBASELIB_KMATH_CONST_H
00037 #define FBXFILESDK_COMPONENTS_KBASELIB_KMATH_CONST_H
00038 
00039 //*****************************************************************************************************************
00040 //   mathematical constants
00041 //*****************************************************************************************************************
00042 
00043 #include <fbxfilesdk/components/kbaselib/karch/types.h>
00044 
00045 //*****************************************************************************************************************
00046 //  common constants
00047 //*****************************************************************************************************************
00048 
00049 #ifndef K_ZERO
00050 #define K_ZERO          0                                                       // 0
00051 #endif
00052 #ifndef K_ONE
00053 #define K_ONE           1                                                       // 1
00054 #endif
00055 
00056 #define K_1_3           .33333333333333333333333333333333333333333333333333     // 1/3
00057 #define K_2_3           .66666666666666666666666666666666666666666666666667     // 2/3
00058 #define K_1_9           .11111111111111111111111111111111111111111111111111     // 1/9
00059 #define K_1_54          .01851851851851851851851851851851851851851851851852     // 1/54
00060 
00061 #ifndef K_E
00062 #define K_E             2.7182818284590452353602874713526624977572470936000     // e (natural logarithm base)
00063 #endif
00064 
00065 #define K_PI_180        .017453292519943295769236907684886127134428718885417    // pi/180
00066 #define K_PI_8          .39269908169872415480783042290993786052464617492188     // pi/8
00067 #define K_PI_4          .78539816339744830961566084581987572104929234984377     // pi/4
00068 #define K_PI_2          1.5707963267948966192313216916397514420985846996875     // pi/2
00069 #ifndef K_PI
00070 #define K_PI            3.1415926535897932384626433832795028841971693993751     // pi
00071 #endif
00072 #define K_2PI_3         2.0943951023931954923084289221863352561314462662501     // 2pi/3
00073 #define K_2PI           6.2831853071795864769252867665590057683943387987502     // 2pi
00074 #define K_3PI           9.4247779607693797153879301498385086525915081981252     // 3pi
00075 #define K_4PI           12.566370614359172953850573533118011536788677597500     // 4pi
00076 #define K_5PI           15.707963267948966192313216916397514420985846996875     // 5pi
00077 #define K_6PI           18.849555921538759430775860299677017305183016396250     // 6pi
00078 #define K_7PI           21.991148575128552669238503682956520189380185795626     // 7pi
00079 #define K_1_PI          .31830988618379067153776752674502872406891929148091     // 1/pi
00080 #define K_1_4PI         .079577471545947667884441881686257181017229822870228    // 1/4pi
00081 #define K_180_PI        57.295779513082320876798154814105170332405472466565     // 180/pi
00082 
00083 #define K_GAMMA         .57721566490153286060651209008240243104215933593992     // Euler-Mascheroni constant
00084 #define K_ZETA3         1.2020569031595942853997381615114499907649862923405     // Apery's constant
00085 #define K_G             .91596559417721901505460351493238411077414937428167     // Catalan's constant
00086 #define K_KDB           2.6854520010653064453097148354817956938203822939945     // Khintchine's constant
00087 #define K_C             1.2267420107203532444176302304553616558714096904403     // Fibonacci's factorial constant
00088 #define K_GOLDEN_RATIO  1.6180339887498948482045868343656381177203091798058     // golden ratio
00089 #define K_GOLDEN_SECT   .38196601125010515179541316563436188227969082019424     // 2 - golden ratio
00090 #define K_F1            4.6692016091029906718532038204662016172581855774758     // Feigenbaum's F1
00091 #define K_F2            2.5029078750958928222839028732182157863812713767271     // Feigenbaum's F2
00092 #define K_L             .11000100000000000000000100000000000000000000000000     // Liouville's number
00093 #ifndef K_TEN
00094 #define K_TEN           10                                                      // 10
00095 #endif
00096 
00097 #define K_GOMPERTZ      .5963473623231940                                       // Gompertz constant (-e*ei(-1))
00098 #define K_EI_LN2        1.0451637801174927847465120900824024310421593359399     // ei(ln(2))
00099 
00100 #define K_EXPGAMMA      1.7810724179901979852365041031071795491696452143034     // exp(gamma)
00101 #define K_EXPE          15.154262241479264189760430272629911905528548536856     // exp(e)
00102 #define K_EXPPI         23.140692632779269005729086367948547380266106242600     // exp(pi)
00103 #define K_PIEXP         22.459157718361045473427152204543735027589315133997     // pi^^e
00104 
00105 #define K_SQRT2_4       .35355339059327376220042218105242451964241796884424     // sqrt(2)/4
00106 #define K_SQRT3_3       .57735026918962576450914878050195745564760175127013     // sqrt(3)/3
00107 #define K_SQRT6_3       .81649658092772603273242802490196379732198249355222     // sqrt(6)/3
00108 #define K_SQRT6_4       .61237243569579452454932101867647284799148687016417     // sqrt(6)/4
00109 #define K_SQRT6_6       .40824829046386301636621401245098189866099124677611     // sqrt(6)/6
00110 #define K_SQRT2_2       .70710678118654752440084436210484903928483593768847     // sqrt(2)/2
00111 #define K_SQRT3_2       .86602540378443864676372317075293618347140262690519     // sqrt(3)/2
00112 #define K_SQRT2         1.4142135623730950488016887242096980785696718753769     // sqrt(2)
00113 #define K_SQRTE         1.6487212707001281468486507878141635716537761007101     // sqrt(e)
00114 #define K_SQRT3         1.7320508075688772935274463415058723669428052538104     // sqrt(3)
00115 #define K_SQRTPI        1.7724538509055160272981674833411451827975494561224     // sqrt(pi) = gamma(1/2)
00116 #define K_SQRT5         2.2360679774997896964091736687312762354406183596115     // sqrt(5)
00117 #define K_SQRT6         2.4494897427831780981972840747058913919659474806567     // sqrt(6)
00118 
00119 #define K_1_SQRTPI      .56418958354775628694807945156077258584405062932900     // 1/sqrt(pi)
00120 
00121 #define K_CBRT2         1.2599210498948731647672106072782283505702514647015     // cbrt(2)
00122 #define K_CBRT3         1.4422495703074083823216383107801095883918692534994     // cbrt(3)
00123 #define K_CBRT5         1.7099759466766969893531088725438601098680551105431     // cbrt(5)
00124 
00125 #define K_FTRT2         1.1486983549970350067986269467779275894438508890978     // 2^(1/5)
00126 #define K_FTRT3         1.2457309396155173259666803366403050809393099930688     // 3^(1/5)
00127 
00128 #ifndef K_LN2
00129 #define K_LN2           .69314718055994530941723212145817656807550013436026     // ln(2)
00130 #endif
00131 #define K_LN3           1.0986122886681096913952452369225257046474905578227     // ln(3)
00132 #ifndef K_LN10
00133 #define K_LN10          2.3025850929940456840179914546843642076011014886288     // ln(10)
00134 #endif
00135 
00136 #define K_1_LN2         1.4426950408889634073599246810018921374266459541530     // 1/ln(2)
00137 #define K_1_LN3         .91023922662683739361424016573610700061263605725521     // 1/ln(3)
00138 #define K_1_LN10        .43429448190325182765112891891660508229439700580367     // 1/ln(10)
00139 
00140 #ifndef K_L2E
00141 #define K_L2E           1.4426950408889634073599246810018921374266459541530     // log2(e)
00142 #endif
00143 #define K_L23           1.5849625007211561814537389439478165087598144076925     // log2(3)
00144 #ifndef K_L2T
00145 #define K_L2T           .30102999566398119521373889472449302676818988146210     // log2(10)
00146 #endif
00147 
00148 #define K_1_L2E         .69314718055994530941723212145817656807550013436025     // 1/log2(e)
00149 #define K_1_L23         .63092975357145743709952711434276085429958564013188     // 1/log2(3)
00150 #define K_1_L2T         1.4426950408889634073599246810018921374266459541530     // 1/log2(10)
00151 
00152 #ifndef K_LOG2
00153 #define K_LOG2          .30102999566398119521373889472449302676818988146211     // log10(2)
00154 #endif
00155 #ifndef K_LOGE
00156 #define K_LOGE          .43429448190325182765112891891660508229439700580367     // log10(e)
00157 #endif
00158 #define K_LOG3          .47712125471966243729502790325511530920012886419070     // log10(3)
00159 #define K_LOGPI         .49714987269413385435126828829089887365167832438044     // log10(pi)
00160 
00161 #define K_DDRT2         1.0594630943592952645618252949463417007792043174942     // 2^(1/12)
00162 #define K_1_DDRT2       .94387431268169349664191315666753437600756830333874     // 1/(2^(1/12))
00163 
00164 #define K_20LOG128      42.144199392957367329923445261429023747546583404695     // 20log10(128)
00165 #define K_20LOG32768    90.308998699194358564121668417347908030456964438633     // 20log10(32768)
00166 #define K_20LOG8388608  138.47379800543134979831989157326679231336734547257     // 20log10(8388608)
00167 
00168 #define K_1E0           K_ONE
00169 #define K_1E1           K_TEN
00170 
00171 #ifndef K_1E2
00172 #define K_1E2           E+2                                                     // 10^2
00173 #endif
00174 #ifndef K_1E4
00175 #define K_1E4           E+4                                                     // 10^4
00176 #endif
00177 #ifndef K_1E8
00178 #define K_1E8           E+8                                                     // 10^8
00179 #endif
00180 #ifndef K_1E16
00181 #define K_1E16          E+16                                                    // 10^16
00182 #endif
00183 #ifndef K_1E32
00184 #define K_1E32          E+32                                                    // 10^32
00185 #endif
00186 #ifndef K_1E64
00187 #define K_1E64          E+64                                                    // 10^64
00188 #endif
00189 #ifndef K_1E128
00190 #define K_1E128         E+128                                                   // 10^128
00191 #endif
00192 #ifndef K_1E256
00193 #define K_1E256         E+256                                                   // 10^256
00194 #endif
00195 #ifndef K_1E512
00196 #define K_1E512         E+512                                                   // 10^512
00197 #endif
00198 #ifndef K_1E1024
00199 #define K_1E1024        E+1024                                                  // 10^1024
00200 #endif
00201 #ifndef K_1E2048
00202 #define K_1E2048        E+2048                                                  // 10^2048
00203 #endif
00204 #ifndef K_1E4096
00205 #define K_1E4096        E+4096                                                  // 10^4096
00206 #endif
00207 
00208 //*****************************************************************************************************************
00209 //  unit scales
00210 //*****************************************************************************************************************
00211 
00212 #define K_YOCTO         E-24    // y
00213 #define K_ZEPTO         E-21    // z
00214 #define K_ATTO          E-18    // a
00215 #define K_FEMTO         E-15    // f
00216 #define K_PICO          E-12    // p
00217 #define K_NANO          E-9     // n
00218 #define K_MICRO         E-6     // u
00219 #define K_MILLI         E-3     // m
00220 #define K_CENTI         E-2     // c
00221 #define K_DECI          E-1     // d
00222 #define K_DECA          E+1     // da, dk (DEKA)
00223 #define K_HECTO         E+2     // h
00224 #define K_KILO          E+3     // k
00225 #define K_MEGA          E+6     // M
00226 #define K_GIGA          E+9     // G
00227 #define K_TERA          E+12    // T
00228 #define K_PETA          E+15    // P
00229 #define K_EXA           E+18    // E
00230 #define K_ZETTA         E+21    // Z
00231 #define K_YOTTA         E+24    // Y
00232 
00233 //*****************************************************************************************************************
00234 //  angular units
00235 //*****************************************************************************************************************
00236 
00237 #define K_DEG_TO_RAD    K_PI_180                                                // pi/180
00238 #define K_DEG_TO_CIRC   .0027777777777777777777777777777777777777777777777778   // 1/360
00239 #define K_RAD_TO_DEG    K_180_PI                                                // 180/pi
00240 #define K_RAD_TO_CIRC   K_PI_2                                                  // pi/2
00241 #define K_CIRC_TO_DEG   360                                                     // 360
00242 
00243 #define K_STERADIAN     K_1_4PI                                                 // sphere/st
00244 
00245 //*****************************************************************************************************************
00246 //  distance units
00247 //*****************************************************************************************************************
00248 
00249 #define K_IN_TO_CM      2.5400000000000000000000000000000000000000000000000     // cm/in
00250 #define K_CM_TO_IN      .39370078740157480314960629921259842519685039370079     // in/cm
00251 
00252 #define K_FT_TO_M       .30480000000000000000000000000000000000000000000000     // m/ft
00253 #define K_M_TO_FT       3.2808398950131233595800524934383202099737532808399     // ft/m
00254 
00255 #define K_MILE_TO_KM    1.6093440000000000000000000000000000000000000000000     // km/mile
00256 #define K_KM_TO_MILE    .62137119223733396961743418436331822158593812137119     // mile/km
00257 
00258 #define K_KNOT_TO_KM    1.8531840                                               // km/knot
00259 #define K_KM_TO_KNOT    .53961182483768476308882442326288161348252521066446     // knot/km
00260 
00261 #define K_FEET_TO_INCHES        12
00262 #define K_YARDS_TO_FEET         3
00263 #define K_CHAINS_TO_YARDS       22
00264 #define K_FURLONGS_TO_CHAINS    10
00265 #define K_MILES_TO_FURLONG      8
00266 
00267 //*****************************************************************************************************************
00268 //  surface units
00269 //*****************************************************************************************************************
00270 
00271 #define K_FT2_TO_M2     .09290304000000000000000000000000000000000000000000     // m^2/ft^2
00272 #define K_M2_TO_FT2     10.763910416709722308333505555900000688890266669422     // ft^2/m^2
00273 #define K_ACRE_TO_M2    4046.86                                                 // acre/m^2
00274 #define K_HECTARE_TO_M2 10000                                                   // hectare/m^2
00275 
00276 //*****************************************************************************************************************
00277 //  volume units
00278 //*****************************************************************************************************************
00279 
00280 #define K_UKGAL_TO_M3   4.546e-3                                                // gal/m^3
00281 #define K_USGAL_TO_M3   3.785e-3                                                // gal/m^3
00282 
00283 //*****************************************************************************************************************
00284 //  capacity units
00285 //*****************************************************************************************************************
00286 
00287 #define K_US_PINTS_TO_OUNCES    16
00288 #define K_UK_PINTS_TO_OUNCES    20
00289 #define K_PINTS_TO_GILLS        4
00290 #define K_QUART_TO_PINTS        2
00291 #define K_GALLONS_TO_QUARTS     4
00292 #define K_PECKS_TO_QUARTS       8
00293 #define K_BUSHELS_TO_PECKS      4
00294 
00295 //*****************************************************************************************************************
00296 //  speed units
00297 //*****************************************************************************************************************
00298 
00299 #define K_MPH_TO_KMH    K_MILE_TO_KM                                            // kmh / mph
00300 #define K_KMH_TO_MPH    K_KM_TO_MILE                                            // mph / kmh
00301 
00302 //*****************************************************************************************************************
00303 //  mass (Troy and Avoirdupois) units
00304 //*****************************************************************************************************************
00305 
00306 #define K_OZ_TO_G       .028349523125                                           // g/oz
00307 
00308 #define K_LB_TO_KG      .45359237                                               // kg/lb
00309 #define K_KG_TO_LB      2.20462262                                              // lb/kg
00310 
00311 #define K_OUNCES_TO_GRAINS          437.5
00312 #define K_POUNDS_TO_OUNCES          16
00313 #define K_STONES_TO_POUNDS          14
00314 #define K_CWT_TO_STONES             8       // (cwt = hundredweight)
00315 #define K_UKTONS_TO_CWT             20
00316 
00317 #define K_UKTONS_TO_POUNDS          2240
00318 #define K_USTON_TO_POUNDS           2000
00319 
00320 #define K_PENNYWEIGHTS_TO_GRAINS    24
00321 #define K_OUNCES_TO_PENNYWEIGHTS    20
00322 
00323 //*****************************************************************************************************************
00324 //  temperature units
00325 //*****************************************************************************************************************
00326 
00327 #define K_F_TO_C(f)     (1.8 * f + 32)                                          // 'F -> 'C
00328 #define K_C_TO_K(c)     (c + 273.16)                                            // 'C -> 'K
00329 #define K_C_TO_F(c)     ((c - 32) * (.55555555555555555555555555555555555555555555555556)) // 'C -> 'F
00330 
00331 //*****************************************************************************************************************
00332 //  force units
00333 //*****************************************************************************************************************
00334 
00335 #define K_HP_TO_W       745.71216                                               // w/hp
00336 #define K_W_TO_HP       .0013410                                                // hp/w
00337 
00338 //*****************************************************************************************************************
00339 //  pressure units
00340 //*****************************************************************************************************************
00341 
00342 #define K_ATM_TO_PA     101325                                                  // Pa/atm
00343 
00344 //*****************************************************************************************************************
00345 //  ratio units
00346 //*****************************************************************************************************************
00347 
00348 #define K_BELL(r)       (20*kLog10(r))                                          // B(r)
00349 #define K_DECIBEL(r)    (2*kLog10(r))                                           // dB(r)
00350 
00351 //*****************************************************************************************************************
00352 //  physical constants
00353 //*****************************************************************************************************************
00354 
00355 #define K_LSPEED        299792458                                               // speed of light in vacuum (m/s)
00356 
00357 #define K_AIR_SSPEED21  344 /*340.29205*/                                       // air speed of sound at 21'C (m/s)
00358 #define K_WATER_SSPEED  1480                                                    // water speed of sound (m/s)
00359 #define K_AIR_SSPEED(t) ((20.0330)*kSqrt(t))                                    // speed of sound at t'K (331*sqrt(t/273))
00360 
00361 #define K_GRAV_CONST    9.80665                                                 // terrestrial gravitational constant g
00362 
00363 //*****************************************************************************************************************
00364 //  material constants
00365 //*****************************************************************************************************************
00366 
00367 #define K_REFRAC_AIR        1.000298                                            // air refraction index
00368 #define K_REFRAC_DIAMOND    2.42                                                // diamond refraction index
00369 #define K_REFRAC_GLASS      1.50                                                // glass refraction index
00370 #define K_REFRAC_ICE        1.31                                                // ice refraction index
00371 #define K_REFRAC_PARAFFIN   1.42                                                // paraffin refraction index
00372 #define K_REFRAC_RUBY       1.76                                                // ruby refraction index
00373 #define K_REFRAC_WATER      1.33                                                // water refraction index
00374 
00375 //*****************************************************************************************************************
00376 //  media constants
00377 //*****************************************************************************************************************
00378 
00379 /*
00380  * Never Twice the Same Colour
00381  */
00382 #define K_NTSC_RATE         30
00383 #define K_NTSC_LINES        525
00384 #define K_NTSC_GAMMA        2.2
00385 
00386 #define K_MNTSC_RATE        29.97002617
00387 #define K_MNTSC_LINES       525
00388 #define K_MNTSC_GAMMA       2.2
00389 
00390 /*
00391  * Pay for Added Luxury
00392  */
00393 #define K_PAL_RATE          25
00394 #define K_PAL_LINES         625
00395 #define K_PAL_GAMMA         2.8
00396 
00397 #define K_MPAL_RATE         K_MNTSC_RATE
00398 #define K_MPAL_LINES        K_MNTSC_LINES
00399 #define K_MPAL_GAMMA        K_PAL_GAMMA
00400 
00401 /*
00402  * System Essentially Contrary to American Method
00403  */
00404 #define K_SECAM_RATE        25
00405 #define K_SECAM_LINES       625
00406 #define K_SECAM_GAMMA       2.8
00407 
00408 #define K_MSECAM_RATE       K_MNTSC_RATE
00409 #define K_MSECAM_LINES      K_MNTSC_LINES
00410 #define K_MSECAM_GAMMA      K_MPAL_GAMMA
00411 
00412 #define K_FILM_RATE         24
00413 
00414 #define K_HIVISION_RATE     60
00415 #define K_HIVISION_LINES    1125
00416 
00417 //*****************************************************************************************************************
00418 //  primes up to 65535
00419 //*****************************************************************************************************************
00420 
00421 extern const kUInt16 kPrimes[6542];
00422 
00423 #endif // FBXFILESDK_COMPONENTS_KBASELIB_KMATH_CONST_H
00424