Cody

# Problem 44369. Circle/Pentagon Overlap

Solution 2023941

Submitted on 16 Nov 2019 by Doan Quang Manh
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))

a = 0 5 d = 5 y = 1 a = 4.7600 1.5500 d = 5.0060 y = 2 a = 2.9400 -4.0500 d = 5.0046 y = 3 a = -2.9400 -4.0500 d = 5.0046 y = 4 a = -4.7600 1.5500 d = 5.0060 y = 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))

a = 0 5 d = 5 a = 4.7600 1.5500 d = 5.0060 a = 2.9400 -4.0500 d = 5.0046 a = -2.9400 -4.0500 d = 5.0046 a = -4.7600 1.5500 d = 5.0060

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))

a = 0 5 d = 5 y = 1 a = 4.7600 1.5500 d = 5.0060 y = 2 a = 2.9400 -4.0500 d = 5.0046 y = 3 a = -2.9400 -4.0500 d = 5.0046 y = 4 a = -4.7600 1.5500 d = 5.0060 y = 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))

a = 0 5 d = 5.3852 a = 4.7600 1.5500 d = 3.1655 y = 1 a = 2.9400 -4.0500 d = 4.1577 y = 2 a = -2.9400 -4.0500 d = 6.3880 a = -4.7600 1.5500 d = 6.9354

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))

a = 0 5 d = 4.6971 y = 1 a = 4.7600 1.5500 d = 2.8736 y = 2 a = 2.9400 -4.0500 d = 4.8912 y = 3 a = -2.9400 -4.0500 d = 6.8879 a = -4.7600 1.5500 d = 6.8072

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))

a = 0 5 d = 9.0139 a = 4.7600 1.5500 d = 3.1480 y = 1 a = 2.9400 -4.0500 d = 6.0989 a = -2.9400 -4.0500 d = 11.1980 a = -4.7600 1.5500 d = 12.3576

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))

a = 0 5 d = 10 a = 4.7600 1.5500 d = 8.0969 y = 1 a = 2.9400 -4.0500 d = 3.0897 y = 2 a = -2.9400 -4.0500 d = 3.0897 y = 3 a = -4.7600 1.5500 d = 8.0969 y = 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))

a = 23.6600 11.4200 d = 5.0092 y = 1 a = 24.3700 5.5800 d = 4.9953 y = 2 a = 19.0500 3.1000 d = 4.9912 y = 3 a = 15.0400 7.4000 d = 4.9962 y = 4 a = 17.8900 12.5400 d = 5.0064 y = 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))

a = 23.6600 11.4200 d = 5.7803 a = 24.3700 5.5800 d = 5.8901 a = 19.0500 3.1000 d = 4.9003 y = 1 a = 15.0400 7.4000 d = 4.0052 y = 2 a = 17.8900 12.5400 d = 4.6737 y = 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))

a = 23.6600 11.4200 d = 4.3957 y = 1 a = 24.3700 5.5800 d = 6.5767 a = 19.0500 3.1000 d = 6.9147 a = 15.0400 7.4000 d = 5.1625 a = 17.8900 12.5400 d = 3.0073 y = 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))

a = 23.6600 11.4200 d = 4.3957 y = 1 a = 24.3700 5.5800 d = 6.5767 y = 2 a = 19.0500 3.1000 d = 6.9147 a = 15.0400 7.4000 d = 5.1625 y = 3 a = 17.8900 12.5400 d = 3.0073 y = 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))

a = 23.6600 11.4200 d = 4.3957 y = 1 a = 24.3700 5.5800 d = 6.5767 y = 2 a = 19.0500 3.1000 d = 6.9147 y = 3 a = 15.0400 7.4000 d = 5.1625 y = 4 a = 17.8900 12.5400 d = 3.0073 y = 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))

a = 30.9400 36.2600 d = 8.7611 y = 1 a = 35.6100 27.0900 d = 8.7464 y = 2 a = 28.3400 19.8200 d = 8.7381 y = 3 a = 19.1700 24.4900 d = 8.7477 y = 4 a = 20.7800 34.6500 d = 8.7611 y = 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))

a = 30.9400 36.2600 d = 8.7611 a = 35.6100 27.0900 d = 8.7464 a = 28.3400 19.8200 d = 8.7381 a = 19.1700 24.4900 d = 8.7477 a = 20.7800 34.6500 d = 8.7611

### Community Treasure Hunt

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

Start Hunting!