![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 1998 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: tdbextent.h,v $ $Revision: 1.17 $ $State: Exp $ 00007 *******************************************************************************/ 00008 #ifndef tdbextent_H_ 00009 #define tdbextent_H_ 00010 00013 00014 #include "geometry/geometryDefines.h" 00015 #include "geometry/point.h" 00016 #ifndef NO_VRLINK 00017 #include <matrix/vlVector.h> 00018 #endif 00019 #include <iosfwd> 00020 class DtChord; 00021 class DtSphere; 00022 00042 00043 class DT_DLL_geometry DtExtent 00044 { 00045 public: 00046 00050 DtExtent(); 00051 00052 DtExtent(const DtExtent& orig); 00053 00054 00057 DtExtent(const double minX, const double maxX, 00058 const double minY, const double maxY, 00059 const double minZ, const double maxZ ); 00060 00064 DtExtent(const DtPoint& p0, const DtPoint& p1); 00065 00069 DtExtent(const DtChord& lineSeg); 00070 00071 virtual ~DtExtent(); 00072 00073 DtExtent& operator=(const DtExtent& orig); 00074 00075 virtual bool operator==(const DtExtent& rhs) const; 00076 virtual bool operator!=(const DtExtent& rhs) const; 00077 00078 //- -------------- access/manipulate size/shape routines ----------------- 00079 00081 00082 double minX() const; 00083 double minY() const; 00084 double minZ() const; 00085 double maxX() const; 00086 double maxY() const; 00087 double maxZ() const; 00088 00089 void setMinX(double x); 00090 void setMinY(double y); 00091 void setMinZ(double z); 00092 void setMaxX(double x); 00093 void setMaxY(double y); 00094 void setMaxZ(double z); 00096 00098 virtual const DtPoint center() const; 00099 00101 virtual void setCenter(const DtPoint& p); 00102 00104 virtual void setFromCenter(const DtPoint& p, 00105 const double& xDist, 00106 const double& yDist, 00107 const double& zDist); 00108 00109 00111 00112 double xSize() const; 00113 double ySize() const; 00114 double zSize() const; 00116 00118 virtual DtPoint maxPoint() const; 00119 00121 virtual DtPoint minPoint() const; 00122 00126 bool empty() const; 00127 00129 virtual void expandToInclude(const DtExtent& otherExtent); 00130 00132 virtual void expandToInclude(const DtPoint& point); 00133 00134 //- --------------- intersection tests --------------------------- 00135 //- --- could be potentially moved to an DtExtentIntersector class --- 00136 00139 virtual bool contains(const DtExtent& otherExtent) const; 00140 00143 virtual bool contains(const DtPoint& point) const; 00144 00147 virtual bool contains(const DtChord& chord) const; 00148 00151 bool intersects(const DtExtent& otherExtent) const; 00152 00155 bool doesNotIntersect(const DtExtent& otherExtent) const; 00156 00158 bool intersects(const DtSphere& sphere) const; 00159 00160 protected: 00161 00167 bool intersectsLineOfChord(const DtChord& chord, 00168 double& distInChordLengthsFirst, double& distInChordLengthsLast) const; 00169 00180 bool intersectsSoFar(const double pointVal, 00181 const double rayVal, const double side0, const double side1, 00182 double &firstTime, double &lastTime) const; 00183 00184 //- --------------- end intersection tests --------------------------- 00185 00186 protected: 00189 void guaranteeValidConstruction(); 00190 00191 protected: 00192 double myMinX; 00193 double myMaxX; 00194 double myMinY; 00195 double myMaxY; 00196 double myMinZ; 00197 double myMaxZ; 00198 00199 public: 00200 00202 static DtExtent& nullExtent(); 00203 00204 }; 00205 00206 #define tdbextent_inl 00207 #include "geometry/tdbextent.inl" 00208 #undef tdbextent_inl 00209 00210 DT_DLL_geometry std::ostream& operator<<(std::ostream& os, const DtExtent& extent); 00211 DT_DLL_geometry std::istream& operator>>(std::istream& is, DtExtent& extent); 00212 00213 #endif 00214