mirror of
https://github.com/AxioDL/zeus.git
synced 2025-06-19 13:03:34 +00:00
Given this aims to be a general purpose math library for use in various other libraries applications for axiodl, we can annotate functions that return by value or reference with [[nodiscard]] where it's very obvious that not making use of the return value is a bug. This allows the compiler to diagnose and emit warnings for these API misuses at compile-time, preventing silent bugs from occurring. Any cases where not using the return value is desirable may still be casted to void in order to silence warnings.
17 lines
548 B
C++
17 lines
548 B
C++
#pragma once
|
|
|
|
#include "zeus/CUnitVector.hpp"
|
|
#include "zeus/CVector3f.hpp"
|
|
|
|
namespace zeus {
|
|
struct CAxisAngle : CVector3f {
|
|
constexpr CAxisAngle() = default;
|
|
constexpr CAxisAngle(float x, float y, float z) : CVector3f(x, y, z) {}
|
|
CAxisAngle(const CUnitVector3f& axis, float angle) : CVector3f(angle * axis) {}
|
|
constexpr CAxisAngle(const CVector3f& axisAngle) : CVector3f(axisAngle) {}
|
|
|
|
[[nodiscard]] float angle() const { return magnitude(); }
|
|
[[nodiscard]] const CVector3f& getVector() const { return *this; }
|
|
};
|
|
} // namespace zeus
|