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

Box.h

00001 /**************************************************************************\ 00002 * 00003 * FILE: Box.h 00004 * 00005 * This source file is part of DIME. 00006 * Copyright (C) 1998-1999 by Systems In Motion. All rights reserved. 00007 * 00008 * This library is free software; you can redistribute it and/or modify it 00009 * under the terms of the GNU General Public License, version 2, as 00010 * published by the Free Software Foundation. 00011 * 00012 * This library is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * General Public License (the accompanying file named COPYING) for more 00016 * details. 00017 * 00018 ************************************************************************** 00019 * 00020 * If you need DIME for a non-GPL project, contact Systems In Motion 00021 * to acquire a Professional Edition License: 00022 * 00023 * Systems In Motion http://www.sim.no/ 00024 * Prof. Brochs gate 6 sales@sim.no 00025 * N-7030 Trondheim Voice: +47 22114160 00026 * NORWAY Fax: +47 67172912 00027 * 00028 \**************************************************************************/ 00029 00030 #ifndef DIME_BOX_H 00031 #define DIME_BOX_H 00032 00033 #include <dime/Basic.h> 00034 #include <dime/util/Linear.h> 00035 00036 class DIME_DLL_API dimeBox 00037 { 00038 public: 00039 dimeVec3f min, max; 00040 public: 00041 dimeBox(); 00042 dimeBox(const dxfdouble x0, const dxfdouble y0, const dxfdouble z0, 00043 const dxfdouble x1, const dxfdouble y1, const dxfdouble z1); 00044 00045 void set(const dxfdouble x0, const dxfdouble y0, const dxfdouble z0, 00046 const dxfdouble x1, const dxfdouble y1, const dxfdouble z1); 00047 00048 void get(dxfdouble &x0, dxfdouble &y0, dxfdouble &z0, 00049 dxfdouble &x1, dxfdouble &y1, dxfdouble &z1) const; 00050 00051 bool operator & (const dimeBox &box) const; 00052 00053 bool pointInside(const dimeVec3f &pt) const; 00054 00055 dimeVec3f center() const; 00056 00057 void makeEmpty(); 00058 void grow(const dimeVec3f &pt); 00059 dxfdouble size() const; 00060 bool hasExtent() const; 00061 }; // class dimeBox 00062 00063 inline bool 00064 dimeBox::pointInside(const dimeVec3f &pt) const 00065 { 00066 return ! (pt[0] < this->min[0] || pt[0] >= this->max[0] || 00067 pt[1] < this->min[1] || pt[1] >= this->max[1] || 00068 pt[2] < this->min[2] || pt[2] >= this->max[2]); 00069 } 00070 00071 inline dimeVec3f 00072 dimeBox::center() const 00073 { 00074 return dimeVec3f((min[0]+max[0])*0.5f, 00075 (min[1]+max[1])*0.5f, 00076 (min[2]+max[2])*0.5f); 00077 } 00078 00079 #endif // ! DIME_BOX_H 00080

Copyright © 1998-1999, Systems In Motion <sales@sim.no>. All rights reserved.
System documentation was generated using doxygen.