Skip to main content

utils.ixx File

Misc math utility functions. More...

Included Headers

#include <cmath> #include <numbers>

Namespaces Index

namespacehelios
namespacemath

Description

Misc math utility functions.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <cmath>
8#include <numbers>
9
10export module helios.math.utils;
11
12export namespace helios::math {
13
23 constexpr float EPSILON_LENGTH = 1e-6f;
24
31 constexpr float radians(const float angle) noexcept {
32 return angle * static_cast<float>(std::numbers::pi)/180.0f;
33 }
34
41 constexpr float degrees(const float radians) noexcept {
42 return radians * 180.0f/static_cast<float>(std::numbers::pi);
43 }
44
56 constexpr float shortestAngle(const float from, const float to) noexcept {
57 const float x = to - from;
58 return x - 360.0f * std::floor((x + 180.0f) / 360.0f);
59 }
60
61
62}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.