gucoordinates
CameraPivot.cc
Go to the documentation of this file.
1/*
2 * CameraPivot.cc
3 * gucoordinates
4 *
5 * Created by Callum McColl on 20/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 "CameraPivot.hpp"
60#include "conversions.h"
61
62#include <string.h>
63
65
66GU::CameraPivot::CameraPivot(const degrees_d t_pitch, const degrees_d t_yaw, const centimetres_d t_height, const gu_camera t_cameras[GU_CAMERA_PIVOT_NUM_CAMERAS], int t_numCameras) NOEXCEPT
67{
68 set_pitch(t_pitch);
69 set_yaw(t_yaw);
70 set_height(t_height);
71 set_cameras(t_cameras);
72 set_numCameras(t_numCameras);
73}
74
76{
77 set_pitch(other.pitch());
78 set_yaw(other.yaw());
79 set_height(other.height());
80 set_cameras(other.cameras());
81 set_numCameras(other.numCameras());
82}
83
85{
86 set_pitch(other.pitch);
87 set_yaw(other.yaw);
88 set_height(other.height);
89 set_cameras(other.cameras);
90 set_numCameras(other.numCameras);
91}
92
93#if __cplusplus >= 201103L
95{
96 set_pitch(other.pitch());
97 set_yaw(other.yaw());
98 set_height(other.height());
99 set_cameras(other.cameras());
100 set_numCameras(other.numCameras());
101}
102
104{
105 set_pitch(other.pitch);
106 set_yaw(other.yaw);
107 set_height(other.height);
108 set_cameras(other.cameras);
109 set_numCameras(other.numCameras);
110}
111#endif
112
114
116{
117 if (&other == this)
118 {
119 return *this;
120 }
121 set_pitch(other.pitch());
122 set_yaw(other.yaw());
123 set_height(other.height());
124 set_cameras(other.cameras());
125 set_numCameras(other.numCameras());
126 return *this;
127}
128
130{
131 if (&other == this)
132 {
133 return *this;
134 }
135 set_pitch(other.pitch);
136 set_yaw(other.yaw);
137 set_height(other.height);
138 set_cameras(other.cameras);
139 set_numCameras(other.numCameras);
140 return *this;
141}
142
143#if __cplusplus >= 201103L
145{
146 if (&other == this) {
147 return *this;
148 }
149 set_pitch(other.pitch());
150 set_yaw(other.yaw());
151 set_height(other.height());
152 set_cameras(other.cameras());
153 set_numCameras(other.numCameras());
154 return *this;
155}
156
158{
159 if (&other == this) {
160 return *this;
161 }
162 set_pitch(other.pitch);
163 set_yaw(other.yaw);
164 set_height(other.height);
165 set_cameras(other.cameras);
166 set_numCameras(other.numCameras);
167 return *this;
168}
169#endif
170
171degrees_d GU::CameraPivot::pitch() const NOEXCEPT
172{
174}
175
176void GU::CameraPivot::set_pitch(const degrees_d newValue) NOEXCEPT
177{
178 gu_camera_pivot::pitch = newValue;
179}
180
181degrees_d GU::CameraPivot::yaw() const NOEXCEPT
182{
184}
185
186void GU::CameraPivot::set_yaw(const degrees_d newValue) NOEXCEPT
187{
188 gu_camera_pivot::yaw = newValue;
189}
190
191
192centimetres_d GU::CameraPivot::height() const NOEXCEPT
193{
195}
196
197void GU::CameraPivot::set_height(const centimetres_d newValue) NOEXCEPT
198{
199 gu_camera_pivot::height = newValue;
200}
201
202const gu_camera * GU::CameraPivot::cameras() const NOEXCEPT
203{
204 return &gu_camera_pivot::cameras[0];
205}
206
208{
210}
211
212GU::Camera GU::CameraPivot::camera(const int index) const NOEXCEPT
213{
214 return gu_camera_pivot::cameras[index];
215}
216
217void GU::CameraPivot::set_camera(const int index, const GU::Camera newValue) NOEXCEPT
218{
219 gu_camera_pivot::cameras[index] = newValue;
220}
221
222int GU::CameraPivot::numCameras() const NOEXCEPT
223{
225}
226
227void GU::CameraPivot::set_numCameras(const int newValue) NOEXCEPT
228{
230}
231
232bool GU::CameraPivot::operator==(const CameraPivot &other) const NOEXCEPT
233{
234 return gu_camera_pivot_equals(*this, other, 0.0001);
235}
236
237bool GU::CameraPivot::operator!=(const CameraPivot &other) const NOEXCEPT
238{
239 return !(*this == other);
240}
241
242bool GU::CameraPivot::operator==(const gu_camera_pivot &other) const NOEXCEPT
243{
244 return gu_camera_pivot_equals(*this, other, 0.0001);
245}
246
247bool GU::CameraPivot::operator!=(const gu_camera_pivot &other) const NOEXCEPT
248{
249 return !(*this == other);
250}
bool gu_camera_pivot_equals(const gu_camera_pivot lhs, const gu_camera_pivot rhs, const double tolerance)
Definition: camera_pivot.c:64
#define GU_CAMERA_PIVOT_NUM_CAMERAS
Definition: camera_pivot.h:74
const gu_camera * cameras() const NOEXCEPT
Definition: CameraPivot.cc:202
void set_yaw(const degrees_d) NOEXCEPT
Definition: CameraPivot.cc:186
int numCameras() const NOEXCEPT
Definition: CameraPivot.cc:222
void set_camera(const int, const Camera) NOEXCEPT
Definition: CameraPivot.cc:217
void set_pitch(const degrees_d) NOEXCEPT
Definition: CameraPivot.cc:176
bool operator!=(const CameraPivot &other) const NOEXCEPT
Definition: CameraPivot.cc:237
void set_height(const centimetres_d) NOEXCEPT
Definition: CameraPivot.cc:197
degrees_d yaw() const NOEXCEPT
Definition: CameraPivot.cc:181
void set_numCameras(const int) NOEXCEPT
Definition: CameraPivot.cc:227
degrees_d pitch() const NOEXCEPT
Definition: CameraPivot.cc:171
bool operator==(const CameraPivot &other) const NOEXCEPT
Definition: CameraPivot.cc:232
Camera camera(const int) const NOEXCEPT
Definition: CameraPivot.cc:212
void set_cameras(const gu_camera[2]) NOEXCEPT
Definition: CameraPivot.cc:207
~CameraPivot() NOEXCEPT
Definition: CameraPivot.cc:113
centimetres_d height() const NOEXCEPT
Definition: CameraPivot.cc:192
CameraPivot() NOEXCEPT
Definition: CameraPivot.cc:64
CameraPivot & operator=(const CameraPivot &other) NOEXCEPT
Definition: CameraPivot.cc:115
A gu_camera_pivot represents the pivot point which a gu_camera is attached to.
Definition: camera_pivot.h:87
degrees_d pitch
The vertical orientation of the pivot point.
Definition: camera_pivot.h:92
degrees_d yaw
The horizontal orientation of the pivot point.
Definition: camera_pivot.h:97
centimetres_d height
The vertical distance from the ground to the pivot point.
Definition: camera_pivot.h:102
gu_camera cameras[2]
The gu_cameras attached to this pivot point.
Definition: camera_pivot.h:107
int numCameras
The number of elements in cameras.
Definition: camera_pivot.h:112