source: GTP/trunk/Lib/Vis/Preprocessing/src/RayInfo.h @ 1149

Revision 1149, 2.4 KB checked in by mattausch, 18 years ago (diff)
RevLine 
[420]1#ifndef __RAYINFO_H__
2#define __RAYINFO_H__
3
4#include <vector>
5using namespace std;
6
[860]7namespace GtpVisibilityPreprocessor {
8
[420]9class VssRay;
10class RayInfo;
[437]11class Plane3;
12class Vector3;
[420]13
[1133]14
[420]15typedef vector<RayInfo> RayInfoContainer;
[1133]16
17
[420]18/** Structure holding additional info about
19        the ray during traversal.
20*/
21class RayInfo
22{
23public:
24        /// pointer to the actual ray
25        VssRay *mRay;
26       
27        // endpoints  - do we need them?
28#if USE_FIXEDPOINT_T
29        short mMinT, mMaxT;
30#else
31        float mMinT, mMaxT;
32#endif
33       
34        RayInfo();
35       
36        RayInfo(VssRay *r);
37       
38        RayInfo(VssRay *r, const float _min, const float _max);
39       
40        RayInfo(VssRay *r, const short _min, const float _max);
41       
42        RayInfo(VssRay *r, const float _min, const short _max);
43               
44        friend bool operator<(const RayInfo &a, const RayInfo &b)
45        {
46                return a.mRay < b.mRay;
47        }
48       
[437]49        /** Extracts the scalar of the starting point of the ray segment
50                that lies in the axis.
51        */
[420]52        float ExtrapOrigin(const int axis) const;
[437]53        /** Extracts the scalar of the termination point of the ray segment
54                that lies in the axis.
55        */
[420]56        float ExtrapTermination(const int axis) const;
57       
[437]58        /** Extracts the starting point of the ray segment.
59        */
60        Vector3 ExtrapOrigin() const;
61       
62        /** Extracts the end point of the ray segment.
63        */
64        Vector3 ExtrapTermination() const;
65       
[420]66        float GetMinT () const;
67        float GetMaxT () const;
68       
69        void SetMinT (const float t);
70       
71        void SetMaxT (const float t);
72
[437]73        float SegmentLength() const;
74        float SqrSegmentLength() const;
75
[420]76        /** Computes intersection of this ray with the axis aligned split plane.
[437]77       
[420]78                @param axis axis of the split plane
[437]79                @param position scalar position of the split plane for the chosen axis
80                @param t returns the t parameter value of the ray intersection
[420]81
82                @returns 0 if ray intersects plane, -1 if on back side of plane, 1 if on front side
83        */
84        int ComputeRayIntersection(const int axis, const float position, float &t) const;
[437]85
86        /** Computes intersection of this ray with the split plane.
87
88                @param splitPlane the split plane
89                @param t returns the t parameter value of the ray intersection
90
91                @returns 0 if ray intersects plane, -1 if on back side of plane, 1 if on front side
92        */
93        int ComputeRayIntersection(const Plane3 &splitPlane, float &t) const;
[1147]94
[1149]95        friend void GetRayInfoSets(const RayInfoContainer &sourceRays,
96                const int maxSize,
97                RayInfoContainer &usedRays,
98                RayInfoContainer *savedRays = NULL);
[420]99};
100
[860]101}
[420]102#endif
103
Note: See TracBrowser for help on using the repository browser.