Cody

# Problem 1452. Minimum Distance between two N-sided Polygons

Solution 2159358

Submitted on 13 Mar 2020 by Søren Holm-Petersen
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   Pass
polycell={[0 0 0 5 4 5 4 0] [2.5 5.5 3 9 -2 5.6]}; p2p_min=PolytoPol(polycell); assert(abs(p2p_min-0.5)<.01);

d = 6.0415 d = 5.9464 d = 5.5542 d = 2.5495 d = 1.6208 d = 0.5554 d = 1.5811 d = 3.8700 d = 1.5811 d = 5.7009 d = 8.0046 d = 5.7009

2   Pass
polycell={[0 10 0 90 50 50 100 90 100 10] [0 110 100 110 50 70]}; p2p_min=PolytoPol(polycell); assert(abs(p2p_min-15.617376)<.01);

d = 100 d = 78.1025 d = 78.0869 d = 20 d = 53.8516 d = 15.6174 d = 60 d = 20 d = 20 d = 20 d = 15.6174 d = 53.8516 d = 100 d = 78.0869 d = 78.1025

3   Pass
polycell={[0 110 100 110 50 70] [20 5 50 7 30 5]}; p2p_min=PolytoPol(polycell); assert(abs(p2p_min-63)<.01);

d = 106.8878 d = 109.2016 d = 106.8878 d = 114.4945 d = 114.4945 d = 126.1943 d = 63 d = 63 d = 68.0074

4   Pass
polycell={[-5 -5 -4 -4 -3 -3 -2 -2 5 5 5 0] [6 10 6 -10 20 0]}; p2p_min=PolytoPol(polycell); assert(abs(p2p_min-1)<.01);

d = 11 d = 12.0830 d = 18.6011 d = 10 d = 11.6619 d = 17.2047 d = 9 d = 11.4018 d = 15.8097 d = 8 d = 11.3137 d = 14.4147 d = 1 d = 12.7872 d = 4.6499 d = 1 d = 8.7186 d = 8.7186

### Community Treasure Hunt

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

Start Hunting!