-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangle.cpp
More file actions
49 lines (37 loc) · 1008 Bytes
/
Copy pathTriangle.cpp
File metadata and controls
49 lines (37 loc) · 1008 Bytes
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
/*
* Triangle.cpp
*
* Created on: Oct 22, 2015
* Author: hugocm93
*/
#include "Triangle.h"
#include "Ray.h"
Triangle::Triangle(Material* mat, Vec3d* vertex1, Vec3d* vertex2, Vec3d* vertex3, Vec3d* textureVertex1, Vec3d* textureVertex2, Vec3d* textureVertex3){
this->material = mat;
this->vertex1 = vertex1;
this->vertex2 = vertex2;
this->vertex3 = vertex3;
this->textureVertex1 = textureVertex1;
this->textureVertex2 = textureVertex2;
this->textureVertex3 = textureVertex3;
}
Triangle::~Triangle() {
// TODO Auto-generated destructor stub
}
double Triangle::computeIntersection(Ray* ray){
return NULL;
}
Vec3d* Triangle::computeNormal(Vec3d* position){
return NULL;
}
float Triangle::calcArea(Vec3d* p1, Vec3d* p2, Vec3d* p3){
Vec3d aux1 = *p2 - *p1;
Vec3d aux2 = *p3 - *p1;
Vec3d temp = Vec3d::crossProduct(aux1, aux2);
Vec3d* zero = new Vec3d(0,0,0);
return Vec3d::getDistance(*zero, temp)/2.0;
}
Vec3d Triangle::getSpecificPoint(Ray* ray){
Vec3d aux;
return aux;
}