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

Revision 1692, 2.4 KB checked in by mattausch, 18 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
14
15typedef vector<RayInfo> RayInfoContainer;
16
17
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       
49        /** Extracts the scalar of the starting point of the ray segment
50                that lies in the axis.
51        */
52        float ExtrapOrigin(const int axis) const;
53        /** Extracts the scalar of the termination point of the ray segment
54                that lies in the axis.
55        */
56        float ExtrapTermination(const int axis) const;
57       
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       
66        float GetMinT () const;
67        float GetMaxT () const;
68       
69        void SetMinT (const float t);
70       
71        void SetMaxT (const float t);
72
73        float SegmentLength() const;
74        float SqrSegmentLength() const;
75
76        /** Computes intersection of this ray with the axis aligned split plane.
77       
78                @param axis axis of the split plane
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
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;
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;
94
95        friend void GetRayInfoSets(const RayInfoContainer &sourceRays,
96                                                           const int maxSize,
97                                                           RayInfoContainer &usedRays,
98                                                           RayInfoContainer *savedRays = NULL);
99};
100
101}
102#endif
103
Note: See TracBrowser for help on using the repository browser.