VR-Forces 4.0.4 Class Documentation
include/gdb/allPoly.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 2000 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: allPoly.h,v $ $Revision: 1.20 $ $State: Exp $
00007 *********************************************************************/
00008 #ifndef allPoly_H_
00009 #define allPoly_H_
00010 
00011 #include "gdb/gdbDefines.h"
00012 #include "gdb/gdbNode.h"
00013 
00014 // forward declarations
00015 class DtSurface;
00016 
00017 // class DtAllTypesPolygon:
00018 //
00019 // DtAllTypesPolygon is an abstract base class for representing
00020 // all types of polygons.  This class contains no new state values.
00021 // A polygon may be a general polygon or a triangle.
00022 class DT_DLL_gdb DtAllTypesPolygon : public DtGdbNode
00023 {
00024 public:
00025    // destructor
00026    virtual ~DtAllTypesPolygon();
00027 
00028 protected:
00029    //constructor is protected as this is an abstract
00030    //base class. 
00031    DtAllTypesPolygon();
00032 
00033    // copy constructor - unimplemented
00034    DtAllTypesPolygon(const DtAllTypesPolygon& orig);
00035 
00036    // assignment operator - unimplemented
00037    DtAllTypesPolygon& operator=(const DtAllTypesPolygon& orig);
00038 
00039 public:
00040 
00041    // Accessor functions 
00042 
00043    virtual unsigned int numberOfVertices() const = 0;
00044 
00045    // @return The normal to polygon
00046    virtual DtVector normal() const = 0;
00047    
00048    // @returns True if the specified edge exists, and false if it does not.
00049    // If the edge exists, it is copied into the specified chord.
00050    virtual bool getEdge(DtChord& edge, int edgeNumber) const = 0;
00051    virtual void getNormal(DtVector& normal) const  = 0;
00052 
00053    // if the polygon  falls within the input extent, update the 
00054    // color count in the colorCountRecord which is an in-out parameter.
00055    virtual void countPolyColors(DtColorCountRecord& cr,const DtExtent& e) const = 0;
00056 
00057    // Geometric functions
00058 
00059    // computes the intersection of chord with polygon; returns
00060    // intersection point.
00061    virtual bool intersect(const DtChord& chord, DtPoint& intersectionPoint, double& t) const = 0;
00062 
00063    // Computes the intersection of the polygon and a chord. In addition to the
00064    // intersection point and a parametric value, optionally computes and
00065    // returns surface description for the intersecting surface, and
00066    // normal. Identifies the lowest level intersecting polygon.  This function
00067    // will only replace the contents of the intersection record if it finds an
00068    // intersection with a smaller intersectionTime value.
00069    virtual bool intersect(const DtChord& chord, DtChordIntersectionRecord& record,
00070       DtIntersectRecordType irtFlag) const = 0;
00071 
00072    // Computes the intersection of terrain section represented by the polygon
00073    // and a bundle of chords. The returned record list is a a DtList of
00074    // DtChordIntersectionRecords (one for each chord) each of which must be
00075    // created and deleted by the caller.  The irtFlag value specifies which
00076    // data should be calculated and returned for each intersection point.  The
00077    // return value of this function is the number of the chords that had any
00078    // intersections with the terrain.  This function will only replace the
00079    // contents of the intersection records if it finds an intersection with a
00080    // smaller intersectionTime value.
00081    virtual int intersectBundle(const DtChordBundle& chordBundle,
00082       DtList& recordList, DtIntersectRecordType irtFlag) const = 0;
00083 
00084    // \copydoc DtGdbNode::intersect(const DtSphere& sphere, 
00085    // DtSphereIntersectionRecord& record,
00086    // DtIntersectRecordType irtFlag)
00087    virtual bool intersect(const DtSphere& sphere, DtSphereIntersectionRecord& record,
00088       DtIntersectRecordType irtFlag) const = 0;
00089 
00090    // determine the minimum and maximum z-values among the
00091    // vertices in the polygon.
00092    virtual  double minZ() const = 0;
00093    virtual  double maxZ() const = 0;
00094 
00095    //accessor functions
00096    virtual bool getVertex(DtPoint& retVal, unsigned int i) const = 0;
00097    virtual const DtPoint& getVertex(unsigned int i) const = 0;
00098 
00099    virtual bool getSurface(DtSurface& s) const = 0;
00100    virtual const DtSurface& getSurface() const = 0;
00101    virtual bool setSurface(const DtSurface& newSurface) = 0;
00102 
00103 
00104    // determine if a given point is inside the polygon.
00105    virtual bool pointInPolygon(const DtPoint& point) const = 0;
00106 
00107    // Finds the point on the specified chord that is closest to this
00108    // polygon, and returns it in closestPoint.
00109    // \return Distance squared to the found point.
00110    // If cutoffDistance is specified (> 0), the first point found within
00111    // this distance will be returned, even if it is not the closest point.
00112    // This may cut down significantly on the calculation when the actual
00113    // closest point is not required.
00114    virtual double closestPointOnChordToPolygon(const DtChord& chord, 
00115       DtPoint& closestPoint, double cutoffDistance = 0.) const = 0;
00116 
00117    virtual int sizeInBytes() const = 0;
00118 };
00119 
00120 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)