Problem 44386. Circumscribed Pentagon?
Building off of Problem 44368, your function will be provided with the five vertices of a regular pentagon (p) as well as the center point (cp) and radius (r) of a circle. The function should return one of the following values:
0: the pentagon is completely enclosed within the circle but is not inscribed 1: the pentagon is inscribed in the circle (within ±0.02) 2: the vertices of the pentagon extend beyond the circle, but its edges still cross back into the circle 3: the pentagon circumscribes the circle (within ±0.02) 4: the pentagon completely encloses, and does not touch, the circle
Points will be rounded to the nearest hundredth. See the test cases for examples.
Solution Stats
Problem Comments

4 Comments
Can there be a mistake about the answer for the last test suite? y_correct is given as 3 so the case where all edges are tangent to circle but when I draw it I see a pentagon that does not touch the circle at all and it is clearly visible without zooming so I don't think error is less than 0.02. I find the answer as y=4 which I think is correct. Can you please check it?
I do believe that it was within the tolerance, though that last case did not touch the pentagon, as you mentioned. I slightly increased the radius in that test case to reduce the gap between the pentagon and circle.
Hi, goc3. Nice problem. I have one piece of feedback. I anticipated in a "Cody5:Hard" problem that the pentagon & circle couldn't be assumed to have the same centre if it weren't stated in the problem, but roughly they do seem to share a centre in the present Test Suite. If that is the case, then I suggest either explicitly mentioning it in the Problem Statement, or else adding more test cases where the shapes don't share a centre. An example of the latter would be a tiny circle centred midway along one of the edges of a large pentagon (correct answer 2, but would probably be misclassified if centres assumed equal). Regards, DIV
Agree with David.
Moreover it is not mentioned that pentagon is regular (didn't check all cases, but most of them are regular).
Solution Comments
Show commentsProblem Recent Solvers63
Suggested Problems

1811 Solvers

292 Solvers

343 Solvers

496 Solvers

343 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!