#ifndef __RAYINFO_H__ #define __RAYINFO_H__ #include using namespace std; namespace GtpVisibilityPreprocessor { class VssRay; class RayInfo; class Plane3; class Vector3; typedef vector RayInfoContainer; /** Structure holding additional info about the ray during traversal. */ class RayInfo { public: /// pointer to the actual ray VssRay *mRay; // endpoints - do we need them? #if USE_FIXEDPOINT_T short mMinT, mMaxT; #else float mMinT, mMaxT; #endif RayInfo(); RayInfo(VssRay *r); RayInfo(VssRay *r, const float _min, const float _max); RayInfo(VssRay *r, const short _min, const float _max); RayInfo(VssRay *r, const float _min, const short _max); friend bool operator<(const RayInfo &a, const RayInfo &b) { return a.mRay < b.mRay; } /** Extracts the scalar of the starting point of the ray segment that lies in the axis. */ float ExtrapOrigin(const int axis) const; /** Extracts the scalar of the termination point of the ray segment that lies in the axis. */ float ExtrapTermination(const int axis) const; /** Extracts the starting point of the ray segment. */ Vector3 ExtrapOrigin() const; /** Extracts the end point of the ray segment. */ Vector3 ExtrapTermination() const; float GetMinT () const; float GetMaxT () const; void SetMinT (const float t); void SetMaxT (const float t); float SegmentLength() const; float SqrSegmentLength() const; /** Computes intersection of this ray with the axis aligned split plane. @param axis axis of the split plane @param position scalar position of the split plane for the chosen axis @param t returns the t parameter value of the ray intersection @returns 0 if ray intersects plane, -1 if on back side of plane, 1 if on front side */ int ComputeRayIntersection(const int axis, const float position, float &t) const; /** Computes intersection of this ray with the split plane. @param splitPlane the split plane @param t returns the t parameter value of the ray intersection @returns 0 if ray intersects plane, -1 if on back side of plane, 1 if on front side */ int ComputeRayIntersection(const Plane3 &splitPlane, float &t) const; friend void GetRayInfoSets(const RayInfoContainer &sourceRays, const int maxSize, RayInfoContainer &usedRays, RayInfoContainer *savedRays = NULL); }; } #endif