00001 #ifndef INTERSECTION_H_
00002 #define INTERSECTION_H_
00003
00004 #include "math/Point3D.h"
00005 #include "math/Point2D.h"
00006 #include "math/Vec3D.h"
00007 #include <complex>
00008
00009 namespace rcrt
00010 {
00011
00012 class Primitive;
00013
00017 class Intersection
00018 {
00019 private:
00020 float distance;
00021 const Primitive* prim;
00022 Point3D position;
00023 Point2D parameters;
00024 Vec3D shadingNormal;
00025 Vec3D geomNormal;
00026 Vec3D shadingNormalLocal;
00027 Vec3D geomNormalLocal;
00028 Point2D uv;
00029 bool initSNo, initGNo, initSNoL, initGNoL, initUV, backside;
00030 std::complex<float> lastIOR;
00031
00032 public:
00033 Intersection();
00034
00044 Intersection(const float dist,const Primitive* p, const Point3D& pos,
00045 const float param1, const float param2, bool bs = false);
00046 virtual ~Intersection();
00047
00051 void setUV(const Point2D& uv);
00052
00056 bool isValid() const;
00057
00058 float getDistance() const;
00059 const Primitive* const getPrimitive() const;
00060 const Point3D& getPosition() const;
00061
00065 const Vec3D& getSNormalW();
00066
00070 const Vec3D& getGNormalW();
00071
00075 const Vec3D& getSNormalL();
00076
00080 const Vec3D& getGNormalL();
00081 void setSNormalW(const Vec3D& no);
00082 void setGNormalW(const Vec3D& no);
00083 void setSNormalL(const Vec3D& no);
00084 void setGNormalL(const Vec3D& no);
00085 void setPrimitive(const Primitive* p);
00086
00090 void setLastIOR(const std::complex<float>& ior);
00091 void setLastIOR(const float& real, const float& imag=0);
00092 const std::complex<float>& getLastIOR() const;
00093 const Point2D& getUV();
00094 const Point2D& getParams() const;
00095 const bool& backSide() const;
00096 };
00097
00098 }
00099
00100 #endif