Skip to main content

utils.ixx File

Misc math utility functions. More...

Included Headers

#include <numbers>

Namespaces Index

namespacehelios
namespacemath

Mathematical operations and types. More...

Description

Misc math utility functions.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file utils.ixx
3 * @brief Misc math utility functions.
4 */
5module;
6
7#include <numbers>
8
9export module helios.math.utils;
10
11export namespace helios::math {
12
13 /**
14 * @brief A small epsilon value used for length-based comparisons.
15 *
16 * @details This constant represents the minimum threshold value for length
17 * comparisons to account for numerical precision errors in floating-point
18 * calculations. It is often used to avoid treating very small values as
19 * significant, effectively filtering out noise in computations that involve
20 * vector-lengths.
21 */
22 constexpr float EPSILON_LENGTH = 1e-6f;
23
24 /**
25 * @brief Converts an angle from degrees to radians.
26 *
27 * @param angle The angle value in degrees.
28 * @return The converted angle value in radians.
29 */
30 constexpr float radians(const float angle) noexcept {
31 return angle * static_cast<float>(std::numbers::pi)/180.0f;
32 }
33
34 /**
35 * @brief Converts an angle from radians to degrees.
36 *
37 * @param radians The angle value in radians.
38 * @return The converted angle value in degrees.
39 */
40 constexpr float degrees(const float radians) noexcept {
41 return radians * 180.0f/static_cast<float>(std::numbers::pi);
42 }
43
44
45}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.