-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPolygon.h
36 lines (31 loc) · 1.03 KB
/
Polygon.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
#ifndef _POLYGON_H_
#define _POLYGON_H_ 1
#include "Shape.h"
#include "Ray.h"
#include "Material.h"
#include "Vector3.h"
#include <vector>
/**
* this is the polygon class inherited form the abstract shape class
*/
class Polygon:public Shape{
public:
// constructors
Polygon(const std::vector<Vector3> &_vertex,const Material &_material,const DynamicVector3Type &_animation);
Polygon(const Polygon &_orig);
void setVertex(int i,const Vector3 &_vertex);
Vector3 getVertex(int i)const;
int getVertexNum()const;
void setMaterial(const Material &_material);
Material getMaterial()const;
void setAnimation(const DynamicVector3Type &_animation);
DynamicVector3Type getAnimation()const;
void addVertex(const Vector3 &_vertex);
// implements the hit method of the Shape class
bool hit(const Ray &r,double tmax,double time,HitRecord &record)const;
private:
std::vector<Vector3> vertex;
Material material;
DynamicVector3Type animation; // the function that calculates the transform shift of this shape at a certain time
};
#endif // _POLYGON_H_