Cody

# Problem 44368. Inscribed Pentagon?

Solution 1290262

Submitted on 16 Oct 2017 by Reggie Wilcox
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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 5 d = 5.0060 d = 5.0046 d = 5.0046 d = 5.0060 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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 6.5800 ifail = logical 1 efail = logical 1 d = 6.7010 ifail = logical 1 efail = logical 1 d = 6.8890 ifail = logical 1 efail = logical 1 d = 6.8890 ifail = logical 1 efail = logical 1 d = 6.7010 ifail = logical 1 efail = logical 1 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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 4.5500 ifail = logical 1 d = 4.5158 ifail = logical 1 d = 4.4621 ifail = logical 1 d = 4.4621 ifail = logical 1 d = 4.5158 ifail = logical 1 y = 0

4   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 5 d = 5.0060 d = 5.0046 d = 5.0046 d = 5.0060 y = 1

5   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 6.5800 ifail = logical 1 efail = logical 1 d = 6.7010 ifail = logical 1 efail = logical 1 d = 6.8890 ifail = logical 1 efail = logical 1 d = 6.8890 ifail = logical 1 efail = logical 1 d = 6.7010 ifail = logical 1 efail = logical 1 y = 2

6   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 4.5500 ifail = logical 1 d = 4.5158 ifail = logical 1 d = 4.4621 ifail = logical 1 d = 4.4621 ifail = logical 1 d = 4.5158 ifail = logical 1 y = 0

7   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 5.0092 d = 4.9953 d = 4.9912 d = 4.9962 d = 5.0064 y = 1

8   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 6.7142 ifail = logical 1 efail = logical 1 d = 6.8889 ifail = logical 1 efail = logical 1 d = 6.8790 ifail = logical 1 efail = logical 1 d = 6.7006 ifail = logical 1 efail = logical 1 d = 6.5855 ifail = logical 1 efail = logical 1 y = 2

9   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 4.5197 ifail = logical 1 d = 4.4613 ifail = logical 1 d = 4.4577 ifail = logical 1 d = 4.5078 ifail = logical 1 d = 4.5545 ifail = logical 1 y = 0

10   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 8.7611 d = 8.7464 d = 8.7381 d = 8.7477 d = 8.7611 y = 1

11   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 11.7360 ifail = logical 1 efail = logical 1 d = 12.0440 ifail = logical 1 efail = logical 1 d = 12.0359 ifail = logical 1 efail = logical 1 d = 11.7225 ifail = logical 1 efail = logical 1 d = 11.5258 ifail = logical 1 efail = logical 1 y = 2

12   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_pentagon(p,cp,r),y_correct))

ifail = logical 0 efail = logical 0 d = 7.9157 ifail = logical 1 d = 7.8067 ifail = logical 1 d = 7.7983 ifail = logical 1 d = 7.8979 ifail = logical 1 d = 7.9691 ifail = logical 1 y = 0

### Community Treasure Hunt

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

Start Hunting!