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 "SbTypeDefs.h"
00071 
00072 #include <sys/types.h>
00073 #include <stdio.h>
00074 
00075 #ifndef FALSE
00076 #   define FALSE        0
00077 #   define TRUE         1
00078 #endif
00079 
00084 typedef int     SbBool;
00085 
00091 
00092 #ifdef __cplusplus
00093 
00094 template <class Type>
00095 inline Type SbAbs( Type Val ) {
00096     return (Val < 0) ? 0 - Val : Val;
00097 }
00098 
00099 template <class Type>
00100 inline void SbSwap( Type &A, Type &B ) {
00101     Type T; T = A; A = B; B = T;
00102 }
00103 
00104 template <class Type>
00105 inline Type SbMin( const Type A, const Type B ) {
00106     return (A < B) ? A : B;
00107 }
00108 
00109 template <class Type>
00110 inline Type SbMax( const Type A, const Type B ) {
00111     return (A < B) ? B : A;
00112 }
00113 
00114 template <class Type>
00115 inline Type SbClamp( const Type Val, const Type Min, const Type Max ) {
00116     return (Val < Min) ? Min : (Val > Max) ? Max : Val;
00117 }
00118 
00119 #endif /* __cplusplus */
00120 
00147 
00148 #define SoEXTENDER
00149 #define SoINTERNAL
00150 
00151 #ifndef M_E
00152 #define M_E             2.7182818284590452354
00153 #endif
00154 #ifndef M_LOG2E
00155 #define M_LOG2E         1.4426950408889634074
00156 #endif
00157 #ifndef M_LOG10E
00158 #define M_LOG10E        0.43429448190325182765
00159 #endif
00160 #ifndef M_LN2
00161 #define M_LN2           0.69314718055994530942
00162 #endif
00163 #ifndef M_LN10
00164 #define M_LN10          2.30258509299404568402
00165 #endif
00166 #ifndef M_PI
00167 #define M_PI            3.14159265358979323846
00168 #endif
00169 #ifndef M_PI_2
00170 #define M_PI_2          1.57079632679489661923
00171 #endif
00172 #ifndef M_PI_4
00173 #define M_PI_4          0.78539816339744830962
00174 #endif
00175 #ifndef M_1_PI
00176 #define M_1_PI          0.31830988618379067154
00177 #endif
00178 #ifndef M_2_PI
00179 #define M_2_PI          0.63661977236758134308
00180 #endif
00181 #ifndef M_2_SQRTPI
00182 #define M_2_SQRTPI      1.12837916709551257390
00183 #endif
00184 #ifndef M_SQRT2
00185 #define M_SQRT2         1.41421356237309504880
00186 #endif
00187 #ifndef M_SQRT1_2
00188 #define M_SQRT1_2       0.70710678118654752440
00189 #endif
00190 #ifndef MAXFLOAT
00191 #define MAXFLOAT        ((float)3.40282346638528860e+38)
00192 #endif
00193 
00200 
00201 #ifdef _DOUBLE_MATH_ONLY
00202 
00203 #define acosf acos
00204 #define asinf asin
00205 #define atanf atan
00206 #define atan2f atan2
00207 #define cosf cos
00208 #define sinf sin
00209 #define tanf tan
00210 #define powf pow
00211 #define sqrtf sqrt
00212 
00213 #endif /* _DOUBLE_MATH_ONLY */
00214 
00215 #endif /* _SB_BASIC_ */