00001 /**************************************************************************\ 00002 * 00003 * This file is part of the Coin 3D visualization library. 00004 * Copyright (C) 1998-2002 by Systems in Motion. All rights reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * version 2.1 as published by the Free Software Foundation. See the 00009 * file LICENSE.LGPL at the root directory of the distribution for 00010 * more details. 00011 * 00012 * If you want to use Coin for applications not compatible with the 00013 * LGPL, please contact SIM to acquire a Professional Edition license. 00014 * 00015 * Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY 00016 * http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097 00017 * 00018 \**************************************************************************/ 00019 00020 #ifndef COIN_SBXFBOX3F_H 00021 #define COIN_SBXFBOX3F_H 00022 00023 #include <stdio.h> 00024 #include <Inventor/SbBox3f.h> 00025 #include <Inventor/SbMatrix.h> 00026 00027 class COIN_DLL_API SbXfBox3f : public SbBox3f { 00028 typedef SbBox3f inherited; 00029 00030 public: 00031 SbXfBox3f(); 00032 SbXfBox3f(const SbVec3f &_min, const SbVec3f &_max); 00033 SbXfBox3f(const SbBox3f &box); 00034 ~SbXfBox3f(); 00035 00036 void setTransform(const SbMatrix &m); 00037 const SbMatrix &getTransform() const; 00038 const SbMatrix &getInverse() const; 00039 SbVec3f getCenter() const; 00040 void extendBy(const SbVec3f &pt); 00041 void extendBy(const SbBox3f &bb); 00042 void extendBy(const SbXfBox3f &bb); 00043 SbBool intersect(const SbVec3f &pt) const; 00044 SbBool intersect(const SbBox3f &bb) const; 00045 void getSpan(const SbVec3f &direction, float &dMin, float &dMax) const; 00046 SbBox3f project() const; 00047 friend COIN_DLL_API int operator ==(const SbXfBox3f &b1, const SbXfBox3f &b2); 00048 friend COIN_DLL_API int operator !=(const SbXfBox3f &b1, const SbXfBox3f &b2); 00049 // Must overload the transform() method from SbBox3f, as the box and 00050 // the transform matrix are supposed to be kept separate in 00051 // SbXfBox3f. --mortene 00052 void transform(const SbMatrix & m); 00053 // Overloaded from SbBox3f 00054 float getVolume(void) const; 00055 00056 void print(FILE * file) const; 00057 00058 private: 00059 // incorrect for SbXfBox3f. Hide them 00060 const SbVec3f & getMin(void) const {return SbBox3f::getMin(); } 00061 const SbVec3f & getMax(void) const { return SbBox3f::getMax(); } 00062 00063 void calcInverse(void) const; 00064 void makeInvInvalid(void); 00065 00066 SbMatrix matrix, invertedmatrix; 00067 }; 00068 00069 COIN_DLL_API int operator ==(const SbXfBox3f &b1, const SbXfBox3f &b2); 00070 COIN_DLL_API int operator !=(const SbXfBox3f &b1, const SbXfBox3f &b2); 00071 00072 #endif // !COIN_SBXFBOX3F_H