Cody

# Problem 44367. Inscribed Pentagon? 2

Solution 1292267

Submitted on 17 Oct 2017 by David Verrelli
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))

cX = 0 cY = 4.4409e-17 minDiff = 0 minDiff = 9.7321e-04 minDiff = 1.0815e-04 minDiff = 1.0815e-04 minDiff = 9.7321e-04 y = 1

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

cX = 0 cY = -0.1680 minDiff = 1.5800 minDiff = 4.3890 minDiff = 2.5262 minDiff = 2.5262 minDiff = 4.3890 y = 2

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

cX = -1.7764e-16 cY = 0.0500 minDiff = 0.4497 minDiff = 1.0602 minDiff = 0.6183 minDiff = 0.6183 minDiff = 1.0602 y = 0

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

cX = 0 cY = 4.4409e-17 y = -1

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

cX = 0 cY = 4.4409e-17 y = -1

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

cX = 20 cY = 8 minDiff = 0 minDiff = 9.7321e-04 minDiff = 1.0815e-04 minDiff = 1.0815e-04 minDiff = 9.7321e-04 y = 1

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

cX = 20 cY = 7.8320 minDiff = 1.5800 minDiff = 4.3890 minDiff = 2.5262 minDiff = 2.5262 minDiff = 4.3890 y = 2

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

cX = 20 cY = 8.0500 minDiff = 0.4497 minDiff = 1.0602 minDiff = 0.6183 minDiff = 0.6183 minDiff = 1.0602 y = 0

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

cX = 20 cY = 8 y = -1

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

cX = 20 cY = 8 y = -1

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

cX = 20.0020 cY = 8.0080 minDiff = 4.3725e-04 minDiff = 6.1459e-04 minDiff = 2.5510e-06 minDiff = 0.0011 minDiff = 6.8833e-05 y = 1

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

cX = 20.0720 cY = 7.8560 minDiff = 3.8388 minDiff = 4.6756 minDiff = 1.9088 minDiff = 4.3860 minDiff = 1.7811 y = 2

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

cX = 19.9820 cY = 8.0500 minDiff = 0.6187 minDiff = 0.9096 minDiff = 0.5427 minDiff = 1.6164 minDiff = 0.4656 y = 0

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

cX = 26.9680 cY = 28.4620 minDiff = 2.1607e-04 minDiff = 0.0021 minDiff = 0.0040 minDiff = 7.4616e-04 minDiff = 3.4064e-04 y = 1

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

cX = 27.1760 cY = 28.2560 minDiff = 3.5409 minDiff = 8.2044 minDiff = 3.3416 minDiff = 7.7346 minDiff = 4.8262 y = 2

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

cX = 26.9100 cY = 28.5220 minDiff = 0.8986 minDiff = 2.8636 minDiff = 0.9545 minDiff = 1.5720 minDiff = 1.0158 y = 0

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

cX = 26.9680 cY = 28.4620 y = -1

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

cX = 26.9680 cY = 28.4620 y = -1