-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCubeQuad.h
69 lines (63 loc) · 1.91 KB
/
CubeQuad.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* CubeQuad.h
*
* Created on: 27 d�c. 2017
* Author: Ghassen_jlassi&Khalil_abid
*/
#ifndef CUBEQUAD_H_
#define CUBEQUAD_H_
#include "Shape.h"
#include "Vector3f.h"
class CubeQuad : public Shape{ // @suppress("Class has a virtual method and non-virtual destructor")
public:
CubeQuad();
/**
* @return CubeQuad : New instance of CubeQuad
*/
CubeQuad(Material m, Vector3f origin, Vector3f width, Vector3f height);
private:
Vector3f origin_;
Vector3f width_;
Vector3f height_;
public:
/**
* @return Vector3f : The origin of the cube quad
*/
Vector3f getOrigin() const { return origin_; }
/**
* @return Vector3f : The Width of the Cube quad intercepted
*/
Vector3f getWidth() const { return width_; }
/**
* @return Vector3f : The Height of the Cube quad intercepted
*/
Vector3f getHeight() const { return height_; }
public:
/**
* @brief If the ray is hiting
* @param ray Ray3f
* @return the boolean which test if the ray is hiting or not
*/
virtual bool is_hit(Ray3f &ray);
/**
* @brief Find the ray reflecting on the object
* @details it manages vector to get the direction, the normal vector and the vector position to find
* out the ray
* @param ray Ray3f
* @return \e the reflect ray
*/
virtual Ray3f reflect(Ray3f ray);
/**
* @brief Find the intersection between an object and a ray
* @details if the ray intersects an object in the scene, it will not be infinite in that direction
* it's going to stop and terminate at the intersection point
* @param ray Ray3f
* @return \e double the distance from our ray origin to the point of intersection
*/
virtual double Intersection(Ray3f ray);
virtual Vector3f getNormal(Vector3f position){
Vector3f N =(width_.crossProduct(height_)).normalize();
return N;
}
};
#endif /* CUBEQUAD_H_ */