VR-Forces 4.1 Class Documentation
allPoly.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2000 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: allPoly.h,v $ $Revision: 1.20 $ $State: Exp $
7 *********************************************************************/
8 #ifndef allPoly_H_
9 #define allPoly_H_
10 
11 #include "gdb/gdbDefines.h"
12 #include "gdb/gdbNode.h"
13 
14 // forward declarations
15 class DtSurface;
16 
17 // class DtAllTypesPolygon:
18 //
19 // DtAllTypesPolygon is an abstract base class for representing
20 // all types of polygons. This class contains no new state values.
21 // A polygon may be a general polygon or a triangle.
23 {
24 public:
25  // destructor
26  virtual ~DtAllTypesPolygon();
27 
28 protected:
29  //constructor is protected as this is an abstract
30  //base class.
32 
33  // copy constructor - unimplemented
35 
36  // assignment operator - unimplemented
38 
39 public:
40 
41  // Accessor functions
42 
43  virtual unsigned int numberOfVertices() const = 0;
44 
45  // @return The normal to polygon
46  virtual DtVector normal() const = 0;
47 
48  // @returns True if the specified edge exists, and false if it does not.
49  // If the edge exists, it is copied into the specified chord.
50  virtual bool getEdge(DtChord& edge, int edgeNumber) const = 0;
51  virtual void getNormal(DtVector& normal) const = 0;
52 
53  // if the polygon falls within the input extent, update the
54  // color count in the colorCountRecord which is an in-out parameter.
55  virtual void countPolyColors(DtColorCountRecord& cr,const DtExtent& e) const = 0;
56 
57  // Geometric functions
58 
59  // computes the intersection of chord with polygon; returns
60  // intersection point.
61  virtual bool intersect(const DtChord& chord, DtPoint& intersectionPoint, double& t) const = 0;
62 
63  // Computes the intersection of the polygon and a chord. In addition to the
64  // intersection point and a parametric value, optionally computes and
65  // returns surface description for the intersecting surface, and
66  // normal. Identifies the lowest level intersecting polygon. This function
67  // will only replace the contents of the intersection record if it finds an
68  // intersection with a smaller intersectionTime value.
69  virtual bool intersect(const DtChord& chord, DtChordIntersectionRecord& record,
70  DtIntersectRecordType irtFlag) const = 0;
71 
72  // Computes the intersection of terrain section represented by the polygon
73  // and a bundle of chords. The returned record list is a a DtList of
74  // DtChordIntersectionRecords (one for each chord) each of which must be
75  // created and deleted by the caller. The irtFlag value specifies which
76  // data should be calculated and returned for each intersection point. The
77  // return value of this function is the number of the chords that had any
78  // intersections with the terrain. This function will only replace the
79  // contents of the intersection records if it finds an intersection with a
80  // smaller intersectionTime value.
81  virtual int intersectBundle(const DtChordBundle& chordBundle,
82  DtList& recordList, DtIntersectRecordType irtFlag) const = 0;
83 
84  // \copydoc DtGdbNode::intersect(const DtSphere& sphere,
85  // DtSphereIntersectionRecord& record,
86  // DtIntersectRecordType irtFlag)
87  virtual bool intersect(const DtSphere& sphere, DtSphereIntersectionRecord& record,
88  DtIntersectRecordType irtFlag) const = 0;
89 
90  // determine the minimum and maximum z-values among the
91  // vertices in the polygon.
92  virtual double minZ() const = 0;
93  virtual double maxZ() const = 0;
94 
95  //accessor functions
96  virtual bool getVertex(DtPoint& retVal, unsigned int i) const = 0;
97  virtual const DtPoint& getVertex(unsigned int i) const = 0;
98 
99  virtual bool getSurface(DtSurface& s) const = 0;
100  virtual const DtSurface& getSurface() const = 0;
101  virtual bool setSurface(const DtSurface& newSurface) = 0;
102 
103 
104  // determine if a given point is inside the polygon.
105  virtual bool pointInPolygon(const DtPoint& point) const = 0;
106 
107  // Finds the point on the specified chord that is closest to this
108  // polygon, and returns it in closestPoint.
109  // \return Distance squared to the found point.
110  // If cutoffDistance is specified (> 0), the first point found within
111  // this distance will be returned, even if it is not the closest point.
112  // This may cut down significantly on the calculation when the actual
113  // closest point is not required.
114  virtual double closestPointOnChordToPolygon(const DtChord& chord,
115  DtPoint& closestPoint, double cutoffDistance = 0.) const = 0;
116 
117  virtual int sizeInBytes() const = 0;
118 };
119 
120 #endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)