1 #include "InfinitePlane.hxx"
3 InfinitePlane::InfinitePlane(const Vec3f
& a
, const Vec3f
& n
, Shader
* shader
)
11 InfinitePlane::~InfinitePlane()
16 InfinitePlane::Intersect(Ray
& ray
)
18 Vec3f diff
= m_a
- ray
.origin();
19 float t
= diff
.dot(m_n
) / ray
.direction().dot(m_n
);
20 if (t
< Epsilon
|| t
> ray
.t())
30 InfinitePlane::GetNormal(Ray
& ray
)
36 InfinitePlane::CalcBounds()
38 if(fabs(m_n
[0]-1) < Epsilon
&& m_n
[1] < Epsilon
&& m_n
[2] < Epsilon
) {
39 // plane is parallel to y and z axes
40 return Box(Vec3f(m_a
[0]-Epsilon
, Infinity
, Infinity
),
41 Vec3f(m_a
[0]+Epsilon
, Infinity
, Infinity
));
42 } else if(m_n
[0] < Epsilon
&& fabs(m_n
[1]-1) < Epsilon
&& m_n
[2] < Epsilon
) {
43 // plane is parallel to x and z axes
44 return Box(Vec3f(Infinity
, m_a
[1]-Epsilon
, Infinity
),
45 Vec3f(Infinity
, m_a
[1]+Epsilon
, Infinity
));
46 } else if(m_n
[0] < Epsilon
&& m_n
[1] < Epsilon
&& fabs(m_n
[2]-1) < Epsilon
) {
47 // plane is parallel to x and y axes
48 return Box(Vec3f(Infinity
, Infinity
, m_a
[2]-Epsilon
),
49 Vec3f(Infinity
, Infinity
, m_a
[2]+Epsilon
));
56 InfinitePlane::InVoxel(const Box
& box
)
This page took 0.045936 seconds and 5 git commands to generate.