Cody

# Problem 44367. Inscribed Pentagon? 2

Solution 1310414

Submitted on 23 Oct 2017 by Philipp Doblhofer
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 = 1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0 5.0000 4.7600 1.5500 2.9400 -4.0500 -2.9400 -4.0500 -4.7600 1.5500 d = 5.0000 5.0060 5.0046 5.0046 5.0060

2   Pass
p = [0,6.58; 6.42,1.92; 3.97,-5.63; -3.97,-5.63; -6.42,1.92]; cp = [0,0]; r = 5; y_correct = 2; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0 6.5800 6.4200 1.9200 3.9700 -5.6300 -3.9700 -5.6300 -6.4200 1.9200 d = 6.5800 6.7010 6.8890 6.8890 6.7010

3   Pass
p = [0,4.55; 4.28,1.44; 2.65,-3.59; -2.65,-3.59; -4.28,1.44]; cp = [0,0]; r = 5; y_correct = 0; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0 4.5500 4.2800 1.4400 2.6500 -3.5900 -2.6500 -3.5900 -4.2800 1.4400 d = 4.5500 4.5158 4.4621 4.4621 4.5158

4   Pass
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [0,0.5]; r = 8.75; y_correct = -1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0 4.5000 4.7600 1.0500 2.9400 -4.5500 -2.9400 -4.5500 -4.7600 1.0500 d = 4.5000 4.8744 5.4172 5.4172 4.8744

5   Pass
p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55]; cp = [1.98,-0.47]; r = 8.75; y_correct = -1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = -1.9800 5.4700 2.7800 2.0200 0.9600 -3.5800 -4.9200 -3.5800 -6.7400 2.0200 d = 5.8173 3.4364 3.7065 6.0846 7.0362

6   Pass
cp = [20,8]; p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55] + repmat(cp,[5,1]); r = 5; y_correct = 1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0 5.0000 4.7600 1.5500 2.9400 -4.0500 -2.9400 -4.0500 -4.7600 1.5500 d = 5.0000 5.0060 5.0046 5.0046 5.0060

7   Pass
cp = [20,8]; p = [0,6.58; 6.42,1.92; 3.97,-5.63; -3.97,-5.63; -6.42,1.92] + repmat(cp,[5,1]); r = 5; y_correct = 2; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0 6.5800 6.4200 1.9200 3.9700 -5.6300 -3.9700 -5.6300 -6.4200 1.9200 d = 6.5800 6.7010 6.8890 6.8890 6.7010

8   Pass
cp = [20,8]; p = [0,4.55; 4.28,1.44; 2.65,-3.59; -2.65,-3.59; -4.28,1.44] + repmat(cp,[5,1]); r = 5; y_correct = 0; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0 4.5500 4.2800 1.4400 2.6500 -3.5900 -2.6500 -3.5900 -4.2800 1.4400 d = 4.5500 4.5158 4.4621 4.4621 4.5158

9   Pass
cp_temp = [20,8]; p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55] + repmat(cp_temp,[5,1]); cp = [19.5,9.08]; r = 2.5; y_correct = -1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0.5000 3.9200 5.2600 0.4700 3.4400 -5.1300 -2.4400 -5.1300 -4.2600 0.4700 d = 3.9518 5.2810 6.1766 5.6807 4.2858

10   Pass
cp_temp = [20,8]; p = [0,5; 4.76,1.55; 2.94,-4.05; -2.94,-4.05; -4.76,1.55] + repmat(cp_temp,[5,1]); cp = [19.86,7.19]; r = 7.5; y_correct = -1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 0.1400 5.8100 4.9000 2.3600 3.0800 -3.2400 -2.8000 -3.2400 -4.6200 2.3600 d = 5.8117 5.4387 4.4703 4.2822 5.1879

11   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 = 1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 3.6600 3.4200 4.3700 -2.4200 -0.9500 -4.9000 -4.9600 -0.6000 -2.1100 4.5400 d = 5.0092 4.9953 4.9912 4.9962 5.0064

12   Pass
p = [25.01,12.47; 25.98,4.58; 18.78,1.23; 13.37,7.03; 17.22,13.97]; cp = [20,8]; r = 5; y_correct = 2; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 5.0100 4.4700 5.9800 -3.4200 -1.2200 -6.7700 -6.6300 -0.9700 -2.7800 5.9700 d = 6.7142 6.8889 6.8790 6.7006 6.5855

13   Pass
p = [23.27,11.12; 23.92,5.87; 19.12,3.63; 15.52,7.50; 18.08,12.13]; cp = [20,8]; r = 5; y_correct = 0; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 3.2700 3.1200 3.9200 -2.1300 -0.8800 -4.3700 -4.4800 -0.5000 -1.9200 4.1300 d = 4.5197 4.4613 4.4577 4.5078 4.5545

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.75; y_correct = 1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 3.9700 7.8100 8.6400 -1.3600 1.3700 -8.6300 -7.8000 -3.9600 -6.1900 6.2000 d = 8.7611 8.7464 8.7381 8.7477 8.7611

15   Pass
p = [32.54,38.78; 38.84,26.41; 29.02,16.59; 16.65,22.89; 18.83,36.61]; cp = [26.97,28.45]; r = 8.75; y_correct = 2; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 5.5700 10.3300 11.8700 -2.0400 2.0500 -11.8600 -10.3200 -5.5600 -8.1400 8.1600 d = 11.7360 12.0440 12.0359 11.7225 11.5258

16   Pass
p = [30.49,35.54; 34.69,27.29; 28.14,20.74; 19.89,24.95; 21.34,34.09]; cp = [26.97,28.45]; r = 8.75; y_correct = 0; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 3.5200 7.0900 7.7200 -1.1600 1.1700 -7.7100 -7.0800 -3.5000 -5.6300 5.6400 d = 7.9157 7.8067 7.7983 7.8979 7.9691

17   Pass
p = [30.94,36.26; 35.61,27.09; 28.34,19.82; 19.17,24.49; 20.78,34.65]; cp = [26.41,29.04]; r = 6.13; y_correct = -1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 4.5300 7.2200 9.2000 -1.9500 1.9300 -9.2200 -7.2400 -4.5500 -5.6300 5.6100 d = 8.5235 9.4044 9.4198 8.5510 7.9479

18   Pass
p = [30.94,36.26; 35.61,27.09; 28.34,19.82; 19.17,24.49; 20.78,34.65]; cp = [27.07,27.66]; r = 9.63; y_correct = -1; assert(isequal(inscribed_pentagon2(p,cp,r),y_correct))

d2 = 3.8700 8.6000 8.5400 -0.5700 1.2700 -7.8400 -7.9000 -3.1700 -6.2900 6.9900 d = 9.4306 8.5590 7.9422 8.5123 9.4034