Question: Write the function def areaPolygon(p) that takes a list p of tuples, representing the vertices of a polygon, sorted counterclockwise around the polygon, and returns

Write the function def areaPolygon(p) that takes a list p of tuples, representing the vertices of a polygon, sorted counterclockwise around the polygon, and returns the area of the polygon. The area of a polygon may be decomposed into the sum of the signed areas of acollection of triangles built by walking around the polygon. In particular, if the polygon vertices moving counterclockwise around the polygon are p0,p1..., pk and if O is the origin (0,0) in 2-space, then the polygon area is the sum of the signed areas of the triangles Op0p1, Op1p2,...,Opkp0.(If you walk around the polygon in the clockwise direction, then the sum of the signed areas will be the negative area of the polygon.)

Note: Your code should use the signedArea function you designed above

Note: Using Visual Studio Code, Python 3

Note: this is a intro class to computer science in python

BANNED SYNTAX: printing, the replace function in the string module, use of the NumPy module, and recursion.

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!