![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: gdbChordIntersectionRecord.h,v $ $Revision: 1.1 $ $State: Exp $ 00007 ** Created: 2/2/10 MEM 00008 *********************************************************************/ 00009 #ifndef gdbChordIntersectionRecord_H_ 00010 #define gdbChordIntersectionRecord_H_ 00011 00012 // \file chrdIntRec.h 00013 // \brief Contains the DtGdbChordIntersectionRecord class declaration. 00014 #include "gdb/gdbDefines.h" 00015 #include "geometry/chrdIntRec.h" 00016 #include "geometry/point.h" 00017 #include "geometry/surface.h" 00018 #include <matrix/vlVector.h> 00019 00020 class DtAllTypesPolygon; 00021 00022 // Instances of DtGdbChordIntersectionRecord are used to record the 00023 // results of chord/primitive intersection attempts. 00024 class DT_DLL_gdb DtGdbChordIntersectionRecord : public DtChordIntersectionRecord 00025 { 00026 public: 00027 00028 // default constructor 00029 DtGdbChordIntersectionRecord(); 00030 00031 DtGdbChordIntersectionRecord(DtPoint& intersectionPoint, 00032 double intersectionTime, 00033 DtVector& normal, 00034 DtSurface* surface, 00035 DtAllTypesPolygon* polygon, 00036 bool ownPolygon); 00037 00038 // destructor 00039 virtual ~DtGdbChordIntersectionRecord(); 00040 00041 // copy constructor 00042 DtGdbChordIntersectionRecord(const DtGdbChordIntersectionRecord& orig); 00043 00044 // assignment operator 00045 // Note: if "orig" owns its own polygon, this will make a copy of the 00046 // polygon so that this object can own it's own copy. 00047 DtGdbChordIntersectionRecord& operator=(const DtGdbChordIntersectionRecord& orig); 00048 00049 // clone this object 00050 virtual DtIntersectionRecord* clone() const; 00051 00052 //debugging aid 00053 virtual void dump() const; 00054 00055 // The type of record used for the intersection query. Returns 00056 // DtIntersectionRecord::GDBCHORD_TYPE 00057 virtual DtRecordType type() const; 00058 00059 // Get a pointer to the intersecting polygon. 00060 DtAllTypesPolygon* polygon(); 00061 const DtAllTypesPolygon* polygon() const; 00062 00063 // \return A boolean indication whether or not the intersection record 00064 // owns the polygon it points to or not. If not, then the polygon is not 00065 // destroyed when the record is. If it is, then the polygon should only 00066 // be referenced while the record is still valid. 00067 bool ownPolygon() const; 00068 00069 // Set the intersecting polygon. 00070 // Makes it's own copy of the given polygon 00071 void setPolygon(const DtAllTypesPolygon& arg); 00072 00073 // Shares a pointer to someone else's polygon (it better outlast us) 00074 void sharePolygon(DtAllTypesPolygon* arg); 00075 00076 // Takes over ownership of the given polygon 00077 void takePolygon(DtAllTypesPolygon* arg); 00078 00079 // Like operator= except that it transfers ownership of the polygon to 00080 // another DtGdbChordIntersectionRecord instead of potentially copying it. 00081 virtual void copyAndStealPolygonFrom(DtGdbChordIntersectionRecord& donor); 00082 00083 protected: 00084 00085 // Make a copy of a polygon 00086 static DtAllTypesPolygon* copyPolygon(const DtAllTypesPolygon& orig); 00087 00088 // Most primitive polygon to get hit. 00089 DtAllTypesPolygon* myPolygon; 00090 bool myOwnPolygon; 00091 }; 00092 00093 inline DtAllTypesPolygon* DtGdbChordIntersectionRecord::polygon() 00094 { 00095 return myPolygon; 00096 } 00097 inline const DtAllTypesPolygon* DtGdbChordIntersectionRecord::polygon() const 00098 { 00099 return myPolygon; 00100 } 00101 00102 inline bool DtGdbChordIntersectionRecord::ownPolygon() const 00103 { 00104 return myOwnPolygon; 00105 } 00106 00107 #endif