zeus/include/zeus/CAxisAngle.hpp
Lioncash 81f9b4a4ee General: Mark functions as nodiscard where applicable
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.
2020-03-04 03:07:54 -05:00

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