Cody

Problem 44369. Circle/Pentagon Overlap

Solution 1304772

Submitted on 20 Oct 2017 by Andrew Dobrovolc
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))

sq = 0 25.0000 22.6576 2.4025 8.6436 16.4025 8.6436 16.4025 22.6576 2.4025

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

sq = 0 25.0000 22.6576 2.4025 8.6436 16.4025 8.6436 16.4025 22.6576 2.4025

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

sq = 0 25.0000 22.6576 2.4025 8.6436 16.4025 8.6436 16.4025 22.6576 2.4025

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

sq = 4.0000 25.0000 7.6176 2.4025 0.8836 16.4025 24.4036 16.4025 45.6976 2.4025

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

sq = 4.0000 18.0625 7.6176 0.6400 0.8836 23.0400 24.4036 23.0400 45.6976 0.6400

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

sq = 56.2500 25.0000 7.5076 2.4025 20.7936 16.4025 108.9936 16.4025 150.3076 2.4025

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

sq = 0 100.0000 22.6576 42.9025 8.6436 0.9025 8.6436 0.9025 22.6576 42.9025

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

sq = 13.3956 11.6964 19.0969 5.8564 0.9025 24.0100 24.6016 0.3600 4.4521 20.6116

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

sq = 21.7156 11.6964 28.8369 5.8564 0.0025 24.0100 15.6816 0.3600 1.2321 20.6116

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

sq = 17.3056 2.0164 23.7169 19.5364 0.2025 47.6100 19.8916 6.7600 2.5921 6.4516

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

sq = 17.3056 2.0164 23.7169 19.5364 0.2025 47.6100 19.8916 6.7600 2.5921 6.4516

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

sq = 17.3056 2.0164 23.7169 19.5364 0.2025 47.6100 19.8916 6.7600 2.5921 6.4516

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

sq = 15.7609 60.9961 74.6496 1.8496 1.8769 74.4769 60.8400 15.6816 38.3161 38.4400

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

sq = 15.7609 60.9961 74.6496 1.8496 1.8769 74.4769 60.8400 15.6816 38.3161 38.4400

Suggested Problems

More from this Author139

Community Treasure Hunt

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

Start Hunting!