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

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