Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer in PYTHON and please do NOT use Turtle or import any other libraries!! Importing others and using turtle will be INCORRECT for this

Please answer in PYTHON and please do NOT use Turtle or import any other libraries!! Importing others and using turtle will be INCORRECT for this question! Use THIS previous Kink function and answer ASAP please!

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

hint from prof: First off, lets make sure to utilize our Kink function we defined before. Lets break down what this question wants us to do. Kink a polygon. In this sense a polygon is a list of tuples, with each tuple being a coordinate. What we need to do is kink the first coordinate to the second, second to the third, and so on until we get to n-1 coordinate to the nth coordinate. Then we need to kink the nth coordinate to the first. We need to store all these kinks in a list. This list will now be a list of tuples who themselves contain tuples. This isnt what we want, as a polygon is a list of tuples in the form (x,y). So we need to go into this list, extract each tuple, and again, extract the tuples in those tuples to a new list.

def kink(po, p1): """Returns the tuple of the four points q0, 91, 92, 93, resulting from kinking po, p1. Note that each q is returned as a two-element tuple.' # YOUR CODE HERE d = (p1[0] -po[@], P1[1]-po[1]) v = (-(P1[1]-p0[1]), p1[@]-p[@]) = V = = 90 po 91 (PO[0] + 1/4* (d[0]), PO[1]+1/4* (d[1])) q2 = (p0[0] + 1/2* (d[0])+1/4* (V[0]), p0[1]+1/2*(d[1])+1/4* (v[1])) 93 = (po[0] + 3/4* (d[0]), p0[1]+3/4* (d[1])) return 90, 91, 92, 93/ Kinking polygons To kink a polygon, we simply kink every one of its segments. It looks like this. If the basic polygon is: [14] poly1 = [(0, 0), (1, 2), (2, 0)] draw_polygon(*polyi) 2.00 175 150 125 1.00 0.75 0.50 0.25 0.00 0.0 0.5 10 1.5 20 Then its kinked version has to look like this: 2.0 15 10 0.5 0.0 -0.5 0.0 0.5 10 15 2.0 9 [15] def kink_polygon(poly): # YOUR CODE HERE Os File "zipython-input-15-04f63d0230df>", line 2 # YOUR CODE HERE A SyntaxError: unexpected EOF while parsing SEARCH STACK OVERFLOW O [ ] # You can use this space to debug your code. Os # YOUR CODE HERE Let us check that the solution works as intended. Os O [] poly1 = [(0, 0), (1, 2), (2, 0)] poly2 = kink_polygon (polyi) draw_polygon(*poly2)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions