forked from UVMCS120BS2020/AB-LF-Project3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.cpp
76 lines (62 loc) · 2.4 KB
/
Camera.cpp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// Created by Luke on 2/12/2020.
//
#include "Camera.h"
Camera::Camera() {
// This is a measure of maximum sharpness. It refers to the physical area (mm) on a focal plane where a point of light
// is most in focus, ie the maximum sharpness of a point of light when cast through a lens onto a focal plane.
circle_of_confusion = 0.02;
// This is a measure of the sensor or film width in millimeters. 36mm is the height of a standard 35mm film frame.
frame_width = 36.0;
// This is a measure of the sensor or film height in millimeters. 24mm is the height of a standard 35mm film frame.
frame_height = 24.0;
// make default lens
Rectilinear_Lens default_lens = Rectilinear_Lens();
lens = default_lens;
}
Camera::Camera(double circle_of_confusion_, double frame_width_, double frame_height_, const Rectilinear_Lens &lens_) {
this -> circle_of_confusion = circle_of_confusion_;
this -> frame_width = frame_width_;
this -> frame_height = frame_height_;
this -> lens = lens_;
}
double Camera::get_circle_of_confusion() const {
return circle_of_confusion;
}
void Camera::set_circle_of_confusion(double circle_of_confusion_) {
Camera::circle_of_confusion = circle_of_confusion_;
}
double Camera::get_frame_width() const {
return frame_width;
}
void Camera::set_frame_width(double frame_width_) {
Camera::frame_width = frame_width_;
}
double Camera::get_frame_height() const {
return frame_height;
}
void Camera::set_frame_height(double frame_height_) {
Camera::frame_height = frame_height_;
}
Rectilinear_Lens Camera::get_lens() const {
return lens;
}
Rectilinear_Lens & Camera::get_lens() {
return lens;
}
void Camera::set_lens(const Rectilinear_Lens &lens_) {
Camera::lens = lens_;
}
bool operator == (const Camera &LHS, const Camera &RHS) {
return (LHS.get_circle_of_confusion() == RHS.get_circle_of_confusion() &&
LHS.get_frame_width() == RHS.get_frame_width() &&
LHS.get_frame_height() == RHS.get_frame_height() &&
LHS.get_lens() == RHS.get_lens());
}
ostream& operator << (ostream& outs, const Camera &camera) {
outs << "CoC =\t\t" << camera.get_circle_of_confusion() << " mm" << endl;
outs << "Frame Width =\t" << camera.get_frame_width() << " mm" << endl;
outs << "Frame Height =\t" << camera.get_frame_height() << " mm" << endl;
outs << "Lens:\n" << camera.get_lens() << endl;
return outs;
}