Cody

Problem 193. Smallest distance between a point and a rectangle

Solution 18090

Submitted on 31 Jan 2012
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num'},'FileName','distanceRectangle2Point.m')

Error: You may not use the command(s) evalin in your code

2   Fail
x = [-1,-1]; y = [1,1]; z = [4,5]; assert(isequal(distanceRectangle2Point(x,y,z),5)) d_correct = 5;

Error: You may not use the command(s) evalin in your code

3   Fail
x = [-2,-1]; y = [3,1]; z = [1,2]; assert(isequal(distanceRectangle2Point(x,y,z),1)) d_correct = 1;

Error: You may not use the command(s) evalin in your code

4   Fail
x = [1,2]; y = [3,4]; z = [-5,3]; assert(isequal(distanceRectangle2Point(x,y,z),6)) d_correct = 6;

Error: You may not use the command(s) evalin in your code

5   Fail
x = [2,2]; y = [4,4]; z = [3,4]; assert(isequal(distanceRectangle2Point(x,y,z),0)) d_correct = 0;

Error: You may not use the command(s) evalin in your code

6   Fail
x = [-1,0,1]; y = [0,2,4]; z = [4,5,3]; assert(isequal(distanceRectangle2Point(x,y,z),5)) d_correct = 5;

Error: You may not use the command(s) evalin in your code

7   Fail
x = [1,0,1]; y = [2,3,2]; z = [-1,-2,3]; assert(isequal(distanceRectangle2Point(x,y,z),3)) d_correct = 3;

Error: You may not use the command(s) evalin in your code

Suggested Problems

More from this Author38

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!