Question: 6.9 The area inside any polygon can be broken down into a series of triangles, as shown in Figure 6.7. If this is an n-sided

6.9 The area inside any polygon can be broken down into a series of triangles, as shown in Figure 6.7. If this is an n-sided polygon, then it can be divided into n-2 triangles. Create a function that calculates the perimeter of the polygon and the area enclosed by the polygon. Use function area2d from the previous exercise to calculate the area of the polygon. Write a program that accepts an ordered list of points bounding a polygon and calls your function to return the perimeter and area of the polygon. Then test your function by calculating the perimeter and area of a polygon bounded by the points (0,0), (10,0),(8,8), (2, 10), and (4,5) (x3, y3) (x2, y2) xj,y) Figure 6.6 A triangle bounded by points (y) y), and (,y,). (r ys) ( y) (x3, y3) (x2, y2) (xi. yi) Figure 6.7 An arbitrary polygon can be divided up into a series of triangles If there are n sides to the polygon, then it can be divided into n - 2 triangles. 6.9 The area inside any polygon can be broken down into a series of triangles, as shown in Figure 6.7. If this is an n-sided polygon, then it can be divided into n-2 triangles. Create a function that calculates the perimeter of the polygon and the area enclosed by the polygon. Use function area2d from the previous exercise to calculate the area of the polygon. Write a program that accepts an ordered list of points bounding a polygon and calls your function to return the perimeter and area of the polygon. Then test your function by calculating the perimeter and area of a polygon bounded by the points (0,0), (10,0),(8,8), (2, 10), and (4,5) (x3, y3) (x2, y2) xj,y) Figure 6.6 A triangle bounded by points (y) y), and (,y,). (r ys) ( y) (x3, y3) (x2, y2) (xi. yi) Figure 6.7 An arbitrary polygon can be divided up into a series of triangles If there are n sides to the polygon, then it can be divided into n - 2 triangles
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
