Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/math/seadMathCalcCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ inline T MathCalcCommon<T>::clamp(T value, T low, T high)
return value;
}

template <typename T>
inline bool MathCalcCommon<T>::isNan(T value)
{
return std::isnan(value);
}

template <typename T>
inline bool MathCalcCommon<T>::chase(T* value, T target, T step)
{
Expand Down
13 changes: 13 additions & 0 deletions include/math/seadVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct Vector2 : public Policies<T>::Vec2Base
T normalize();

bool isZero() const { return *this == zero; }
bool isNan() const { return sead::Mathf::isNan(this->x) || sead::Mathf::isNan(this->y); }

static const Vector2 zero;
static const Vector2 ex;
Expand Down Expand Up @@ -190,6 +191,12 @@ struct Vector3 : public Policies<T>::Vec3Base
void setRotated(const Quat& q, const Vector3& a);
void setSub(const Vector3& a, const Vector3& b);

bool isNan() const
{
return sead::Mathf::isNan(this->x) || sead::Mathf::isNan(this->y) ||
sead::Mathf::isNan(this->z);
}

static const Vector3 zero;
static const Vector3 ex;
static const Vector3 ey;
Expand Down Expand Up @@ -244,6 +251,12 @@ struct Vector4 : public Policies<T>::Vec4Base
void set(const Vector4& v);
void set(T x_, T y_, T z_, T w_);

bool isNan() const
{
return sead::Mathf::isNan(this->x) || sead::Mathf::isNan(this->y) ||
sead::Mathf::isNan(this->z) || sead::Mathf::isNan(this->w);
}

static const Vector4 zero;
static const Vector4 ex;
static const Vector4 ey;
Expand Down
Loading