Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

SbBasic.h

00001 /* include/Inventor/SbBasic.h. Generated by configure. */ 00002 /**************************************************************************\ 00003 * 00004 * This file is part of the Coin 3D visualization library. 00005 * Copyright (C) 1998-2003 by Systems in Motion. All rights reserved. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License 00009 * version 2.1 as published by the Free Software Foundation. See the 00010 * file LICENSE.LGPL at the root directory of the distribution for 00011 * more details. 00012 * 00013 * If you want to use Coin for applications not compatible with the 00014 * LGPL, please contact SIM to acquire a Professional Edition license. 00015 * 00016 * Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY 00017 * http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097 00018 * 00019 \**************************************************************************/ 00020 00021 #ifndef COIN_SBBASIC_H 00022 #define COIN_SBBASIC_H 00023 00024 /* *********************************************************************** */ 00025 00026 #include <Inventor/C/basic.h> 00027 00028 /* *********************************************************************** */ 00029 /* Trap people trying to use Inventor headers while compiling C source code. 00030 * (we get support mail about this from time to time) 00031 */ 00032 #ifndef __cplusplus 00033 #error You are not compiling C++ - maybe your source file is named <file>.c 00034 #endif 00035 00036 /* *********************************************************************** */ 00037 /* Include these for Open Inventor compatibility reasons (they are not 00038 * actually used in Coin.) 00039 */ 00040 #define SoEXTENDER 00041 #define SoINTERNAL 00042 00043 /* *********************************************************************** */ 00044 00045 /* Some useful inline template functions: 00046 * SbAbs(Val) - returns absolute value 00047 * SbMin(Val1, Val2) - returns minimum value 00048 * SbMax(Val1, Val2) - returns maximum value 00049 * SbClamp(Val, Min, Max) - returns clamped value 00050 * SbSwap(Val1, Val2) - swaps the two values (no return value) 00051 * SbSqr(val) - returns (val)² 00052 */ 00053 00054 template <class Type> 00055 inline Type SbAbs( Type Val ) { 00056 return (Val < 0) ? 0 - Val : Val; 00057 } 00058 00059 template <class Type> 00060 inline Type SbMax( const Type A, const Type B ) { 00061 return (A < B) ? B : A; 00062 } 00063 00064 template <class Type> 00065 inline Type SbMin( const Type A, const Type B ) { 00066 return (A < B) ? A : B; 00067 } 00068 00069 template <class Type> 00070 inline Type SbClamp( const Type Val, const Type Min, const Type Max ) { 00071 return (Val < Min) ? Min : (Val > Max) ? Max : Val; 00072 } 00073 00074 template <class Type> 00075 inline void SbSwap( Type & A, Type & B ) { 00076 Type T; T = A; A = B; B = T; 00077 } 00078 00079 template <class Type> 00080 inline Type SbSqr(const Type val) { 00081 return val * val; 00082 } 00083 00084 /* *********************************************************************** */ 00085 00086 #endif /* !COIN_SBBASIC_H */

Generated on Tue Jul 27 23:53:00 2004 for Coin by doxygen 1.3.7