Limits: Boundary inclusion in rect.Intersects and rect.Contains
20K reputation · 26 Feb 2020, 21:15 UTC
The goal is to determine how the rect library defines containment and intersection when points lie exactly on the rectangle's edges or when two rectangles touch at an edge or corner.
The library's source uses <= comparisons, suggesting edges are included, but the official documentation does not state this explicitly. Existing tests cover interior points but omit boundary cases, creating ambiguity for consumers who rely on strict geometric definitions.
Questions to resolve:
1) Does rect.Contains return true for a point whose coordinates equal the rectangle's minimum or maximum bounds?
2) Does rect.Intersects return true when two rectangles share only an edge or a single corner point?
3) If the behavior differs across releases, what version changes introduced the current logic?