gucoordinates
FieldCoordinate.hpp
Go to the documentation of this file.
1/*
2 * FieldCoordinate.hpp
3 * gucoordinates
4 *
5 * Created by Callum McColl on 21/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 NOEXCEPT; LOSS OF USE, DATA, OR
36 * PROFITS NOEXCEPT; 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 NOEXCEPT; 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 NOEXCEPT;
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 NOEXCEPT; 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 NOEXCEPT; 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#ifndef FIELDCOORDINATE_HPP
60#define FIELDCOORDINATE_HPP
61
62#include "field_coordinate.h"
63
64#include <cstdlib>
65#include <guunits/guunits.h>
66#include "CameraCoordinate.hpp"
67#include "PixelCoordinate.hpp"
68#include "PercentCoordinate.hpp"
71#include "CameraPivot.hpp"
72
79
80#if __cplusplus >= 201703L
81#include <optional>
82#endif
83
84#include <gu_util.h>
85
86namespace GU {
87
88 struct CameraCoordinate;
89 struct PixelCoordinate;
90 struct PercentCoordinate;
91 struct RelativeCoordinate;
92 struct CartesianCoordinate;
93
95
96 FieldCoordinate() NOEXCEPT;
97 FieldCoordinate(CartesianCoordinate, degrees_t) NOEXCEPT;
98 FieldCoordinate(const FieldCoordinate& other) NOEXCEPT;
99 FieldCoordinate(const gu_field_coordinate& other) NOEXCEPT;
100#if __cplusplus >= 201103L
101#pragma clang diagnostic push
102#pragma clang diagnostic ignored "-Wc++98-compat"
103 FieldCoordinate(FieldCoordinate&& other) NOEXCEPT;
104 FieldCoordinate(gu_field_coordinate&& other) NOEXCEPT;
105#pragma clang diagnostic pop
106#endif
107 ~FieldCoordinate() NOEXCEPT;
108 FieldCoordinate& operator=(const FieldCoordinate& other) NOEXCEPT;
109 FieldCoordinate& operator=(const gu_field_coordinate& other) NOEXCEPT;
110#if __cplusplus >= 201103L
111#pragma clang diagnostic push
112#pragma clang diagnostic ignored "-Wc++98-compat"
113 FieldCoordinate& operator=(FieldCoordinate&& other) NOEXCEPT;
115#pragma clang diagnostic pop
116#endif
117
119 FieldCoordinate fieldCoordinateAt(const GU::RelativeCoordinate &, const degrees_t) const NOEXCEPT;
122
123 CartesianCoordinate cartesianCoordinateAt(const GU::CameraCoordinate &, const GU::CameraPivot &, const int) const NOEXCEPT;
124 CartesianCoordinate cartesianCoordinateAt(const GU::PixelCoordinate &, const GU::CameraPivot &, const int) const NOEXCEPT;
125 CartesianCoordinate cartesianCoordinateAt(const GU::PercentCoordinate &, const GU::CameraPivot &, const int) const NOEXCEPT;
126 FieldCoordinate fieldCoordinateAt(const GU::CameraCoordinate &, const GU::CameraPivot &, const int, const degrees_t) const NOEXCEPT;
127 FieldCoordinate fieldCoordinateAt(const GU::PixelCoordinate &, const GU::CameraPivot &, const int, const degrees_t) const NOEXCEPT;
128 FieldCoordinate fieldCoordinateAt(const GU::PercentCoordinate &, const GU::CameraPivot &, const int, const degrees_t) const NOEXCEPT;
129
130 CameraCoordinate cameraCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT;
131 CameraCoordinate cameraCoordinateTo(const GU::FieldCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT;
132 PixelCoordinate pixelCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT;
133 PixelCoordinate pixelCoordinateTo(const GU::FieldCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT;
134 PercentCoordinate percentCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int) const NOEXCEPT;
135 PercentCoordinate percentCoordinateTo(const GU::FieldCoordinate &, const GU::CameraPivot &, const int) const NOEXCEPT;
136
137 CameraCoordinate clampedCameraCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT;
138 CameraCoordinate clampedCameraCoordinateTo(const GU::FieldCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT;
139 PixelCoordinate clampedPixelCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT;
140 PixelCoordinate clampedPixelCoordinateTo(const GU::FieldCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT;
142 PercentCoordinate clampedPercentCoordinateTo(const GU::FieldCoordinate &, const GU::CameraPivot &, const int) const NOEXCEPT;
143
144 CartesianCoordinate position() const NOEXCEPT;
145 void set_position(const CartesianCoordinate) NOEXCEPT;
146
147 degrees_t heading() const NOEXCEPT;
148 void set_heading(const degrees_t) NOEXCEPT;
149
150 bool operator ==(const FieldCoordinate &other) const NOEXCEPT;
151 bool operator !=(const FieldCoordinate &other) const NOEXCEPT;
152 bool operator ==(const gu_field_coordinate &other) const NOEXCEPT;
153 bool operator !=(const gu_field_coordinate &other) const NOEXCEPT;
154
155 };
156
157}
158
159#endif /* FIELDCOORDINATE_HPP */
Definition: Camera.hpp:66
degrees_t heading() const NOEXCEPT
PixelCoordinate clampedPixelCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT
FieldCoordinate & operator=(const FieldCoordinate &other) NOEXCEPT
void set_heading(const degrees_t) NOEXCEPT
PercentCoordinate clampedPercentCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int) const NOEXCEPT
FieldCoordinate() NOEXCEPT
void set_position(const CartesianCoordinate) NOEXCEPT
PercentCoordinate percentCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int) const NOEXCEPT
CameraCoordinate cameraCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT
PixelCoordinate pixelCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT
CartesianCoordinate cartesianCoordinateAt(const GU::RelativeCoordinate &) const NOEXCEPT
CameraCoordinate clampedCameraCoordinateTo(const GU::CartesianCoordinate &, const GU::CameraPivot &, const int, const pixels_u, const pixels_u) const NOEXCEPT
RelativeCoordinate relativeCoordinateTo(const GU::CartesianCoordinate &) const NOEXCEPT
bool operator!=(const FieldCoordinate &other) const NOEXCEPT
bool operator==(const FieldCoordinate &other) const NOEXCEPT
CartesianCoordinate position() const NOEXCEPT
FieldCoordinate fieldCoordinateAt(const GU::RelativeCoordinate &, const degrees_t) const NOEXCEPT
A field_coordinate is a coordinate for an object that faces a certain direction (such as a robot) on ...