FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
rotation_angle_utils.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2026-present FERS Contributors (see AUTHORS.md).
4//
5// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
6
7#pragma once
8
9#include "core/config.h"
10#include "core/parameters.h"
11#include "math/coord.h"
12
14{
15 /// Converts a value from the given external unit to radians.
16 inline RealType unit_to_radians(const RealType value, const params::RotationAngleUnit unit) noexcept
17 {
18 return unit == params::RotationAngleUnit::Degrees ? value * (PI / 180.0) : value;
19 }
20
21 /// Converts a radian value to the requested external unit.
22 inline RealType radians_to_unit(const RealType value, const params::RotationAngleUnit unit) noexcept
23 {
24 return unit == params::RotationAngleUnit::Degrees ? value * 180.0 / PI : value;
25 }
26
27 /// Converts external compass azimuth/elevation into internal rotation coordinates.
29 const RealType time,
30 const params::RotationAngleUnit unit) noexcept
31 {
32 return {(PI / 2.0) - unit_to_radians(azimuth, unit), unit_to_radians(elevation, unit), time};
33 }
34
35 /// Converts external compass azimuth/elevation rates into internal rotation rates.
42
43 /// Converts an internal azimuth angle to the external compass convention.
45 {
46 return radians_to_unit((PI / 2.0) - azimuth, unit);
47 }
48
49 /// Converts an internal elevation angle to the external unit.
51 const params::RotationAngleUnit unit) noexcept
52 {
53 return radians_to_unit(elevation, unit);
54 }
55
56 /// Converts an internal azimuth rate to the external compass convention.
62
63 /// Converts an internal elevation rate to the external unit.
69}
Global configuration file for the project.
double RealType
Type for real numbers.
Definition config.h:27
constexpr RealType PI
Mathematical constant π (pi).
Definition config.h:43
Coordinate and rotation structure operations.
RotationAngleUnit
Defines the units used at external rotation-path boundaries.
Definition parameters.h:42
@ Degrees
Compass azimuth and elevation expressed in degrees.
RealType internal_elevation_to_external(const RealType elevation, const params::RotationAngleUnit unit) noexcept
Converts an internal elevation angle to the external unit.
RealType internal_azimuth_rate_to_external(const RealType azimuth_rate, const params::RotationAngleUnit unit) noexcept
Converts an internal azimuth rate to the external compass convention.
math::RotationCoord external_rotation_to_internal(const RealType azimuth, const RealType elevation, const RealType time, const params::RotationAngleUnit unit) noexcept
Converts external compass azimuth/elevation into internal rotation coordinates.
RealType internal_elevation_rate_to_external(const RealType elevation_rate, const params::RotationAngleUnit unit) noexcept
Converts an internal elevation rate to the external unit.
RealType internal_azimuth_to_external(const RealType azimuth, const params::RotationAngleUnit unit) noexcept
Converts an internal azimuth angle to the external compass convention.
RealType unit_to_radians(const RealType value, const params::RotationAngleUnit unit) noexcept
Converts a value from the given external unit to radians.
RealType radians_to_unit(const RealType value, const params::RotationAngleUnit unit) noexcept
Converts a radian value to the requested external unit.
math::RotationCoord external_rotation_rate_to_internal(const RealType azimuth_rate, const RealType elevation_rate, const RealType time, const params::RotationAngleUnit unit) noexcept
Converts external compass azimuth/elevation rates into internal rotation rates.
Defines the Parameters struct and provides methods for managing simulation parameters.
math::Vec3 max
Represents a rotation in terms of azimuth, elevation, and time.
Definition coord.h:72