Returns true if the two specified intervals have a non-empty union
| 9 | |
| 10 | /// Returns true if the two specified intervals have a non-empty union |
| 11 | static bool DoIntervalsIntersect(int a_Min1, int a_Max1, int a_Min2, int a_Max2) |
| 12 | { |
| 13 | return ( |
| 14 | ((a_Min1 >= a_Min2) && (a_Min1 <= a_Max2)) || // Start of first interval is within the second interval |
| 15 | ((a_Max1 >= a_Min2) && (a_Max1 <= a_Max2)) || // End of first interval is within the second interval |
| 16 | ((a_Min2 >= a_Min1) && (a_Min2 <= a_Max1)) // Start of second interval is within the first interval |
| 17 | ); |
| 18 | } |
| 19 | |
| 20 | |
| 21 |