@jjbarnes
I am only responding to you because I don’t want you to be disappointed as a learner and understand learning as a journey to know, accept and sometimes let go.
I do appreciate your effort to find and explore on the exercises you are working upon, that’s a sign of inquisitive student but as you know in your previous post many of the mentors have already provided their response on your approach.
Here is my take on your approach and the assignment approach both do get the same result but the idea behind to avoid the if and else statement which introduces branching. In high-performance object detection loops (like non-max suppression processing thousands of bounding boxes per frame), conditional statements can cause pipeline stalls and reduce processing speed.
Another reason because the initial coordinate variables (x_{i1}, y_{i1}, x_{i2}, y_{i2}) already represent the theoretical intersection edges, the approach of if and else statement might be considered as an unnecessary extra validation point which was avoided for cleaner approach of algorithms.
Now why the assignment approach of continuous mathematical operations is better one? My simple understanding is the execution simple codes and also by setting \max(x_2 - x_1, 0), it inherently prevents situations where the coordinates cross and result in a negative width or height. If the boxes do not overlap, (x_2 - x_1) evaluates to a negative number, and the max function smoothly clamps it to 0. basically assignment codes is using the mathematical function \max(0, x) to handle non-overlapping boxes automatically without any branching issue which can be hindrance computationally while implementation of intersection over Union - IoU
So no one is saying your approach is incorrect, just that simpler codes helps better response when comes object detection.
I rest my reasoning, and I hope you don’t dishearten yourself with this one topic, and continue your learning journey as inquisitive you continue to do but with a fresh perspective that people responding on your post, be it members or mentors, are only helping you and not discouraging you. Remember if others are not agreeing on your approach then doesn’t mean discouragement, infact they are giving their honest view on your topic.
Good luck
Regards
Dr. Deepti