Problem 193. Smallest distance between a point and a rectangle
For the n dimensional case it would be better to say that x and y lie on opposite vertices of the n-hypercuboid such that each edge is parallel to a coordinate axis.
Two points do not define a rectangle. This is especially true in 3D space. A correct answer to this question would be 0 or the point closest to the circle defined by the two points on the diameter, depending on the rectangle you chose to make. (Every rectangle formed from two points defining opposite corners makes a circle, and in 3D, a sphere). I genuinely do not know how you want me to handle the 3D cases.
Solution CommentsShow comments
Problem Recent Solvers168
Test if a Number is a Palindrome without using any String Operations
Arrange vector in ascending order
The Answer to Life, the Universe, and Everything
More from this Author38
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!