public static void Test() { SubTree x = new SubTree() { width = 2, offset = 0 }; Console.WriteLine("Should evaluate to |True => False|"); Console.WriteLine(x.Overlaps(new SubTree() { width = 2.0001, offset = 2 })); Console.WriteLine(x.Overlaps(new SubTree() { width = 2, offset = 2.0001 })); }
public bool Overlaps(SubTree other) { return(((offset - width / 2) < (other.offset + other.width / 2)) && ((offset + width / 2) > (other.offset - other.width / 2))); }