VR-Forces 4.0.4 Class Documentation
include/geometry/chrdIntRec.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1998 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: chrdIntRec.h,v $ $Revision: 1.14 $ $State: Exp $
00007 *********************************************************************/
00008 #ifndef chrdIntRec_H_
00009 #define chrdIntRec_H_
00010 
00011 // \file chrdIntRec.h
00012 // \brief Contains the DtChordIntersectionRecord class declaration.
00013 
00014 #include "geometry/intersectionRecord.h"
00015 #include "geometry/geometryDefines.h"
00016 #include "geometry/point.h"
00017 #include "geometry/surface.h"
00018 #include <matrix/vlVector.h>
00019 
00020 
00021 // Instances of DtChordIntersectionRecord are used to record the 
00022 // results of chord/primitive intersection attempts.
00023 class DT_DLL_geometry DtChordIntersectionRecord : public DtIntersectionRecord
00024 {
00025 public:
00026 
00027    // default constructor
00028    DtChordIntersectionRecord();
00029 
00030    //additional constructor 
00031    DtChordIntersectionRecord(DtPoint& intersectionPoint, 
00032                              double intersectionTime,
00033                              DtVector& normal, 
00034                              DtSurface* surface);
00035 
00036    // destructor
00037    virtual ~DtChordIntersectionRecord();
00038 
00039    // copy constructor
00040    DtChordIntersectionRecord(const DtChordIntersectionRecord& orig);
00041 
00042    // assignment operator
00043    // Note: if "orig" owns its own polygon, this will make a copy of the
00044    // polygon so that this object can own it's own copy.
00045    DtChordIntersectionRecord& operator=(const DtChordIntersectionRecord& orig);
00046 
00047    // clone this object
00048    virtual DtIntersectionRecord* clone() const;
00049 
00050    // The type of record used for the intersection query. Returns
00051    // CHORD_TYPE
00052    virtual DtRecordType type() const;
00053 
00054    //debugging aid
00055    virtual void dump() const;
00056 
00057    //set/get intersectionPoint
00058    const DtPoint intersectionPoint() const;
00059    const DtVector intersectionVector() const;
00060    void setIntersectionPoint(const DtPoint& pt);
00061 
00062    //set/get intersectionTime
00063    const double intersectionTime() const;
00064    void setIntersectionTime(double t);
00065 
00066    //set/get normal to intersecting terrain element
00067    const DtVector normal() const;
00068    void setNormal(const DtVector& v);
00069 
00070    //set/get intersecting surface
00071    const DtSurface surface() const;
00072    void setSurface(const DtSurface& s);
00073 
00074    // The number of intersection tests that were performed in order to fill in
00075    // this class can be kept, for instrumentation purposes.  These are the 
00076    // accessor functions.
00077    // @{
00078    // @returns The number of intersection tests associated with this record.
00079    inline unsigned int numberOfIntersectionTests() const;
00080    // Increments the current number of intersection tests by one.
00081    inline void incrementNumberOfIntersectionTests();
00082    // Set outright the number of intersection tests.
00083    inline void setNumberOfIntersectionTests(unsigned int newNumberOfTests);
00084    // @}
00085 
00086 protected:
00087 
00088    DtPoint        myIntersectionPoint;
00089    DtVector       myIntersectionVector;
00090    double         myIntersectionTime;
00091    DtVector       myNormal;
00092    DtSurface      mySurface;
00093 
00094 
00095    // This represents the total number of intersection tests that were 
00096    // performed to fill in this intersection record.  This is intended to 
00097    // be used for instrumentation purposes, and is included because of the
00098    // very low overhead.
00099    unsigned int   myNumberOfIntersectionTests;
00100 };
00101 
00102 inline const DtPoint DtChordIntersectionRecord::intersectionPoint() const
00103 {
00104    return myIntersectionPoint;
00105 }
00106 
00107 inline const DtVector DtChordIntersectionRecord::intersectionVector() const
00108 {
00109    return myIntersectionVector;
00110 }
00111 
00112 inline void DtChordIntersectionRecord::setIntersectionPoint(
00113    const DtPoint& pt)
00114 {
00115    myIntersectionPoint = pt;
00116 
00117    myIntersectionVector[0] = pt.x();
00118    myIntersectionVector[1] = pt.y();
00119    myIntersectionVector[2] = pt.z();
00120 }
00121 
00122 inline const double DtChordIntersectionRecord::intersectionTime() const
00123 {
00124    return myIntersectionTime;
00125 }
00126 
00127 inline void DtChordIntersectionRecord::setIntersectionTime(double t)
00128 {
00129    myIntersectionTime = t;
00130 }
00131 
00132 inline const DtVector DtChordIntersectionRecord::normal() const
00133 {
00134    return myNormal;
00135 }
00136 
00137 inline void DtChordIntersectionRecord::setNormal(const DtVector& v)
00138 {
00139    myNormal = v;
00140 }
00141 
00142 inline const DtSurface DtChordIntersectionRecord::surface() const
00143 {
00144    return mySurface;
00145 }
00146 
00147 inline void DtChordIntersectionRecord::setSurface(const DtSurface& s)
00148 {
00149    mySurface = s;
00150 }
00151 
00152 inline unsigned int DtChordIntersectionRecord::numberOfIntersectionTests() const
00153 {
00154    return myNumberOfIntersectionTests;
00155 }
00156 
00157 inline void DtChordIntersectionRecord::incrementNumberOfIntersectionTests()
00158 {
00159    ++myNumberOfIntersectionTests;
00160 }
00161 
00162 inline void DtChordIntersectionRecord::setNumberOfIntersectionTests(unsigned int newNumberOfTests)
00163 {
00164    myNumberOfIntersectionTests = newNumberOfTests;
00165 }
00166 
00167 
00168 #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)