# SbXfBox3f.h

    00001 #ifndef COIN_SBXFBOX3F_H
    00002 #define COIN_SBXFBOX3F_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <stdio.h>
    00028 #include <Inventor/SbBox3f.h>
    00029 #include <Inventor/SbMatrix.h>
    00030
    00031 class COIN_DLL_API SbXfBox3f : public SbBox3f {
    00032   typedef SbBox3f inherited;
    00033
    00034 public:
    00035   SbXfBox3f(void);
    00036   SbXfBox3f(const SbVec3f & boxmin, const SbVec3f & boxmax);
    00037   SbXfBox3f(const SbBox3f & box);
    00038   ~SbXfBox3f();
    00039
    00040   void setTransform(const SbMatrix & m);
    00041   const SbMatrix & getTransform(void) const;
    00042   const SbMatrix & getInverse(void) const;
    00043   SbVec3f getCenter(void) const;
    00044   void extendBy(const SbVec3f & pt);
    00045   void extendBy(const SbBox3f & bb);
    00046   void extendBy(const SbXfBox3f & bb);
    00047   SbBool intersect(const SbVec3f & pt) const;
    00048   SbBool intersect(const SbBox3f & bb) const;
    00049   SbBool intersect(const SbXfBox3f & bb) const;
    00050   void getSpan(const SbVec3f & direction, float & dMin, float & dMax) const;
    00051   SbBox3f project(void) const;
    00052   friend COIN_DLL_API int operator ==(const SbXfBox3f & b1, const SbXfBox3f & b2);
    00053   friend COIN_DLL_API int operator !=(const SbXfBox3f & b1, const SbXfBox3f & b2);
    00054   // Must override the transform() method from SbBox3f, as the box and
    00055   // the transform matrix are supposed to be kept separate in
    00056   // SbXfBox3f. --mortene
    00057   void transform(const SbMatrix & m);
    00058   // Overridden from SbBox3f
    00059   float getVolume(void) const;
    00060
    00061   void print(FILE * file) const;
    00062
    00063 private:
    00064   // incorrect for SbXfBox3f. Hide them
    00065   const SbVec3f & getMin(void) const {return SbBox3f::getMin(); }
    00066   const SbVec3f & getMax(void) const { return SbBox3f::getMax(); }
    00067
    00068   void calcInverse(void) const;
    00069   void makeInvInvalid(void);
    00070
    00071   SbMatrix matrix, invertedmatrix;
    00072 };
    00073
    00074 COIN_DLL_API int operator ==(const SbXfBox3f & b1, const SbXfBox3f & b2);
    00075 COIN_DLL_API int operator !=(const SbXfBox3f & b1, const SbXfBox3f & b2);
    00076
    00077 #endif // !COIN_SBXFBOX3F_H