-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTriangle.h
32 lines (25 loc) · 829 Bytes
/
Triangle.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
/*
Triangle.h
Defines intersections for triangle objects.
*/
#ifndef I_TRNGL
#define I_TRNGL
#include <glm/glm.hpp>
#include "Shape.h"
#include "Intersection.h"
#include "AABB.h"
class Triangle : public Shape {
public:
Triangle(glm::dvec3& vertex0, glm::dvec3& vertex1, glm::dvec3& vertex2);
Triangle(glm::dvec3& vertex0, glm::dvec3& vertex1, glm::dvec3& vertex2,
glm::dvec3& normal0, glm::dvec3& normal1, glm::dvec3& normal2);
~Triangle();
int getIntersectionPoint(const Ray& ray, Intersection& intersection, const double dt);
bool doesRayIntersect(const Ray& ray, const double tmax, const double dt);
private:
glm::dvec3* vertexArray;
glm::dvec3* normalArray;
glm::dvec3 faceNormal;
bool isFace;
};
#endif