cocos-engine icon indicating copy to clipboard operation
cocos-engine copied to clipboard

float value comparison needs approximate version in Math library

Open dumganhar opened this issue 1 year ago • 0 comments

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.

dumganhar avatar Jul 25 '22 06:07 dumganhar