VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
baseCoordinateSystem.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1999 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: baseCoord.h,v $ $Revision: 1.18 $ $State: Exp $
7 ******************************************************************************/
8 #ifndef baseCoordinateSystem_H_
9 #define baseCoordinateSystem_H_
10 
11 #include "gdb/gdbDefines.h"
12 #include "gdb/gdbNode.h"
14 
15 //forward declarations
16 class DtTerrainDatabase;
17 class DtExtent;
18 class DtChord;
19 class DtChordBundle;
22 class DtAllTypesPolygon;
23 
24 //
25 // Coordinate system.
26 //
28 {
29  public:
30 
32 
33  virtual ~DtBaseCoordinateSystem();
34 
35 private:
36  // Copy constructor and Assignment operator not implemented
39 
40 public:
41 
42  virtual DtGdbNode* child();
43  virtual const DtGdbNode* child() const;
44  virtual void setChild(DtGdbNode* node);
45 
46  virtual const DtHomogeneousTransformMatrix& fromChildXformForPoints() const;
47  virtual void setFromChildXformForPoints(DtHomogeneousTransformMatrix& matrix);
48 
49  virtual const DtHomogeneousTransformMatrix& toChildXformForPoints() const;
50  virtual void setToChildXformForPoints(DtHomogeneousTransformMatrix& matrix);
51 
52  virtual void dump(int indentLevel) const;
53 
54  // Finds all instances of node type searchType in the tree including and
55  // below this node.
56  virtual void allInstancesOf(const DtGdbNodeType searchType,
57  DtFoundInstancesContainer& foundInstances,
58  bool recurseIntoCoordSysNodes = false);
59 
60  virtual void allInstancesOf(const DtGdbNodeType searchType,
61  DtFoundInstancesConstContainer& foundInstances,
62  bool recurseIntoCoordSysNodes = false) const;
63 
64  virtual void allInstancesOf(const DtGdbNodeType searchType,
65  DtFoundInstancesContainer& foundInstances,
66  bool recurseIntoCoordSysNodes, DtGdbNodeEvaluationFunctor functor);
67 
68  virtual void allInstancesOf(const DtGdbNodeType searchType,
69  DtFoundInstancesConstContainer& foundInstances,
70  bool recurseIntoCoordSysNodes, DtGdbNodeEvaluationFunctor functor) const;
71 
72  // process the polygons included in the node that fall within the input
73  // extent, and update the color count in the colorCountRecord which is
74  // an in-out parameter.
75  virtual void countPolyColors(DtColorCountRecord& cr,const DtExtent& e) const;
76 
77  // reduce the DtBaseCoordinateSystem node by reducing its child node.
78  virtual DtGdbNode* reduce(int& numReductions);
79 
80  // ensure the validity of the CoordinateSystem node
81  virtual bool sanityCheck() const;
82 
83  virtual void expandExtent(DtExtent& extent) const;
84 
85  // Forces the child to recalculate its extent
86  virtual void recomputeExtent();
87 
88  // Computes the intersection of the terrain section below the coordinate
89  // system node object and a chord. Returns the intersection point and a
90  // parametric value.
91  virtual bool intersect(const DtChord& chord,
92  DtPoint& intersectionPoint,
93  double& intersectionTime) const;
94 
95  // Computes the intersection of the terrain section below the coordinate
96  // system node and a chord. In addition to the intersection point and a
97  // parametric value, optionally computes and returns surface description
98  // for the intersecting surface, and normal. Identifies the lowest level
99  // intersecting polygon. This function will only replace the contents of
100  // the intersection record if it finds an intersection with a smaller
101  // intersectionTime value.
102  virtual bool intersect(const DtChord& chord,
103  DtChordIntersectionRecord& record, DtIntersectRecordType irtFlag) const;
104 
105  // Computes the list of all intersections of a chord with the terrain
106  // section below the coordinate system node object. Adds to a list of
107  // DtChordIntersectionRecords sorted by distance along the chord. Returns
108  // false if no intersections exist. Note that passing an irtFlag value
109  // of IRT_NO_DATA will probably never return more than one intersection.
110  virtual bool allIntersectsAlongChord(const DtChord& chord,
112  DtIntersectRecordType irtFlag) const;
113 
114  // Computes the intersection of terrain section represented by the terrain
115  // section below the coordinate system node and a bundle of chords. The
116  // returned record list is a a DtList of DtChordIntersectionRecords (one
117  // for each chord) each of which must be created and deleted by the caller.
118  // The irtFlag value specifies which data should be calculated and returned
119  // for each intersection point. The return value of this function is the
120  // number of the chords that had any intersections with the terrain. This
121  // function will only replace the contents of the intersection records if
122  // it finds an intersection with a smaller intersectionTime value.
123  virtual int intersectBundle(const DtChordBundle& chordBundle,
124  DtList& recordList, DtIntersectRecordType irtFlag) const;
125 
126  // Computes the list of all intersections of each of a bundle of chords
127  // with the terrain section below the coordinate system node object. For
128  // each chord in the bundle, adds to a matching DtChordIntersectRecordList
129  // sorted by distance along the chord. The caller is responsible for
130  // creating and deleting the DtChordIntersectRecordLists in the intListList
131  // DtList. The return value of this function is the number of the chords
132  // that had any intersections with the terrain. Note that passing an
133  // irtFlag value of IRT_NO_DATA will probably never return more than one
134  // intersection per chord.
135  virtual int allIntersectsAlongChordBundle(
136  const DtChordBundle& chordBundle,
137  DtList& intListList, DtIntersectRecordType irtFlag) const;
138 
139  void initOtherMatricesFromMyToChildXformForPoints(void);
140  void initOtherMatricesFromMyFromChildXformForPoints(void);
141 
142  //Finds and replaces all three-sided polygons with triangles
143  //in the tree below this node.
144  virtual void polygonToTriangle(DtMemoryManager* memMgr,
145  unsigned int& numIndConverted, unsigned int& numIndTotal);
146 
147  // Finds and removes all instances of every node type in the tree below
148  // this node; deletes the nodes if they are not memory managed. It returns
149  // this.
150  virtual DtGdbNode* purgeAll();
151 
152  // Find the parent (if it exists of child in the tree under the node)
153  virtual DtGdbNode* parent(DtGdbNode *child);
154 
155  // remove the child (if it is) from this node
156  virtual DtGdbNode* removeChild(DtGdbNode *child);
157 
158  // Applies the input matrix to itself and its children as appropriate.
159  //
160  // Concatenates member homogeneous transform with specified transform
161  // matrix to create a transformation from child coords all
162  // the way to world coords.
163  // Returns false if the transform failed for any reason.
164  // (after using, in parent node, should replace coordinate system
165  // node with its child node.)
166  // Note: If the transform matrix is non-identity, will change the
167  // flag to true if it is already not.
168  virtual bool applyTransform(const DtHomogeneousTransformMatrix& matrix,
169  bool createNewVertices);
170 
171  virtual int sizeInBytes() const;
172 
173 protected:
174 
175 
176  // Copy a given polygon to my Coordinate system
177  virtual DtAllTypesPolygon* copyPolygonToMyCs(
178  const DtAllTypesPolygon& orig) const;
179 
180  // Translate a given intersection record to my Coordinate system
181  virtual void chordIntersectionRecordChildsCsToMyCs(
182  const DtChordIntersectionRecord& recordInChildsCs,
183  DtChordIntersectionRecord& recordInMyCs,
184  DtIntersectRecordType irtFlag) const;
185 
186  // Translate a given list of intersection records to my Coordinate system.
187  // This modifies the records in its first argument!
188  virtual void chordIntersectRecordListChildsCsToMyCs(
189  DtChordIntersectRecordList& intListInChildsCs,
190  DtIntersectRecordType irtFlag) const;
191 
193 
196 };
197 
199 {
200  return myChild;
201 }
203 {
204  return myChild;
205 }
206 
208 {
209  myChild = node;
210 }
211 
213 {
215 }
216 
219 {
220  myFromChildXformForPoints = matrix;
221 }
222 
224 {
225  return myToChildXformForPoints;
226 }
227 
230 {
231  myToChildXformForPoints = matrix;
232 }
233 
234 /****************************************************************
235  * Dynamic coordinate system.
236  ****************************************************************/
237 
239 {
240  public:
241 
243 
244  void dump(int indentLevel) const;
245  DtGdbNodeType type(void) const;
246 };
247 
248 
249 /****************************************************************
250  * Static coordinate system.
251  ****************************************************************/
252 
253 
255 {
256  public:
257 
259 
260  void dump(int indentLevel) const;
261  DtGdbNodeType type(void) const;
262 };
263 
264 #endif
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
Definition: chordIntersectionRecord.h:23
Definition: memoryManager.h:33
virtual DtGdbNode * removeChild(DtGdbNode *child)
Definition: colorCountRecord.h:21
Definition: chordIntersectRecordList.h:29
DtGdbNodeType
Definition: gdbNode.h:48
Definition: gdbNode.h:44
virtual const DtHomogeneousTransformMatrix & fromChildXformForPoints() const
Definition: baseCoordinateSystem.h:212
virtual bool intersect(const DtChord &chord, DtPoint &intersectionPoint, double &intersectionTime) const
virtual void expandExtent(DtExtent &extent) const
virtual DtGdbNode * parent(DtGdbNode *child)
virtual void countPolyColors(DtColorCountRecord &cr, const DtExtent &e) const
virtual int sizeInBytes() const =0
virtual DtGdbNode * purgeAll()
DtIntersectRecordType
Definition: gdbNode.h:74
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
virtual void polygonToTriangle(DtMemoryManager *memMgr, unsigned int &numIndConverted, unsigned int &numIndTotal)
Definition: allTypesPolygon.h:22
#define DT_DLL_gdb
Definition: gdbDefines.h:25
std::set< DtGdbNode * > DtFoundInstancesContainer
Definition: gdbNode.h:221
virtual void allInstancesOf(const DtGdbNodeType searchType, DtFoundInstancesContainer &foundInstances, bool recurseIntoCoordSysNodes=false)
DtHomogeneousTransformMatrix myFromChildXformForPoints
Definition: baseCoordinateSystem.h:195
Definition: baseCoordinateSystem.h:254
virtual bool allIntersectsAlongChord(const DtChord &chord, DtChordIntersectRecordList &intList, DtIntersectRecordType irtFlag) const
void dump(int indentLevel) const
virtual DtGdbNode * child()
Definition: baseCoordinateSystem.h:198
DtGdbNode * myChild
Definition: baseCoordinateSystem.h:192
virtual bool sanityCheck() const
Definition: chordBundle.h:29
Definition: gdbNodeEvaluationFunctor.h:28
void dump(int indentLevel) const
virtual DtGdbNode * reduce(int &numReductions)
std::set< const DtGdbNode * > DtFoundInstancesConstContainer
Definition: gdbNode.h:225
virtual bool applyTransform(const DtHomogeneousTransformMatrix &matrix, bool createNewVertices)
virtual int allIntersectsAlongChordBundle(const DtChordBundle &chordBundle, DtList &intListList, DtIntersectRecordType irtFlag) const
virtual const DtHomogeneousTransformMatrix & toChildXformForPoints() const
Definition: baseCoordinateSystem.h:223
DtHomogeneousTransformMatrix myToChildXformForPoints
Definition: baseCoordinateSystem.h:194
virtual void recomputeExtent()
Definition: baseCoordinateSystem.h:27
DtGdbNodeType type(void) const
virtual void setChild(DtGdbNode *node)
Definition: baseCoordinateSystem.h:207
Definition: terrainDatabase.h:148
DtGdbNode & operator=(const DtGdbNode &orig)
virtual void dump(int indentLevel) const =0
virtual void setToChildXformForPoints(DtHomogeneousTransformMatrix &matrix)
Definition: baseCoordinateSystem.h:228
Definition: homogeneousTransformMatrix.h:25
Definition: baseCoordinateSystem.h:238
virtual void setFromChildXformForPoints(DtHomogeneousTransformMatrix &matrix)
Definition: baseCoordinateSystem.h:217
virtual int intersectBundle(const DtChordBundle &chordBundle, DtList &recordList, DtIntersectRecordType irtFlag) const
Definition: point.h:34
DtGdbNodeType type(void) const

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)