gucoordinates
CameraCPP.cc
Go to the documentation of this file.
1/*
2 * Camera.cc
3 * guvision_utils
4 *
5 * Created by Callum McColl on 19/06/2020.
6 * Copyright © 2020 Callum McColl. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials
18 * provided with the distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgement:
22 *
23 * This product includes software developed by Callum McColl.
24 *
25 * 4. Neither the name of the author nor the names of contributors
26 * may be used to endorse or promote products derived from this
27 * software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
33 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
34 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
35 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
36 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 * -----------------------------------------------------------------------
42 * This program is free software; you can redistribute it and/or
43 * modify it under the above terms or under the terms of the GNU
44 * General Public License as published by the Free Software Foundation;
45 * either version 2 of the License, or (at your option) any later version.
46 *
47 * This program is distributed in the hope that it will be useful,
48 * but WITHOUT ANY WARRANTY; without even the implied warranty of
49 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50 * GNU General Public License for more details.
51 *
52 * You should have received a copy of the GNU General Public License
53 * along with this program; if not, see http://www.gnu.org/licenses/
54 * or write to the Free Software Foundation, Inc., 51 Franklin Street,
55 * Fifth Floor, Boston, MA 02110-1301, USA.
56 *
57 */
58
59#include "Camera.hpp"
60
61GU::Camera::Camera() NOEXCEPT {}
62
63GU::Camera::Camera(centimetres_d t_height, centimetres_d t_centerOffset, degrees_d t_vDirection, degrees_d t_vFov, degrees_d t_hFov) NOEXCEPT
64{
65 set_height(t_height);
66 set_centerOffset(t_centerOffset);
67 set_vDirection(t_vDirection);
68 set_vFov(t_vFov);
69 set_hFov(t_hFov);
70}
71
72GU::Camera::Camera(const Camera& other) NOEXCEPT
73{
74 set_height(other.height());
75 set_centerOffset(other.centerOffset());
76 set_vDirection(other.vDirection());
77 set_vFov(other.vFov());
78 set_hFov(other.hFov());
79}
80
81GU::Camera::Camera(const gu_camera& other) NOEXCEPT
82{
83 set_height(other.height);
84 set_centerOffset(other.centerOffset);
85 set_vDirection(other.vDirection);
86 set_vFov(other.vFov);
87 set_hFov(other.hFov);
88}
89
90#if __cplusplus >= 201103L
91GU::Camera::Camera(Camera&& other) NOEXCEPT
92{
93 set_height(other.height());
94 set_centerOffset(other.centerOffset());
95 set_vDirection(other.vDirection());
96 set_vFov(other.vFov());
97 set_hFov(other.hFov());
98}
99
101{
102 set_height(other.height);
103 set_centerOffset(other.centerOffset);
104 set_vDirection(other.vDirection);
105 set_vFov(other.vFov);
106 set_hFov(other.hFov);
107}
108#endif
109
111
113{
114 if (&other == this)
115 {
116 return *this;
117 }
118 set_height(other.height());
119 set_centerOffset(other.centerOffset());
120 set_vDirection(other.vDirection());
121 set_vFov(other.vFov());
122 set_hFov(other.hFov());
123 return *this;
124}
125
127{
128 if (&other == this)
129 {
130 return *this;
131 }
132 set_height(other.height);
133 set_centerOffset(other.centerOffset);
134 set_vDirection(other.vDirection);
135 set_vFov(other.vFov);
136 set_hFov(other.hFov);
137 return *this;
138}
139
140#if __cplusplus >= 201103L
142{
143 if (&other == this) {
144 return *this;
145 }
146 set_height(other.height());
147 set_centerOffset(other.centerOffset());
148 set_vDirection(other.vDirection());
149 set_vFov(other.vFov());
150 set_hFov(other.hFov());
151 return *this;
152}
153
155{
156 if (&other == this) {
157 return *this;
158 }
159 set_height(other.height);
160 set_centerOffset(other.centerOffset);
161 set_vDirection(other.vDirection);
162 set_vFov(other.vFov);
163 set_hFov(other.hFov);
164 return *this;
165}
166#endif
167
168centimetres_d GU::Camera::height() const NOEXCEPT
169{
170 return gu_camera::height;
171}
172
173void GU::Camera::set_height(const centimetres_d newValue) NOEXCEPT
174{
175 gu_camera::height = newValue;
176}
177
178centimetres_d GU::Camera::centerOffset() const NOEXCEPT
179{
181}
182
183void GU::Camera::set_centerOffset(const centimetres_d newValue) NOEXCEPT
184{
185 gu_camera::centerOffset = newValue;
186}
187
188degrees_d GU::Camera::vDirection() const NOEXCEPT
189{
191}
192
193void GU::Camera::set_vDirection(const degrees_d newValue) NOEXCEPT
194{
195 gu_camera::vDirection = newValue;
196}
197
198degrees_d GU::Camera::vFov() const NOEXCEPT
199{
200 return gu_camera::vFov;
201}
202
203void GU::Camera::set_vFov(const degrees_d newValue) NOEXCEPT
204{
205 gu_camera::vFov = newValue;
206}
207
208degrees_d GU::Camera::hFov() const NOEXCEPT
209{
210 return gu_camera::hFov;
211}
212
213void GU::Camera::set_hFov(const degrees_d newValue) NOEXCEPT
214{
215 gu_camera::hFov = newValue;
216}
217
218bool GU::Camera::operator==(const Camera &other) const NOEXCEPT
219{
220 return gu_camera_equals(*this, other, 0.0001);
221}
222
223bool GU::Camera::operator!=(const Camera &other) const NOEXCEPT
224{
225 return !(*this == other);
226}
227
228bool GU::Camera::operator==(const gu_camera &other) const NOEXCEPT
229{
230 return gu_camera_equals(*this, other, 0.0001);
231}
232
233bool GU::Camera::operator!=(const gu_camera &other) const NOEXCEPT
234{
235 return !(*this == other);
236}
bool gu_camera_equals(const gu_camera lhs, const gu_camera rhs, const double tolerance)
Definition: camera.c:64
degrees_d vDirection() const NOEXCEPT
Definition: CameraCPP.cc:188
void set_hFov(const degrees_d) NOEXCEPT
Definition: CameraCPP.cc:213
void set_centerOffset(const centimetres_d) NOEXCEPT
Definition: CameraCPP.cc:183
centimetres_d height() const NOEXCEPT
Definition: CameraCPP.cc:168
void set_vFov(const degrees_d) NOEXCEPT
Definition: CameraCPP.cc:203
Camera() NOEXCEPT
Definition: CameraCPP.cc:61
bool operator==(const Camera &other) const NOEXCEPT
Definition: CameraCPP.cc:218
void set_height(const centimetres_d) NOEXCEPT
Definition: CameraCPP.cc:173
centimetres_d centerOffset() const NOEXCEPT
Definition: CameraCPP.cc:178
bool operator!=(const Camera &other) const NOEXCEPT
Definition: CameraCPP.cc:223
degrees_d hFov() const NOEXCEPT
Definition: CameraCPP.cc:208
Camera & operator=(const Camera &other) NOEXCEPT
Definition: CameraCPP.cc:112
~Camera() NOEXCEPT
Definition: CameraCPP.cc:110
degrees_d vFov() const NOEXCEPT
Definition: CameraCPP.cc:198
void set_vDirection(const degrees_d) NOEXCEPT
Definition: CameraCPP.cc:193
centimetres_d centerOffset
The distance the camera is from the center point.
Definition: camera.h:92
centimetres_d height
The height from the pivot of the camera to the middle of the camera.
Definition: camera.h:80
degrees_d hFov
The horizontal field of view.
Definition: camera.h:110
degrees_d vFov
The vertical field of view.
Definition: camera.h:105
degrees_d vDirection
The degree in which the camera is facing in the vertical direction.
Definition: camera.h:100