davideberly / GeometricTools

A collection of source code for computing in the fields of mathematics, geometry, graphics, image analysis and physics.
Boost Software License 1.0
1.08k stars 202 forks source link

Typo in Hyperplane::operator< - wrong comparison #74

Closed andreyyfrolov closed 9 months ago

andreyyfrolov commented 9 months ago

There is a typo in Hyperplane class, that could lead to incorrect order of sorted planes

`bool operator< (Hyperplane const& hyperplane) const { if (normal < hyperplane.normal) { return true; }

        if (origin > hyperplane.origin)       // original
        // if (normal > hyperplane.normal)   // correct
        {
            return false;
        }

        if (origin < hyperplane.origin)
        {
            return true;
        }

        if (origin > hyperplane.origin)
        {
            return false;
        }

        return constant < hyperplane.constant;
    }`
davideberly commented 9 months ago

Yes, that is a bug. I have fixed it and pushed the modified Hyperplane.h file. Thank you for taking the time to report this.