Question: Task 1 Write a function, nearest _ edge _ square ( x , y , length ) , which returns a tuple containing an integer

Task 1 Write a function, nearest_edge_square(x, y, length), which returns a tuple containing an integer (0,1,2 or 3) indicating which is the nearest edge and a float for the distance to the edge. The parameters x, y and length are all floats. x and y are the coordinates for the point in the square, and length is the length of square. Note: Assume the square has a lower left corner at (0,0). Use integers to represent the edges of the square. The particular mapping of edges to integer values is shown in Figure 4. Also note that Figure 4 contains a hint on how to compute the distance to the edges; take the perpendicular distance from the point to the edge.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!