General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Christian Baune
ThePrimeTime
comments
Comments by "Christian Baune" (@programaths) on "Programming Is Cooked" video.
For rectangles overlapping, if you need to try cases, excepted boundary cases (to make it much simpler to list): A contains B also swap A for B A contains only TL of B A contains only TR of B A contains only BL of B A contains only BR of B A contains TL and TR of B also swap A for B A contains TR and BR of B also swap A for B A contains BR and BL of B also swap A for B A contains BR and TL of B also swap A for B A overlaps B also swap A for B (for orientation) 16 cases A human would check if the two rectangles do not overlap, by looking if left side of A is to the right of right side of B or right side of B is to the left of left side of B AND same for top and bottom. A simpler problem is "intervals overlaps", it's easier to visualize: Lower bound of A is left of lower bound of interval B and upper bound of interval A is left of lower bound of interval B. Lower bound of A is left of lower bound of interval B and upper bound of interval A is in interval B. Lower bound of A is left of lower bound of interval B and upper bound of interval A is right of upper bound of interval B. Lower bound of A is in interval B and upper bound of A is in interval B. Lower bound of A is in interval B and upper bound of A is right of upper bound of interval B. Lower bound of A is right of upper bound of B and upper bound of A is right of upper bound of interval B. 6 cases And boundary cases are not taken into account! It's simpler to check that upper bound of A is left of lower bound of B or lower bound of A is right of upper bound of B is false. To be fair, I am not even sure I covered all cases for overlapping rectangles (besides ignoring boundary cases). So, it only makes it much harder.
2
Like a programmer: (2*4) : Include one point or two points, 4 symmetries (1*4) A and B swapped, contains two points, 4 symmetries (1*2) full containment (1*1) disjoint (1*2) overlap without containing vertices of each other. 17 cases.
1