cocos-engine
cocos-engine copied to clipboard
float value comparison needs approximate version in Math library
operator==
should be absolute equal, add new comparison function like approxEquals
.
For example:
inline bool Vec4::operator==(const Vec4& v) const
{
return x==v.x && y==v.y && z==v.z && w==v.w;
}
inline bool Vec4::approxEquals(const Vec4& v) const {
return math::isEqualF(x, v.x)
&& math::isEqualF(y, v.y)
&& math::isEqualF(z, v.z)
&& math::isEqualF(w, v.w);
}
Quaternion, Vec3, Mat3, Mat4 also needs to implement this.