Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Distance between two 2D squares

$
0
0
How do I find the distance between two 2D squares if I am given x, y, length, and height of two 2D squares?

Current idea I have is to simply brute force it and check the distance from every point in one edge of a square with every point in one edge of the other square and pick the lowest distance of the two. (the edges depending on the location/length of the two squares)

Is there a better way/algorithm for this?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>