-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPolygon.h
38 lines (29 loc) · 880 Bytes
/
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
37
38
#ifndef POLYGON_H
#define POLYGON_H
#include "common.h"
#include "GeometryObject.h"
#include "Point.h"
#include "Normal.h"
class Polygon: public GeometryObject {
public:
Polygon();
Polygon(const vector <Point> &);
Polygon(const Point *, const int &);
// detect the polygon can construct a plane or not
void coplanarTest();
// some geometrical funtions
bool getNormal(Normal &) const;
bool inPolygon(const Point &) const;
virtual bool hit(const Ray &, RTdouble &, ShadeRec &) const;
virtual bool shadowHit(const Ray &, RTdouble &) const;
virtual RGBColor getColor() const;
virtual void setColor(const RGBColor &);
virtual Material * getMaterial() const;
virtual void setMaterial(Material *);
void print(const string &) const;
private:
vector <Point> vertices;
static const RTdouble kEpsilon;
bool coplanar;
};
#endif