How to find two points that form closest distance between two rectangles?
问题 I'm trying to find algorithm that will find two points that represent closest distance between two rectangles. Like points C and J that form smallest distance on image below: I'm trying to not reinvent the wheel here and use something that is already battletested like boost::geometry::distance, but it only return distance and not also the points. 回答1: Not making things overly generic (by assuming floating point coordinates and cartesian coordinate system), here's an implementation of point-to