Open Inventor Reference
MeVis/ThirdParty/Sources/Inventor/inventor/lib/database/include/Inventor/SbBasic.h
Go to the documentation of this file.
00001 /*
00002  *
00003  *  Copyright (C) 2000 Silicon Graphics, Inc.  All Rights Reserved. 
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  Further, this software is distributed without any warranty that it is
00016  *  free of the rightful claim of any third person regarding infringement
00017  *  or the like.  Any license provided herein, whether implied or
00018  *  otherwise, applies only to this software file.  Patent licenses, if
00019  *  any, provided herein do not apply to combinations of this program with
00020  *  other software, or any other product whatsoever.
00021  * 
00022  *  You should have received a copy of the GNU Lesser General Public
00023  *  License along with this library; if not, write to the Free Software
00024  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  *  Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
00027  *  Mountain View, CA  94043, or:
00028  * 
00029  *  http://www.sgi.com 
00030  * 
00031  *  For further information regarding this notice, see: 
00032  * 
00033  *  http://oss.sgi.com/projects/GenInfo/NoticeExplan/
00034  *
00035  */
00036 
00037 
00038 /*
00039  * Copyright (C) 1990,91   Silicon Graphics, Inc.
00040  *
00041  _______________________________________________________________________
00042  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
00043  |
00044  |   $Revision: 1.2 $
00045  |
00046  |   Description:
00047  |      This file contains basic SB library definitions.
00048  |
00049  |   Author(s)          : Paul S. Strauss, Nick Thompson
00050  |
00051  ______________  S I L I C O N   G R A P H I C S   I N C .  ____________
00052  _______________________________________________________________________
00053  */
00054 
00055 #ifndef  _SB_BASIC_
00056 #define  _SB_BASIC_
00057 
00058 #include <Inventor/system/SbSystem.h>
00065 #define SO_VERSION              2
00066 #define SO_VERSION_REVISION     5
00067 #define SO_VERSION_PATCHLEVEL   0
00068 #define SGI_VERSION             20500
00069 
00070 #include <inttypes.h>
00071 #include <stdint.h>
00072 #include <sys/types.h>
00073 #ifdef __sgi
00074 #include <libc.h>
00075 #include <sgidefs.h>
00076 #endif /* __sgi */
00077 #include <stdio.h>
00078 
00079 #ifndef FALSE
00080 #   define FALSE        0
00081 #   define TRUE         1
00082 #endif
00083 
00088 typedef int     SbBool;
00089 
00095 
00096 #ifdef __cplusplus
00097 
00098 template <class Type>
00099 inline Type SbAbs( Type Val ) {
00100     return (Val < 0) ? 0 - Val : Val;
00101 }
00102 
00103 template <class Type>
00104 inline void SbSwap( Type &A, Type &B ) {
00105     Type T; T = A; A = B; B = T;
00106 }
00107 
00108 template <class Type>
00109 inline Type SbMin( const Type A, const Type B ) {
00110     return (A < B) ? A : B;
00111 }
00112 
00113 template <class Type>
00114 inline Type SbMax( const Type A, const Type B ) {
00115     return (A < B) ? B : A;
00116 }
00117 
00118 template <class Type>
00119 inline Type SbClamp( const Type Val, const Type Min, const Type Max ) {
00120     return (Val < Min) ? Min : (Val > Max) ? Max : Val;
00121 }
00122 
00123 #endif /* __cplusplus */
00124 
00151 
00152 #define SoEXTENDER
00153 #define SoINTERNAL
00154 
00155 #ifndef M_E
00156 #define M_E             2.7182818284590452354
00157 #endif
00158 #ifndef M_LOG2E
00159 #define M_LOG2E         1.4426950408889634074
00160 #endif
00161 #ifndef M_LOG10E
00162 #define M_LOG10E        0.43429448190325182765
00163 #endif
00164 #ifndef M_LN2
00165 #define M_LN2           0.69314718055994530942
00166 #endif
00167 #ifndef M_LN10
00168 #define M_LN10          2.30258509299404568402
00169 #endif
00170 #ifndef M_PI
00171 #define M_PI            3.14159265358979323846
00172 #endif
00173 #ifndef M_PI_2
00174 #define M_PI_2          1.57079632679489661923
00175 #endif
00176 #ifndef M_PI_4
00177 #define M_PI_4          0.78539816339744830962
00178 #endif
00179 #ifndef M_1_PI
00180 #define M_1_PI          0.31830988618379067154
00181 #endif
00182 #ifndef M_2_PI
00183 #define M_2_PI          0.63661977236758134308
00184 #endif
00185 #ifndef M_2_SQRTPI
00186 #define M_2_SQRTPI      1.12837916709551257390
00187 #endif
00188 #ifndef M_SQRT2
00189 #define M_SQRT2         1.41421356237309504880
00190 #endif
00191 #ifndef M_SQRT1_2
00192 #define M_SQRT1_2       0.70710678118654752440
00193 #endif
00194 #ifndef MAXFLOAT
00195 #define MAXFLOAT        ((float)3.40282346638528860e+38)
00196 #endif
00197 
00204 
00205 #ifdef _DOUBLE_MATH_ONLY
00206 
00207 #define acosf acos
00208 #define asinf asin
00209 #define atanf atan
00210 #define atan2f atan2
00211 #define cosf cos
00212 #define sinf sin
00213 #define tanf tan
00214 #define powf pow
00215 #define sqrtf sqrt
00216 
00217 #endif /* _DOUBLE_MATH_ONLY */
00218 
00219 #endif /* _SB_BASIC_ */