MCPcopy Create free account
hub / github.com/cuberite/cuberite / DoIntervalsIntersect

Function DoIntervalsIntersect

src/Cuboid.cpp:11–18  ·  view source on GitHub ↗

Returns true if the two specified intervals have a non-empty union

Source from the content-addressed store, hash-verified

9
10/// Returns true if the two specified intervals have a non-empty union
11static 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

Callers 1

DoesIntersectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected