Coin Logo http://www.sim.no
http://www.coin3d.org

SbBox3f.h

00001 #ifndef COIN_SBBOX3F_H
00002 #define COIN_SBBOX3F_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2007 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 http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <stdio.h>
00028 
00029 #include <Inventor/SbVec3f.h>
00030 
00031 class SbMatrix;
00032 
00033 class COIN_DLL_API SbBox3f {
00034 public:
00035   SbBox3f(void);
00036   SbBox3f(const float minx, const float miny, const float minz,
00037           const float maxx, const float maxy, const float maxz);
00038   SbBox3f(const SbVec3f & min, const SbVec3f & max);
00039   ~SbBox3f();
00040 
00041   const SbVec3f & getMin(void) const;
00042   const SbVec3f & getMax(void) const;
00043   SbVec3f & getMin(void);
00044   SbVec3f & getMax(void);
00045 
00046   SbVec3f getCenter(void) const;
00047 
00048   void extendBy(const SbVec3f & point);
00049   void extendBy(const SbBox3f & box);
00050 
00051   SbBool intersect(const SbVec3f & point) const;
00052   SbBool intersect(const SbBox3f & box) const;
00053 
00054   void setBounds(const float minx, const float miny, const float minz,
00055                  const float maxx, const float maxy, const float maxz);
00056   void setBounds(const SbVec3f & min, const SbVec3f & max);
00057   void getBounds(float & minx, float & miny, float & minz,
00058                  float & maxx, float & maxy, float & maxz) const;
00059   void getBounds(SbVec3f & min, SbVec3f & max) const;
00060 
00061   void getOrigin(float & x0, float & y0, float & z0) const;
00062   void getSize(float & dx, float & dy, float & dz) const;
00063 
00064   void makeEmpty(void);
00065   SbBool isEmpty(void) const;
00066   SbBool hasVolume(void) const;
00067 
00068   void getSpan(const SbVec3f & dir, float & dmin, float & dmax) const;
00069   void transform(const SbMatrix & matrix);
00070   float getVolume(void) const;
00071 
00072   SbBool outside(const SbMatrix & mvp, int & cullbits) const;
00073   SbVec3f getClosestPoint(const SbVec3f & point) const;
00074 
00075   friend COIN_DLL_API int operator ==(const SbBox3f & b1, const SbBox3f & b2);
00076   friend COIN_DLL_API int operator !=(const SbBox3f & b1, const SbBox3f & b2);
00077 
00078   void print(FILE * file) const;
00079 
00080 private:
00081   SbVec3f min, max;
00082 };
00083 
00084 COIN_DLL_API int operator ==(const SbBox3f & b1, const SbBox3f & b2);
00085 COIN_DLL_API int operator !=(const SbBox3f & b1, const SbBox3f & b2);
00086 
00087 #endif // !COIN_SBBOX3F_H

Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.

Generated on Tue Apr 17 04:40:23 2007 for Coin by Doxygen. 1.4.6