-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.h
More file actions
54 lines (43 loc) · 1.64 KB
/
types.h
File metadata and controls
54 lines (43 loc) · 1.64 KB
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
#ifndef TYPES_RAY_H
#define TYPES_RAY_H
class colorRGB;
class intersection;
#include <Eigen/Dense>
#include <utility>
typedef Eigen::ParametrizedLine<double, 3> Line3d;
class colorRGB {
public:
double r,g,b;
colorRGB():r(0), g(0), b(0){}
colorRGB(const colorRGB& c): r(c.r), g(c.g), b(c.b){}
colorRGB(double v): r(v), g(v), b(v){}
colorRGB(double r, double g, double b): r(r), g(g), b(b){}
colorRGB operator* (const colorRGB &x) { return colorRGB(r*x.r, g*x.g, b*x.b); }
colorRGB operator+ (const colorRGB &x) { return colorRGB(r+x.r, g+x.g, b+x.b); }
colorRGB operator* (const double x) { return colorRGB(r*x, g*x, b*x); }
colorRGB operator/ (const double x) { return colorRGB(r/x, g/x, b/x); }
};
class intersection {
private:
bool _valid;
Eigen::Vector3d _from;
Eigen::Vector3d _pt;
Eigen::Vector3d _to;
double _depth;
colorRGB* _color;
Element* _element;
public:
intersection(): _valid(false), _from(Eigen::Vector3d(0,0,0)),
_pt(Eigen::Vector3d(0,0,0)), _to(Eigen::Vector3d(0,0,0)),
_depth(-1), _color(NULL), _element(NULL){}
intersection (bool v, Eigen::Vector3d p0, Eigen::Vector3d p, Eigen::Vector3d p1, double d, colorRGB* col, Element* elt) :
_valid(v), _from(p0), _pt(p), _to(p1), _depth(d), _color(col), _element(elt){}
bool valid(){ return _valid; }
colorRGB col(){ return *_color; }
Element* element() { return _element;}
Eigen::Vector3d &point() { return _pt;}
Eigen::Vector3d &fromPoint() { return _from;}
Eigen::Vector3d &toPoint() { return _to;}
double depth() {return _depth;}
};
#endif