VR-Link API Documentation for DIS
3dExtent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #ifndef _3dExtent_H
7 #define _3dExtent_H
8 
12 
13 
14 #include <vlutil/vlMachineTypes.h>
15 #include "3dPoint.h"
16 #include <iosfwd>
17 
18 #ifdef DtUSE_UTILITIES_NAMESPACE
19 namespace DtUSE_UTILITIES_NAMESPACE
20 {
21 #endif
22 
23 class Dt3dChord;
24 
46 {
47 public:
48 
52  Dt3dExtent();
53 
55  Dt3dExtent(const Dt3dExtent& orig);
56 
59  Dt3dExtent(const double minX, const double maxX,
60  const double minY, const double maxY,
61  const double minZ, const double maxZ );
62 
66  Dt3dExtent(const Dt3dPoint& p0, const Dt3dPoint& p1);
67 
71  Dt3dExtent(const Dt3dChord& lineSeg);
72 
73  virtual ~Dt3dExtent();
74 
75  Dt3dExtent& operator=(const Dt3dExtent& orig);
76 
77  virtual bool operator==(const Dt3dExtent& rhs) const;
78  virtual bool operator!=(const Dt3dExtent& rhs) const;
79 
80 //- -------------- access/manipulate size/shape routines -----------------
81 
83 
84  double minX() const;
85  double minY() const;
86  double minZ() const;
87  double maxX() const;
88  double maxY() const;
89  double maxZ() const;
90 
91  void setMinX(double x);
92  void setMinY(double y);
93  void setMinZ(double z);
94  void setMaxX(double x);
95  void setMaxY(double y);
96  void setMaxZ(double z);
98 
100  virtual const Dt3dPoint center() const;
101 
103  virtual void setCenter(const Dt3dPoint& p);
104 
106  virtual void setFromCenter(const Dt3dPoint& p,
107  const double& xDist,
108  const double& yDist,
109  const double& zDist);
110 
111 
113 
114  double xSize() const;
115  double ySize() const;
116  double zSize() const;
118 
120  virtual Dt3dPoint maxPoint() const;
121 
123  virtual Dt3dPoint minPoint() const;
124 
128  bool empty() const;
129 
131  virtual void expandToInclude(const Dt3dExtent& otherExtent);
132 
134  virtual void expandToInclude(const Dt3dPoint& point);
135 
137  virtual void expandToInclude(const Dt3dChord& chord);
138 
139 
140 //- --------------- intersection tests ---------------------------
141 //- --- could be potentially moved to an DtExtentIntersector class ---
142 
145  virtual bool contains(const Dt3dExtent& otherExtent) const;
146 
149  virtual bool contains(const Dt3dPoint& point) const;
150 
153  virtual bool contains(const Dt3dChord& chord) const;
154 
157  bool intersects(const Dt3dExtent& otherExtent) const;
158 
161  bool doesNotIntersect(const Dt3dExtent& otherExtent) const;
162 
166  bool intersects(const Dt3dChord& chord) const;
167 
168 protected:
169 
175  bool intersectsLineOfChord(const Dt3dChord& chord,
176  double& distInChordLengthsFirst, double& distInChordLengthsLast) const;
177 
188  bool intersectsSoFar(const double pointVal,
189  const double rayVal, const double side0, const double side1,
190  double &firstTime, double &lastTime) const;
191 
192 //- --------------- end intersection tests ---------------------------
193 
194 protected:
197  void guaranteeValidConstruction();
198 
199 protected:
200  double myMinX;
201  double myMaxX;
202  double myMinY;
203  double myMaxY;
204  double myMinZ;
205  double myMaxZ;
206 
207 public:
208 
210  static Dt3dExtent& nullExtent();
211 
212 };
213 
214 #define _3dExtent_inl
215 #include "3dExtent.inl"
216 #undef _3dExtent_inl
217 
218 DT_DLL_MATRIX std::ostream& operator<<(std::ostream& os, const Dt3dExtent& extent);
219 DT_DLL_MATRIX std::istream& operator>>(std::istream& is, Dt3dExtent& extent);
220 
221 #ifdef DtUSE_UTILITIES_NAMESPACE
222 }
223 #endif
224 
225 
226 #endif
227 

Document ID: Generated on Wed Aug 14 15:35:11 EDT 2013 from SVN revision 130445
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)