Contributing to Feature #3073: Convenient way of initializing RotatedRect
Hi! I am trying to build this initializer for RotatedRect as mentioned in a feature request here. Wanted to take feedback before I sent a PR.
Essentially, I take 3 points and derive the center, angle and side lengths using those. I assume the points to be in order (clockwise/anticlockwise), hence center is the mean of first and last points. I find the 2 vectors (corresponding to the 2 edges), and surely one of the vectors must have slope between 1 and -1. That vector (and corresponding edge) becomes our width, and hence the other becomes height. A patch is here.
Please let me know if there are issues with the implementation.
PS: Am really a noob, feel free to pick nits! Thanks!