SIMDPrototyping.Trees.BoundingBox.Intersects C# (CSharp) Method

Intersects() private method

private Intersects ( BoundingBox &a, BoundingBox &b ) : bool
a BoundingBox
b BoundingBox
return bool
        public static bool Intersects(ref BoundingBox a, ref BoundingBox b)
        {
            ////May be able to do better than this. Consider unbranching it.
            //return Vector3.Clamp(a.Min, b.Min, b.Max) == a.Min || Vector3.Clamp(a.Max, b.Min, b.Max) == a.Max;
            //return !(a.Max.X < b.Min.X || a.Max.Y < b.Min.Y || a.Max.Z < b.Min.Z ||
            //         b.Max.X < a.Min.X || b.Max.Y < a.Min.Y || b.Max.Z < a.Min.Z);
            //return !(a.Max.X < b.Min.X | a.Max.Y < b.Min.Y | a.Max.Z < b.Min.Z |
            //         b.Max.X < a.Min.X | b.Max.Y < a.Min.Y | b.Max.Z < a.Min.Z);
            return a.Max.X >= b.Min.X & a.Max.Y >= b.Min.Y & a.Max.Z >= b.Min.Z &
                     b.Max.X >= a.Min.X & b.Max.Y >= a.Min.Y & b.Max.Z >= a.Min.Z;
            //return a.Max.X >= b.Min.X && a.Max.Y >= b.Min.Y && a.Max.Z >= b.Min.Z &&
            //         b.Max.X >= a.Min.X && b.Max.Y >= a.Min.Y && b.Max.Z >= a.Min.Z;
            //return Vector3.Min(Vector3.Max(a.Min, b.Min), b.Max) == a.Min ||
            //    Vector3.Min(Vector3.Max(a.Max, b.Min), b.Max) == a.Max ||
            //    Vector3.Min(Vector3.Max(b.Min, a.Min), a.Max) == b.Min ||
            //    Vector3.Min(Vector3.Max(b.Max, a.Min), a.Max) == b.Max;

            //This could be changed to result = And(GEQ(a.Max, b.Min), GEQ(b.Max, a.Min))
            //Then, horizontal And...
            //Could implement as dot(result, One). If that's -3, then we're good!
            //geq, geq, and, dot, load 3, compare. Six instructions instead of eleven, and no scalar swap.
        }