Cody

# Problem 44369. Circle/Pentagon Overlap

Solution 1867319

Submitted on 7 Jul 2019 by Nikolaos Nikolaou
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
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [0,0]; r = 5; y_correct = 5; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = 0.0200 t = 0.0200 0.0140 t = 0.0200 0.0140 0.0154 t = 0.0200 0.0140 0.0154 0.0154 t = 0.0200 0.0140 0.0154 0.0154 0.0140 ans = 5

2   Pass
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [0,0]; r = 4; y_correct = 0; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = -0.9800 t = -0.9800 -0.9860 t = -0.9800 -0.9860 -0.9846 t = -0.9800 -0.9860 -0.9846 -0.9846 t = -0.9800 -0.9860 -0.9846 -0.9846 -0.9860 ans = 0

3   Pass
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [0,0]; r = 15; y_correct = 5; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = 10.0200 t = 10.0200 10.0140 t = 10.0200 10.0140 10.0154 t = 10.0200 10.0140 10.0154 10.0154 t = 10.0200 10.0140 10.0154 10.0154 10.0140 ans = 5

4   Pass
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [2,0]; r = 5; y_correct = 2; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = -0.3652 t = -0.3652 1.8545 t = -0.3652 1.8545 0.8623 t = -0.3652 1.8545 0.8623 -1.3680 t = -0.3652 1.8545 0.8623 -1.3680 -1.9154 ans = 2

5   Pass
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [2,0.75]; r = 5; y_correct = 3; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = 0.3229 t = 0.3229 2.1464 t = 0.3229 2.1464 0.1288 t = 0.3229 2.1464 0.1288 -1.8679 t = 0.3229 2.1464 0.1288 -1.8679 -1.7872 ans = 3

6   Pass
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [7.5,0]; r = 5; y_correct = 1; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = -3.9939 t = -3.9939 1.8720 t = -3.9939 1.8720 -1.0789 t = -3.9939 1.8720 -1.0789 -6.1780 t = -3.9939 1.8720 -1.0789 -6.1780 -7.3376 ans = 1

7   Pass
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [0,-5]; r = 9; y_correct = 4; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = -0.9800 t = -0.9800 0.9231 t = -0.9800 0.9231 5.9303 t = -0.9800 0.9231 5.9303 5.9303 t = -0.9800 0.9231 5.9303 5.9303 0.9231 ans = 4

8   Pass
p = [23.66,11.42; 24.37,5.58; 19.05,3.10; 15.04,7.40; 17.89,12.54]; cp = [20,8]; r = 5; y_correct = 5; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = 0.0108 t = 0.0108 0.0247 t = 0.0108 0.0247 0.0288 t = 0.0108 0.0247 0.0288 0.0238 t = 0.0108 0.0247 0.0288 0.0238 0.0136 ans = 5

9   Pass
p = [23.66,11.42; 24.37,5.58; 19.05,3.10; 15.04,7.40; 17.89,12.54]; cp = [19,8]; r = 5; y_correct = 3; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = -0.7603 t = -0.7603 -0.8701 t = -0.7603 -0.8701 0.1197 t = -0.7603 -0.8701 0.1197 1.0148 t = -0.7603 -0.8701 0.1197 1.0148 0.3463 ans = 3

10   Pass
p = [23.66,11.42; 24.37,5.58; 19.05,3.10; 15.04,7.40; 17.89,12.54]; cp = [19.5,10]; r = 5; y_correct = 2; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = 0.6243 t = 0.6243 -1.5567 t = 0.6243 -1.5567 -1.8947 t = 0.6243 -1.5567 -1.8947 -0.1425 t = 0.6243 -1.5567 -1.8947 -0.1425 2.0127 ans = 2

11   Pass
p = [23.66,11.42; 24.37,5.58; 19.05,3.10; 15.04,7.40; 17.89,12.54]; cp = [19.5,10]; r = 6.6; y_correct = 4; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = 2.2243 t = 2.2243 0.0433 t = 2.2243 0.0433 -0.2947 t = 2.2243 0.0433 -0.2947 1.4575 t = 2.2243 0.0433 -0.2947 1.4575 3.6127 ans = 4

12   Pass
p = [23.66,11.42; 24.37,5.58; 19.05,3.10; 15.04,7.40; 17.89,12.54]; cp = [19.5,10]; r = 7; y_correct = 5; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = 2.6243 t = 2.6243 0.4433 t = 2.6243 0.4433 0.1053 t = 2.6243 0.4433 0.1053 1.8575 t = 2.6243 0.4433 0.1053 1.8575 4.0127 ans = 5

13   Pass
p = [30.94,36.26; 35.61,27.09; 28.34,19.82; 19.17,24.49; 20.78,34.65]; cp = [26.97,28.45]; r = 8.75; y_correct = 5; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = 0.0089 t = 0.0089 0.0236 t = 0.0089 0.0236 0.0319 t = 0.0089 0.0236 0.0319 0.0223 t = 0.0089 0.0236 0.0319 0.0223 0.0089 ans = 5

14   Pass
p = [30.94,36.26; 35.61,27.09; 28.34,19.82; 19.17,24.49; 20.78,34.65]; cp = [26.97,28.45]; r = 8; y_correct = 0; assert(isequal(circle_pentagon_overlap(p,cp,r),y_correct))

t = -0.7411 t = -0.7411 -0.7264 t = -0.7411 -0.7264 -0.7181 t = -0.7411 -0.7264 -0.7181 -0.7277 t = -0.7411 -0.7264 -0.7181 -0.7277 -0.7411 ans = 0

### Community Treasure Hunt

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

Start Hunting!