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 SbBox3d;
00032 class SbBox3i32;
00033 class SbBox3s;
00034 
00035 class SbMatrix;
00036 
00037 class COIN_DLL_API SbBox3f {
00038 public:
00039   SbBox3f(void);
00040   SbBox3f(const float minx, const float miny, const float minz,
00041           const float maxx, const float maxy, const float maxz);
00042   SbBox3f(const SbVec3f & min, const SbVec3f & max);
00043   explicit SbBox3f(const SbBox3d & box) { setBounds(box); }
00044   explicit SbBox3f(const SbBox3s & box) { setBounds(box); }
00045   explicit SbBox3f(const SbBox3i32 & box) { setBounds(box); }
00046   ~SbBox3f();
00047 
00048   void setBounds(const float minx, const float miny, const float minz,
00049                  const float maxx, const float maxy, const float maxz);
00050   void setBounds(const SbVec3f & min, const SbVec3f & max);
00051   SbBox3f & setBounds(const SbBox3d & box);
00052   SbBox3f & setBounds(const SbBox3s & box);
00053   SbBox3f & setBounds(const SbBox3i32 & box);
00054 
00055   void getBounds(float & minx, float & miny, float & minz,
00056                  float & maxx, float & maxy, float & maxz) const;
00057   void getBounds(SbVec3f & min, SbVec3f & max) const;
00058 
00059   const SbVec3f & getMin(void) const;
00060   SbVec3f & getMin(void);
00061   const SbVec3f & getMax(void) const;
00062   SbVec3f & getMax(void);
00063 
00064   void extendBy(const SbVec3f & point);
00065   void extendBy(const SbBox3f & box);
00066   void transform(const SbMatrix & matrix);
00067   void makeEmpty(void);
00068   SbBool isEmpty(void) const;
00069   SbBool hasVolume(void) const;
00070   float getVolume(void) const;
00071 
00072   SbBool intersect(const SbVec3f & point) const;
00073   SbBool intersect(const SbBox3f & box) const;
00074   SbVec3f getClosestPoint(const SbVec3f & point) const;
00075   SbBool outside(const SbMatrix & mvp, int & cullbits) const;
00076 
00077   SbVec3f getCenter(void) const;
00078   void getOrigin(float & x0, float & y0, float & z0) const;
00079   void getSize(float & dx, float & dy, float & dz) const;
00080 
00081   void getSpan(const SbVec3f & dir, float & dmin, float & dmax) const;
00082 
00083   friend COIN_DLL_API int operator ==(const SbBox3f & b1, const SbBox3f & b2);
00084   friend COIN_DLL_API int operator !=(const SbBox3f & b1, const SbBox3f & b2);
00085 
00086   void print(FILE * file) const;
00087 
00088 private:
00089   SbVec3f min, max;
00090 };
00091 
00092 COIN_DLL_API int operator ==(const SbBox3f & b1, const SbBox3f & b2);
00093 COIN_DLL_API int operator !=(const SbBox3f & b1, const SbBox3f & b2);
00094 
00095 #endif // !COIN_SBBOX3F_H

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

Generated on Mon Feb 23 16:33:08 2009 for Coin by Doxygen. 1.5.8