Ticket #18: BaseFunctions-Doc.diff
| File BaseFunctions-Doc.diff, 48.2 kB (added by cneumann, 2 years ago) |
|---|
-
Source/Base/Base/OSGBaseFunctions.h
old new 242 242 inline 243 243 Real32 osgrand(void); 244 244 245 inline246 bool osgIsBigEndian(void);247 248 245 #if defined(WIN32) && defined(_MSC_VER) 249 246 #if _MSC_VER <= 1200 // VC6 250 247 inline … … 258 255 /*---------------------------------------------------------------------*/ 259 256 /* big/little endian conversion functions */ 260 257 258 inline 259 bool osgIsBigEndian(void); 260 261 261 // host to network 262 262 263 263 inline -
Source/Base/Base/OSGBaseFunctions.inl
old new 48 48 /*! \name sqrt */ 49 49 /*! \{ */ 50 50 51 /*! \ingroup GrpBaseBaseMathFn 51 /*! Return the square root of the argument, i.e. the number \c y that satisfies 52 <tt>y<sup>2</sup> == rValue</tt>. The argument must be nonnegative. 53 54 \param[in] rValue The number to compute the square root of, must be >= 0. 55 \return The square root of the argument. 56 57 \note This function forwards to an appropriate C++ or C library function, 58 hence exhibits the respective error behavior. 59 60 \ingroup GrpBaseBaseMathFn 52 61 */ 53 54 62 template <class FloatTypeT> inline 55 63 typename TypeTraits<FloatTypeT>::RealReturnType 56 64 osgsqrt(const FloatTypeT rValue) … … 62 70 63 71 /*! \ingroup GrpBaseBaseMathFn 64 72 */ 65 66 73 inline 67 74 Real32 osgsqrt(const Real32 rValue) 68 75 { … … 77 84 78 85 /*! \ingroup GrpBaseBaseMathFn 79 86 */ 80 81 87 inline 82 88 Real64 osgsqrt(const Real64 rValue) 83 89 { … … 90 96 91 97 /*! \ingroup GrpBaseBaseMathFn 92 98 */ 93 94 99 inline 95 100 Real128 osgsqrt(const Real128 rValue) 96 101 { … … 104 109 105 110 /*! \ingroup GrpBaseBaseMathFn 106 111 */ 107 108 112 inline 109 113 Fixed32 osgsqrt(const Fixed32 rValue) 110 114 { … … 116 120 /*! \name cos */ 117 121 /*! \{ */ 118 122 119 /*! \ingroup GrpBaseBaseMathFn 123 /*! Return the cosine of the argument, which is given in radians. 124 125 \param[in] rValue The angle in radians to compute the cosine of. 126 \return Cosine of \a rValue, it is in the range -1 to 1. 127 128 \note This function forwards to an appropriate C++ or C library function, 129 hence exhibits the respective error behavior. 130 131 \ingroup GrpBaseBaseMathFn 120 132 */ 121 122 133 template <class FloatTypeT> inline 123 134 typename TypeTraits<FloatTypeT>::RealReturnType 124 135 osgcos(const FloatTypeT rValue) … … 130 141 131 142 /*! \ingroup GrpBaseBaseMathFn 132 143 */ 133 134 144 inline 135 145 Real32 osgcos(const Real32 rValue) 136 146 { … … 145 155 146 156 /*! \ingroup GrpBaseBaseMathFn 147 157 */ 148 149 158 inline 150 159 Real64 osgcos(const Real64 rValue) 151 160 { … … 158 167 159 168 /*! \ingroup GrpBaseBaseMathFn 160 169 */ 161 162 170 inline 163 171 Real128 osgcos(const Real128 rValue) 164 172 { … … 171 179 172 180 /*! \ingroup GrpBaseBaseMathFn 173 181 */ 174 175 182 inline 176 183 Fixed32 osgcos(const Fixed32 rValue) 177 184 { … … 183 190 /*! \name sin */ 184 191 /*! \{ */ 185 192 186 /*! \ingroup GrpBaseBaseMathFn 193 /*! Return the sine of the argument, which is given in radians. 194 195 \param[in] rValue The angle in radians to compute the sine of. 196 \return Sine of \a rValue, it is in the range -1 to 1. 197 198 \note This function forwards to an appropriate C++ or C library function, 199 hence exhibits the respective error behavior. 200 201 \ingroup GrpBaseBaseMathFn 187 202 */ 188 189 203 template <class FloatTypeT> inline 190 204 typename TypeTraits<FloatTypeT>::RealReturnType 191 205 osgsin(const FloatTypeT rValue) … … 197 211 198 212 /*! \ingroup GrpBaseBaseMathFn 199 213 */ 200 201 214 inline 202 215 Real32 osgsin(const Real32 rValue) 203 216 { … … 212 225 213 226 /*! \ingroup GrpBaseBaseMathFn 214 227 */ 215 216 228 inline 217 229 Real64 osgsin(const Real64 rValue) 218 230 { … … 225 237 226 238 /*! \ingroup GrpBaseBaseMathFn 227 239 */ 228 229 240 inline 230 241 Real128 osgsin(const Real128 rValue) 231 242 { … … 238 249 239 250 /*! \ingroup GrpBaseBaseMathFn 240 251 */ 241 242 252 inline 243 253 Fixed32 osgsin(const Fixed32 rValue) 244 254 { … … 251 261 /*! \name tan */ 252 262 /*! \{ */ 253 263 254 /*! \ingroup GrpBaseBaseMathFn 264 /*! Return the tangent of the argument, which is given in radians. The tangent 265 is defined as tan(x) = sin(x) / cos(x) and therefore has singularities at 266 odd multiples of pi/2. 267 268 \param[in] rValue The angle in radians to compute the tangent of. 269 \return Tangent of \a rValue. 270 271 \note This function forwards to an appropriate C++ or C library function, 272 hence exhibits the respective error behavior. 273 274 \ingroup GrpBaseBaseMathFn 255 275 */ 256 257 276 template <class FloatTypeT> inline 258 277 typename TypeTraits<FloatTypeT>::RealReturnType 259 278 osgtan(const FloatTypeT rValue) … … 265 284 266 285 /*! \ingroup GrpBaseBaseMathFn 267 286 */ 268 269 287 inline 270 288 Real32 osgtan(const Real32 rValue) 271 289 { … … 280 298 281 299 /*! \ingroup GrpBaseBaseMathFn 282 300 */ 283 284 301 inline 285 302 Real64 osgtan(const Real64 rValue) 286 303 { … … 293 310 294 311 /*! \ingroup GrpBaseBaseMathFn 295 312 */ 296 297 313 inline 298 314 Real128 osgtan(const Real128 rValue) 299 315 { … … 306 322 307 323 /*! \ingroup GrpBaseBaseMathFn 308 324 */ 309 310 325 inline 311 326 Fixed32 osgtan(const Fixed32 rValue) 312 327 { … … 318 333 /*! \name acos */ 319 334 /*! \{ */ 320 335 321 /*! \ingroup GrpBaseBaseMathFn 336 /*! Return the arc cosine (in radians) of the argument, i.e. the number \c y 337 such that <tt>rValue == cos(y)</tt> and \c y is in the range [-pi/2; pi/2]. 338 339 \param[in] rValue The number to compute the arc cosine of, must be 340 in the range [-1; 1]. 341 \return The arc cosine of \a rValue in the range [-pi/2; pi/2]. 342 343 \note This function forwards to an appropriate C++ or C library function, 344 hence exhibits the respective error behavior. 345 346 \ingroup GrpBaseBaseMathFn 322 347 */ 323 324 348 template <class FloatTypeT> inline 325 349 typename TypeTraits<FloatTypeT>::RealReturnType 326 350 osgacos(const FloatTypeT rValue) … … 332 356 333 357 /*! \ingroup GrpBaseBaseMathFn 334 358 */ 335 336 359 inline 337 360 Real32 osgacos(const Real32 rValue) 338 361 { … … 347 370 348 371 /*! \ingroup GrpBaseBaseMathFn 349 372 */ 350 351 373 inline 352 374 Real64 osgacos(const Real64 rValue) 353 375 { … … 360 382 361 383 /*! \ingroup GrpBaseBaseMathFn 362 384 */ 363 364 385 inline 365 386 Real128 osgacos(const Real128 rValue) 366 387 { … … 376 397 /*! \name asin */ 377 398 /*! \{ */ 378 399 379 /*! \ingroup GrpBaseBaseMathFn 400 /*! Return the arc sine (in radians) of the argument, i.e. the number \c y such 401 that <tt>rValue == sin(y)</tt> and \c y is in the range [-pi/2; pi/2]. 402 403 \param[in] rValue The number to compute the arc sine of, must be 404 in the range [-1; 1]. 405 \return The arc sine of \a rValue in the range [-pi/2; pi/2]. 406 407 \note This function forwards to an appropriate C++ or C library function, 408 hence exhibits the respective error behavior. 409 410 \ingroup GrpBaseBaseMathFn 380 411 */ 381 382 412 template <class FloatTypeT> inline 383 413 typename TypeTraits<FloatTypeT>::RealReturnType 384 414 osgasin(const FloatTypeT rValue) … … 390 420 391 421 /*! \ingroup GrpBaseBaseMathFn 392 422 */ 393 394 423 inline 395 424 Real32 osgasin(const Real32 rValue) 396 425 { … … 406 435 407 436 /*! \ingroup GrpBaseBaseMathFn 408 437 */ 409 410 438 inline 411 439 Real64 osgasin(const Real64 rValue) 412 440 { … … 419 447 420 448 /*! \ingroup GrpBaseBaseMathFn 421 449 */ 422 423 450 inline 424 451 Real128 osgasin(const Real128 rValue) 425 452 { … … 435 462 /*! \name atan */ 436 463 /*! \{ */ 437 464 438 /*! \ingroup GrpBaseBaseMathFn 465 /*! Return the arc tangent (in radians) of the argument, i.e. the number \c y 466 such that <tt>rValue == tan(y)</tt> and \c y is in the range [-pi/2; pi/2]. 467 468 \param[in] rValue The number to compute the arc tangent of. 469 \return The arc tangent of \a rValue in the range [-pi/2; pi/2]. 470 471 \note This function forwards to an appropriate C++ or C library function, 472 hence exhibits the respective error behavior. 473 474 \sa osgatan2(const FloatTypeT,const FloatTypeT) 475 476 \ingroup GrpBaseBaseMathFn 439 477 */ 440 441 478 template <class FloatTypeT> inline 442 479 typename TypeTraits<FloatTypeT>::RealReturnType 443 480 osgatan(const FloatTypeT rValue) … … 449 486 450 487 /*! \ingroup GrpBaseBaseMathFn 451 488 */ 452 453 489 inline 454 490 Real32 osgatan(const Real32 rValue) 455 491 { … … 464 500 465 501 /*! \ingroup GrpBaseBaseMathFn 466 502 */ 467 468 503 inline 469 504 Real64 osgatan(const Real64 rValue) 470 505 { … … 477 512 478 513 /*! \ingroup GrpBaseBaseMathFn 479 514 */ 480 481 515 inline 482 516 Real128 osgatan(const Real128 rValue) 483 517 { … … 493 527 /*! \name atan2 */ 494 528 /*! \{ */ 495 529 496 /*! \ingroup GrpBaseBaseMathFn 530 /*! Return the arc tangent (in radians) of <tt>rValue1 / rValue2</tt> using 531 the signs of both arguments to determine the quadrant. This can be used to 532 obtain the angle component of the polar coordinates of a point with 533 cartesian coordinates (\a rValue2, \a rValue1). 534 535 \param[in] rValue1 The numerator of the value to compute atan of. 536 \param[in] rValue2 The denominator of the value to compute atan of. 537 \return The arc tangent of <tt>rValue1 / rValue2</tt> in the range [-pi; pi]. 538 539 \note This function forwards to an appropriate C++ or C library function, 540 hence exhibits the respective error behavior. 541 542 \ingroup GrpBaseBaseMathFn 497 543 */ 498 499 544 template <class FloatTypeT> inline 500 545 typename TypeTraits<FloatTypeT>::RealReturnType 501 546 osgatan2(const FloatTypeT rValue1, … … 508 553 509 554 /*! \ingroup GrpBaseBaseMathFn 510 555 */ 511 512 556 inline 513 557 Real32 osgatan2(const Real32 rValue1, const Real32 rValue2) 514 558 { … … 527 571 528 572 /*! \ingroup GrpBaseBaseMathFn 529 573 */ 530 531 574 inline 532 575 Real64 osgatan2(const Real64 rValue1, const Real64 rValue2) 533 576 { … … 540 583 541 584 /*! \ingroup GrpBaseBaseMathFn 542 585 */ 543 544 586 inline 545 587 Real128 osgatan2(const Real128 rValue1, const Real128 rValue2) 546 588 { … … 556 598 /*! \name abs */ 557 599 /*! \{ */ 558 600 559 /*! \ingroup GrpBaseBaseMathFn 601 /*! Return the absolute value of the argument. 602 603 \param[in] rValue Number to compute absolute value of. 604 \return Absolute value of \a rValue. 605 606 \note For floating point arguments this function forwards to an 607 appropriate C++ or C library function, hence exhibits the 608 respective error behavior. 609 610 \ingroup GrpBaseBaseMathFn 560 611 */ 561 562 612 template <class TypeT> inline 563 613 TypeT osgabs(const TypeT rValue) 564 614 { … … 567 617 568 618 /*! \ingroup GrpBaseBaseMathFn 569 619 */ 570 571 620 inline 572 621 Real32 osgabs(const Real32 rValue) 573 622 { … … 582 631 583 632 /*! \ingroup GrpBaseBaseMathFn 584 633 */ 585 586 634 inline 587 635 Real64 osgabs(const Real64 rValue) 588 636 { … … 595 643 596 644 /*! \ingroup GrpBaseBaseMathFn 597 645 */ 598 599 646 inline 600 647 Fixed32 osgabs(const Fixed32 rValue) 601 648 { … … 604 651 605 652 /*! \ingroup GrpBaseBaseMathFn 606 653 */ 607 608 654 inline 609 655 Real128 osgabs(const Real128 rValue) 610 656 { … … 620 666 /*! \name pow */ 621 667 /*! \{ */ 622 668 623 /*! \ingroup GrpBaseBaseMathFn 669 /*! Return \a rValue to the power of \a rExp. 670 671 \param[in] rValue Base. 672 \param[in] rExp Exponent. 673 674 \note This function forwards to an appropriate C++ or C library function, 675 hence exhibits the respective error behavior. 676 677 \ingroup GrpBaseBaseMathFn 624 678 */ 625 626 679 template <class FloatTypeT> inline 627 680 typename TypeTraits<FloatTypeT>::RealReturnType 628 681 osgpow(const FloatTypeT rValue, … … 635 688 636 689 /*! \ingroup GrpBaseBaseMathFn 637 690 */ 638 639 691 inline 640 692 Real32 osgpow(const Real32 rValue, const Real32 rExp) 641 693 { … … 650 702 651 703 /*! \ingroup GrpBaseBaseMathFn 652 704 */ 653 654 705 inline 655 706 Real64 osgpow(const Real64 rValue, const Real64 rExp) 656 707 { … … 663 714 664 715 /*! \ingroup GrpBaseBaseMathFn 665 716 */ 666 667 717 inline 668 718 Real128 osgpow(const Real128 rValue, const Real128 rExp) 669 719 { … … 679 729 /*! \name log */ 680 730 /*! \{ */ 681 731 682 /*! \ingroup GrpBaseBaseMathFn 732 /*! Return the natural logarithm of the argument, i.e. the number \c y such that 733 <tt>e<sup>y</sup> == rValue</tt>, where e is Euler's number. 734 735 \param[in] rValue The number to compute the natural logarithm of, 736 must be >= 0. 737 \return Natural logarithm of \a rValue. 738 739 \note This function forwards to an appropriate C++ or C library function, 740 hence exhibits the respective error behavior. 741 742 \ingroup GrpBaseBaseMathFn 683 743 */ 684 685 744 template <class FloatTypeT> inline 686 745 typename TypeTraits<FloatTypeT>::RealReturnType 687 746 osglog(const FloatTypeT rValue) … … 693 752 694 753 /*! \ingroup GrpBaseBaseMathFn 695 754 */ 696 697 755 inline 698 756 Real32 osglog(const Real32 rValue) 699 757 { … … 708 766 709 767 /*! \ingroup GrpBaseBaseMathFn 710 768 */ 711 712 769 inline 713 770 Real64 osglog(const Real64 rValue) 714 771 { … … 721 778 722 779 /*! \ingroup GrpBaseBaseMathFn 723 780 */ 724 725 781 inline 726 782 Real128 osglog(const Real128 rValue) 727 783 { … … 737 793 /*! \name exp */ 738 794 /*! \{ */ 739 795 740 /*! \ingroup GrpBaseBaseMathFn 796 /*! Return e to the power \a rValue, where e is Euler's number, the base of the 797 natural logarithm. 798 799 \param[in] rValue Exponent. 800 \return e to the power \a rValue. 801 802 \note This function forwards to an appropriate C++ or C library function, 803 hence exhibits the respective error behavior. 804 805 \ingroup GrpBaseBaseMathFn 741 806 */ 742 743 807 template <class FloatTypeT> inline 744 808 typename TypeTraits<FloatTypeT>::RealReturnType 745 809 osgexp(const FloatTypeT rValue) … … 751 815 752 816 /*! \ingroup GrpBaseBaseMathFn 753 817 */ 754 755 818 inline 756 819 Real32 osgexp(const Real32 rValue) 757 820 { … … 766 829 767 830 /*! \ingroup GrpBaseBaseMathFn 768 831 */ 769 770 832 inline 771 833 Real64 osgexp(const Real64 rValue) 772 834 { … … 779 841 780 842 /*! \ingroup GrpBaseBaseMathFn 781 843 */ 782 783 844 inline 784 845 Real128 osgexp(const Real128 rValue) 785 846 { … … 795 856 /*! \name floor */ 796 857 /*! \{ */ 797 858 798 /*! \ingroup GrpBaseBaseMathFn 859 /*! Returns the argument rounded downwards to the nearest integer, i.e. returns 860 the largest integer not greater than \a rValue. 861 862 Example: 863 \code 864 osgfloor( 1.5) == 1.0; 865 osgfloor(-1.5) == -2.0; 866 \endcode 867 868 \param[in] rValue Number to round down. 869 \return Largest integer not greater than the argument. 870 871 \note This function forwards to an appropriate C++ or C library function, 872 hence exhibits the respective error behavior. 873 874 \ingroup GrpBaseBaseMathFn 799 875 */ 800 801 876 template <class FloatTypeT> inline 802 877 typename TypeTraits<FloatTypeT>::RealReturnType 803 878 osgfloor(const FloatTypeT rValue) … … 809 884 810 885 /*! \ingroup GrpBaseBaseMathFn 811 886 */ 812 813 887 inline 814 888 Real32 osgfloor(const Real32 rValue) 815 889 { … … 828 902 829 903 /*! \ingroup GrpBaseBaseMathFn 830 904 */ 831 832 905 inline 833 906 Real64 osgfloor(const Real64 rValue) 834 907 { … … 841 914 842 915 /*! \ingroup GrpBaseBaseMathFn 843 916 */ 844 845 917 inline 846 918 Real128 osgfloor(const Real128 rValue) 847 919 { … … 857 929 /*! \name ceil */ 858 930 /*! \{ */ 859 931 860 /*! \ingroup GrpBaseBaseMathFn 932 /*! Returns the argument rounded upwards to the nearest integer, i.e. returns 933 the smallest integer not less than \a rValue. 934 935 Example: 936 \code 937 osgceil( 1.5) == 2.0; 938 osgceil(-1.5) == -1.0; 939 \endcode 940 941 \param[in] rValue Number to round up. 942 \return Smallest integer not less than the argument. 943 944 \note This function forwards to an appropriate C++ or C library function, 945 hence exhibits the respective error behavior. 946 947 \ingroup GrpBaseBaseMathFn 861 948 */ 862 863 949 template <class FloatTypeT> inline 864 950 typename TypeTraits<FloatTypeT>::RealReturnType 865 951 osgceil(const FloatTypeT rValue) … … 871 957 872 958 /*! \ingroup GrpBaseBaseMathFn 873 959 */ 874 875 960 inline 876 961 Real32 osgceil(const Real32 rValue) 877 962 { … … 890 975 891 976 /*! \ingroup GrpBaseBaseMathFn 892 977 */ 893 894 978 inline 895 979 Real64 osgceil(const Real64 rValue) 896 980 { … … 903 987 904 988 /*! \ingroup GrpBaseBaseMathFn 905 989 */ 906 907 990 inline 908 991 Real128 osgceil(const Real128 rValue) 909 992 { … … 919 1002 /*! \name finite */ 920 1003 /*! \{ */ 921 1004 922 /*! \ingroup GrpBaseBaseMathFn 1005 /*! Returns a nonzero value if \a rValue is a finite number, i.e. neither 1006 plus or minus infinity nor NAN. 1007 1008 \param[in] rValue Number to test. 1009 \return Nonzero value if argument is finite. 1010 1011 \note This function forwards to an appropriate C++ or C library function, 1012 hence exhibits the respective error behavior. 1013 1014 \ingroup GrpBaseBaseMathFn 923 1015 */ 924 925 1016 template <class FloatTypeT> inline 926 1017 UInt32 osgfinite(const FloatTypeT rValue) 927 1018 { … … 941 1032 /*! \name min / max */ 942 1033 /*! \{ */ 943 1034 944 /*! \ingroup GrpBaseBaseMathFn 1035 /*! Return the smaller of the two arguments. 1036 1037 \param[in] lVal First value for comparison. 1038 \param[in] rValue Second value for comparison. 1039 \return The smaller of the two arguments. 1040 1041 \ingroup GrpBaseBaseMathFn 945 1042 */ 946 947 1043 template <class TypeT> inline 948 1044 TypeT osgMin(const TypeT lValue, const TypeT rValue) 949 1045 { 950 1046 return ((lValue < rValue) ? lValue : rValue); 951 1047 } 952 1048 953 /*! \ingroup GrpBaseBaseMathFn 1049 /*! Return the larger of the two arguments. 1050 1051 \param[in] lVal First value for comparison. 1052 \param[in] rValue Second value for comparison. 1053 \return The larger of the two arguments. 1054 1055 \ingroup GrpBaseBaseMathFn 954 1056 */ 955 956 1057 template <class TypeT> inline 957 1058 TypeT osgMax(const TypeT lValue, const TypeT rValue) 958 1059 { 959 1060 return ((lValue > rValue) ? lValue : rValue); 960 1061 } 961 1062 962 /*! \ingroup GrpBaseBaseMathFn 963 Clamp \a val to [\a minVal - \a maxVal]. 964 */ 1063 /*! Restrict val to the range [minVal; maxVal], inclusive. 965 1064 1065 \param[in] minVal Lower bound of the range. 1066 \param[in] val Value to clamp. 1067 \param[in] maxVal Upper bound of the range. 1068 \return The value from the given range that is closest to val. 1069 1070 \ingroup GrpBaseBaseMathFn 1071 */ 966 1072 template <class TypeT> inline 967 1073 TypeT osgClamp(const TypeT minVal, const TypeT val, const TypeT maxVal) 968 1074 { … … 974 1080 /*! \name sgn */ 975 1081 /*! \{ */ 976 1082 977 /*! \ingroup GrpBaseBaseMathFn 1083 /*! Return the sign of the argument, i.e. -1 if val is negative, 1 if it is 1084 positive and 0 otherwise. 1085 1086 \param[in] val The number to classify. 1087 \return The sign of the argument. 1088 1089 \ingroup GrpBaseBaseMathFn 978 1090 */ 979 980 1091 template <class TypeT> inline 981 1092 Int8 osgSgn(TypeT val) 982 1093 { … … 994 1105 /*! \name swap */ 995 1106 /*! \{ */ 996 1107 997 /*! \ingroup GrpBaseBaseMathFn 1108 /*! Exchanges the values of the arguments. 1109 1110 \param[in,out] lVal New value for \a rValue, is assigned the 1111 old value of \a rValue. 1112 \param[in,out] rValue New value for lVal, is assigned the 1113 old value of rVal. 1114 1115 \ingroup GrpBaseBaseMathFn 998 1116 */ 999 1000 1117 template <class TypeT> inline 1001 1118 void osgSwap(TypeT & lValue, TypeT & rValue) 1002 1119 { … … 1011 1128 /*! \name degree2rad */ 1012 1129 /*! \{ */ 1013 1130 1014 /*! \ingroup GrpBaseBaseMathFn 1131 /*! Converts the argument angle from degrees to radians. 1132 1133 \param[in] rValue Angle in degree to convert. 1134 \return Angle in radians. 1135 1136 \ingroup GrpBaseBaseMathFn 1015 1137 */ 1016 1017 1138 inline 1018 1139 Real32 osgdegree2rad(const Real32 rValue) 1019 1140 { … … 1022 1143 1023 1144 /*! \ingroup GrpBaseBaseMathFn 1024 1145 */ 1025 1026 1146 inline 1027 1147 Real64 osgdegree2rad(const Real64 rValue) 1028 1148 { … … 1031 1151 1032 1152 /*! \ingroup GrpBaseBaseMathFn 1033 1153 */ 1034 1035 1154 inline 1036 1155 Fixed32 osgdegree2rad(const Fixed32 rValue) 1037 1156 { … … 1055 1174 /*! \name rad2degree */ 1056 1175 /*! \{ */ 1057 1176 1058 /*! \ingroup GrpBaseBaseMathFn 1177 /*! Converts the argument angle from radians to degrees. 1178 1179 \param[in] rValue Angle in radians to convert. 1180 \return Angle in degrees. 1181 1182 \ingroup GrpBaseBaseMathFn 1059 1183 */ 1060 1061 1184 inline 1062 1185 Real32 osgrad2degree(const Real32 rValue) 1063 1186 { … … 1066 1189 1067 1190 /*! \ingroup GrpBaseBaseMathFn 1068 1191 */ 1069 1070 1192 inline 1071 1193 Real64 osgrad2degree(const Real64 rValue) 1072 1194 { … … 1075 1197 1076 1198 /*! \ingroup GrpBaseBaseMathFn 1077 1199 */ 1078 1079 1200 inline 1080 1201 Fixed32 osgrad2degree(const Fixed32 rValue) 1081 1202 { … … 1084 1205 1085 1206 /*! \ingroup GrpBaseBaseMathFn 1086 1207 */ 1087 1088 1208 template <class FloatTypeT> inline 1089 1209 typename TypeTraits<FloatTypeT>::RealReturnType 1090 1210 osgrad2degree(const FloatTypeT rValue) … … 1099 1219 /*! \name deg2rad / rad2deg */ 1100 1220 /*! \{ */ 1101 1221 1102 /*! \ingroup GrpBaseBaseMathFn 1222 /*! Converts the argument angle from degrees to radians. 1223 1224 \param[in] rValue Angle in degree to convert. 1225 \return Angle in radians. 1226 1227 \ingroup GrpBaseBaseMathFn 1103 1228 */ 1104 1105 1229 template <class FloatTypeT> inline 1106 1230 typename TypeTraits<FloatTypeT>::RealReturnType 1107 1231 deg2rad(const FloatTypeT rValue) … … 1109 1233 return osgdegree2rad(rValue); 1110 1234 } 1111 1235 1112 /*! \ingroup GrpBaseBaseMathFn 1236 /*! Converts the argument angle from radians to degrees. 1237 1238 \param[in] rValue Angle in radians to convert. 1239 \return Angle in degrees. 1240 1241 \ingroup GrpBaseBaseMathFn 1113 1242 */ 1114 1115 1243 template <class FloatTypeT> inline 1116 1244 typename TypeTraits<FloatTypeT>::RealReturnType 1117 1245 rad2deg(const FloatTypeT rValue) … … 1124 1252 /*! \name ispower2 */ 1125 1253 /*! \{ */ 1126 1254 1127 /*! \ingroup GrpBaseBaseMathFn 1255 /*! Test if the argument is a power of 2 or zero. 1256 1257 \param[in] rValue Number to test. 1258 \return true if rValue is a power of 2 or zero. 1259 1260 \ingroup GrpBaseBaseMathFn 1128 1261 */ 1129 1130 1262 template <> inline 1131 1263 bool osgispower2<UInt32>(UInt32 rValue) 1132 1264 { … … 1146 1278 return true; 1147 1279 } 1148 1280 1149 /*! \ingroup GrpBaseBaseMathFn 1281 /*! Test if the argument is a power of 2 or zero. 1282 1283 \param[in] rValue Number to test, must be >= 0. 1284 \return true if rValue is a power of 2 or zero. 1285 1286 \ingroup GrpBaseBaseMathFn 1150 1287 */ 1151 1152 1288 template <> inline 1153 1289 bool osgispower2<Int32>(Int32 rValue) 1154 1290 { … … 1173 1309 /*! \name nextpower2 */ 1174 1310 /*! \{ */ 1175 1311 1176 /*! \ingroup GrpBaseBaseMathFn 1312 /*! Return the next larger power of 2, i.e. the smallest power of 2 not less 1313 than \a rValue. 1314 1315 \param[in] rValue The lower bound for the wanted power of 2. 1316 \return A power of 2 to not less than \a rValue. 1317 1318 \ingroup GrpBaseBaseMathFn 1177 1319 */ 1178 1179 1320 template <> inline 1180 1321 UInt32 osgnextpower2<UInt32>(UInt32 rValue) 1181 1322 { … … 1193 1334 1194 1335 /*! \ingroup GrpBaseBaseMathFn 1195 1336 */ 1196 1197 1337 template <> inline 1198 1338 Int32 osgnextpower2<Int32>(Int32 rValue) 1199 1339 { … … 1211 1351 1212 1352 /*! \ingroup GrpBaseBaseMathFn 1213 1353 */ 1214 1215 1354 template <> inline 1216 1355 Int64 osgnextpower2<Int64>(Int64 rValue) 1217 1356 { … … 1229 1368 1230 1369 /*! \ingroup GrpBaseBaseMathFn 1231 1370 */ 1232 1233 1371 template <> inline 1234 1372 UInt64 osgnextpower2<UInt64>(UInt64 rValue) 1235 1373 { … … 1249 1387 1250 1388 /*! \ingroup GrpBaseBaseMathFn 1251 1389 */ 1252 1253 1390 template <> inline 1254 1391 size_t osgnextpower2<size_t>(size_t rValue) 1255 1392 { … … 1268 1405 #endif 1269 1406 1270 1407 /*! \} */ 1271 / /---------------------------------------------------------------------------1272 / / Misc Functions1273 / /---------------------------------------------------------------------------1408 /*---------------------------------------------------------------------*/ 1409 /*! \name Misc */ 1410 /*! \{ */ 1274 1411 1275 /*! find the index that has the largest absolute value for a vec3/pnt3 1412 /*! Returns the index of the element that has the largest absolute value in 1413 a Vec3 or Pnt3. 1414 1415 \param[in] v Input Vec3 or Pnt3. 1416 \return Index of the element with largest absolute value. 1417 1276 1418 \ingroup GrpBaseBaseMiscFn 1277 1419 */ 1278 1279 1280 1420 template<class VecPntT> inline 1281 1421 UInt32 getMaxIndexAbs3(const VecPntT &v) 1282 1422 { … … 1286 1426 (osgabs(v[1]) > osgabs(v[2]) ? 1 : 2); 1287 1427 } 1288 1428 1289 /*! \ingroup GrpBaseBaseMiscFn 1429 #ifndef OSG_WINCE 1430 /*! Sets or removes an environment variable. If the \a string is of the form 1431 <tt>name=value</tt> the env. variable \c name is set to \c value. Otherwise 1432 the contents of \a string a interpreted as the name of an env. variable and 1433 any definition of this variable is removed from the environment. 1434 1435 \param[in] string String to put into the environment. 1436 1437 \note This function forwards to an appropriate C++ or C library function, 1438 hence exhibits the respective error behavior. 1439 1440 \warning The exact \a string is put into the environment, any changes to 1441 it will be directly reflected there. The lifetime of \a string must only end 1442 when the program terminates. 1443 1444 \ingroup GrpBaseBaseMiscFn 1290 1445 */ 1291 1292 #ifndef OSG_WINCE1293 1446 inline 1294 1447 Int32 putenv(Char8 *string) 1295 1448 { … … 1307 1460 } 1308 1461 #endif 1309 1462 1310 /*! \ingroup GrpBaseBaseMiscFn 1311 */ 1463 /*! Pause program execution for the given number of milliseconds. 1312 1464 1465 \param[in] millisecs Duration of the pause. 1313 1466 1467 \ingroup GrpBaseBaseMiscFn 1468 */ 1314 1469 inline 1315 1470 void osgsleep(UInt32 millisecs) 1316 1471 { … … 1351 1506 #endif 1352 1507 } 1353 1508 1354 /*! get a random value between 0 and 1 1509 /*! Returns a uniformly distributed random Real32 between 0 and 1 inclusive. 1510 1511 \return A random Real32 number between 0 and 1 inclusive. 1512 1355 1513 \ingroup GrpBaseBaseMiscFn 1356 1514 */ 1357 1358 1359 1515 inline 1360 1516 Real32 osgrand(void) 1361 1517 { 1362 1518 return rand() / (Real32) RAND_MAX; 1363 1519 } 1364 1520 1365 /*! return true if the current system is big endian 1521 #if defined(WIN32) && defined(_MSC_VER) 1522 #if _MSC_VER <= 1200 // VC6 1523 /*! Write a UInt64 value to the given stream. 1524 1525 \param[in] os Output stream to write to. 1526 \param[in] v Value to write. 1527 \return The given output stream. 1528 1366 1529 \ingroup GrpBaseBaseMiscFn 1367 1530 */ 1368 1369 1531 inline 1370 bool osgIsBigEndian(void)1371 {1372 return (BYTE_ORDER) == (BIG_ENDIAN);1373 }1374 1375 #if defined(WIN32) && defined(_MSC_VER)1376 #if _MSC_VER <= 1200 // VC61377 inline1378 1532 std::ostream &operator<<(std::ostream &os, UInt64 v) 1379 1533 { 1380 1534 char buf[30]; … … 1382 1536 return os << buf; 1383 1537 } 1384 1538 1539 /*! Write a Int64 value to the given stream. 1540 1541 \param[in] os Output stream to write to. 1542 \param[in] v Value to write. 1543 \return The given output stream. 1544 1545 \ingroup GrpBaseBaseMiscFn 1546 */ 1385 1547 inline 1386 1548 std::ostream &operator<<(std::ostream &os, Int64 v) 1387 1549 { … … 1392 1554 #endif 1393 1555 #endif 1394 1556 1557 /*! \} */ 1395 1558 /*---------------------------------------------------------------------*/ 1396 /* big/little endian conversion functions */ 1559 /*! \name Byte Order */ 1560 /*! \{ */ 1397 1561 1562
