FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
rotation_path.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2006-2008 Marc Brooker and Michael Inggs
4// Copyright (c) 2008-present FERS Contributors (see AUTHORS.md).
5//
6// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
7
8/**
9 * @file rotation_path.h
10 * @brief Defines the RotationPath class for handling rotational paths with different interpolation types.
11 */
12
13#pragma once
14
15#include <vector>
16
17#include "coord.h"
18#include "core/config.h"
19#include "geometry_ops.h"
20
21namespace math
22{
23 /**
24 * @class RotationPath
25 * @brief Manages rotational paths with different interpolation techniques.
26 */
28 {
29 public:
30 /**
31 * @enum InterpType
32 * @brief Enumeration for types of interpolation.
33 */
41
42 /**
43 * @brief Constructor for RotationPath.
44 *
45 * @param type The type of interpolation (default is static).
46 */
47 explicit RotationPath(const InterpType type = InterpType::INTERP_STATIC) noexcept : _type(type) {}
48
49 ~RotationPath() = default;
50
51 RotationPath(const RotationPath&) = delete;
52
54
56
58
59 /**
60 * @brief Adds a rotation coordinate to the path.
61 *
62 * @param coord The rotation coordinate to be added.
63 */
64 void addCoord(const RotationCoord& coord) noexcept;
65
66 /**
67 * @brief Finalizes the rotation path for interpolation.
68 */
69 void finalize();
70
71 /**
72 * @brief Gets the list of rotation coordinates.
73 *
74 * @return A const reference to the vector of rotation coordinates.
75 */
76 [[nodiscard]] const std::vector<RotationCoord>& getCoords() const noexcept { return _coords; }
77
78 /**
79 * @brief Gets the starting rotation coordinate.
80 *
81 * @return The starting rotation coordinate.
82 */
83 [[nodiscard]] RotationCoord getStart() const noexcept { return _start; }
84
85 /**
86 * @brief Gets the rate of change for the rotation.
87 *
88 * @return The rotation rate.
89 */
90 [[nodiscard]] RotationCoord getRate() const noexcept { return _rate; }
91
92 /**
93 * @brief Gets the interpolation type of the path.
94 *
95 * @return The interpolation type.
96 */
97 [[nodiscard]] InterpType getType() const noexcept { return _type; }
98
99 /**
100 * @brief Gets the rotational position at a given time.
101 *
102 * @param t The time value for which to calculate the position.
103 * @return The calculated position as an SVec3.
104 * @throws PathException if the path has not been finalized.
105 */
106 [[nodiscard]] SVec3 getPosition(RealType t) const;
107
108 /**
109 * @brief Sets the starting rotation coordinate.
110 *
111 * @param start The new starting rotation coordinate.
112 */
113 void setStart(const RotationCoord& start) noexcept { _start = start; }
114
115 /**
116 * @brief Sets the rate of change for the rotation.
117 *
118 * @param rate The new rate of change for the rotation.
119 */
120 void setRate(const RotationCoord& rate) noexcept { _rate = rate; }
121
122 /**
123 * @brief Sets the interpolation type for the path.
124 *
125 * @param setinterp The new interpolation type to be used.
126 */
127 void setInterp(InterpType setinterp) noexcept;
128
129 /**
130 * @brief Sets constant rate interpolation.
131 *
132 * @param setstart The starting rotation coordinate.
133 * @param setrate The rate of change for the rotation.
134 */
135 void setConstantRate(const RotationCoord& setstart, const RotationCoord& setrate) noexcept;
136
137 private:
138 std::vector<RotationCoord> _coords; ///< Vector of rotation coordinates in the path.
139 std::vector<RotationCoord> _dd; ///< Vector of second derivatives for cubic interpolation.
140 bool _final{false}; ///< Boolean flag to indicate whether the path has been finalized.
141 RotationCoord _start{}; ///< Starting rotation coordinate.
142 RotationCoord _rate{}; ///< Rate of change for constant interpolation.
143 InterpType _type{InterpType::INTERP_STATIC}; ///< Interpolation type used by the path.
144 };
145}
Manages rotational paths with different interpolation techniques.
void finalize()
Finalizes the rotation path for interpolation.
InterpType getType() const noexcept
Gets the interpolation type of the path.
RotationPath(const InterpType type=InterpType::INTERP_STATIC) noexcept
Constructor for RotationPath.
RotationPath & operator=(const RotationPath &)=delete
void setConstantRate(const RotationCoord &setstart, const RotationCoord &setrate) noexcept
Sets constant rate interpolation.
void setInterp(InterpType setinterp) noexcept
Sets the interpolation type for the path.
SVec3 getPosition(RealType t) const
Gets the rotational position at a given time.
InterpType
Enumeration for types of interpolation.
void addCoord(const RotationCoord &coord) noexcept
Adds a rotation coordinate to the path.
RotationCoord getRate() const noexcept
Gets the rate of change for the rotation.
void setStart(const RotationCoord &start) noexcept
Sets the starting rotation coordinate.
RotationPath & operator=(RotationPath &&)=delete
RotationPath(RotationPath &&)=delete
void setRate(const RotationCoord &rate) noexcept
Sets the rate of change for the rotation.
const std::vector< RotationCoord > & getCoords() const noexcept
Gets the list of rotation coordinates.
~RotationPath()=default
RotationCoord getStart() const noexcept
Gets the starting rotation coordinate.
RotationPath(const RotationPath &)=delete
A class representing a vector in spherical coordinates.
Global configuration file for the project.
double RealType
Type for real numbers.
Definition config.h:27
Coordinate and rotation structure operations.
Classes and operations for 3D geometry.
Definition coord.h:18
Represents a rotation in terms of azimuth, elevation, and time.
Definition coord.h:72