|
template<::std::floating_point T> |
constexpr bool | designlab::math_util::IsEqual (const T num1, const T num2) noexcept |
| C++において,小数同士の計算は誤差が出てしまう. 誤差込みで値が等しいか調べる.
|
|
template<Arithmetic T> |
constexpr T | designlab::math_util::Squared (const T num) noexcept |
| 2乗した値を返す関数.
|
|
template<Arithmetic T> |
constexpr bool | designlab::math_util::CanMakeTriangle (const T a, const T b, const T c) noexcept |
| 3辺で三角形が作れるか調べる関数.
|
|
template<typename T > |
T | designlab::math_util::ApproachTarget (const T ¤t, const T &target, float rate) |
| 目標値に値を近づける関数. 描画用なので,線形でなく,適当に値を近づける. そのため,計算に使いたいなら作り直すこと.
|
|
template<Arithmetic T> |
T | designlab::math_util::GenerateRandomNumber (T min, T max) |
| 指定した範囲内の乱数を生成する.
|
|
template<::std::floating_point T> |
constexpr T | designlab::math_util::ConvertRadToDeg (const T rad) noexcept |
| 角度を [rad]から [deg] に変換する関数.
|
|
template<::std::floating_point T> |
constexpr T | designlab::math_util::ConvertDegToRad (const T deg) noexcept |
| 角度を [deg] から [rad] に変換する関数.
|
|
template<::std::floating_point T> |
T | designlab::math_util::LimitRangeAngleDeg (T angle) |
| 角度を -180° ~ 180° の範囲に収める関数.
|
|
template<::std::floating_point T> |
std::string | designlab::math_util::FloatingPointNumToString (const T num, const int digit=kDigit, const int width=kWidth) |
| 小数を文字列に変換する関数.
C++ では C のフォーマットのように %3.3f とかで小数を文字列に変換できないため自作する.
|
|