51 return *
this * (1.f / length);
56 return std::string(
"( x : ") +
58 std::string(
", y : ") +
std::string FloatingPointNumToString(const T num, const int digit=kDigit, const int width=kWidth)
小数を文字列に変換する関数. C++ では C のフォーマットのように %3.3f とかで小数を文字列に変換できないため自作する.
constexpr bool IsEqual(const T num1, const T num2) noexcept
C++において,小数同士の計算は誤差が出てしまう. 誤差込みで値が等しいか調べる.
std::string ToString() const
このベクトルを文字列にして返す. (x, y) の形式,小数点以下3桁まで.
Vector2 & operator*=(float s)
Vector2 GetNormalized() const
このベクトルを正規化したベクトルを返す.
Vector2 & operator+=(const Vector2 &other)
std::string ToCsvString() const
このベクトルをCSV形式の文字列にして返す. x, y, z の形式,小数点以下3桁まで.
float GetLength() const
このベクトルの長さを返す.
Vector2 & operator/=(float s)
Vector2 & operator-=(const Vector2 &other)