Question: Write the function def signedArea(A,B,C) that takes three parameters A, B, and C, representing the three vertices of an oriented triangle, and returns the signed

Write the function def signedArea(A,B,C) that takes three parameters A, B, and C, representing the three vertices of an oriented triangle, and returns the signed area of the triangle ABC. Each parameter is a tuple of 2 floats, representing a point in 2-space. 2-space is our term for two dimensional space, like the floor of your room, but a really large room.

The signed area of the oriented triangle ABC in 2-space is the area of the triangle, but positive if ABC defines a left turn (counterclockwise) and negative if ABC defines a right turn (clockwise). For example, if A=(1,1), B=(3,1), C=(3,2), then the signed area of the triangle ABC is 1.0, and the signed area of the triangle ACB is -1.0.

To calculate the signed area of the triangle ABC, use the following facts. The vector between two points P and Q is Q - P (component-wise subtraction: for example, (2,1) - (.5,.3) is (1.5,.7)). The signed area of the triangle spanned by vectors B = (v0,v1) and W = (w0,w1) is v0*w1-v1*w0/2.

NOTE: Using Visual Studio Code, Python 3

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

Sample Input: A = (1.282760, -0.976745), B = (1.842140, -0.493923), C = (1.721342, -0.522173)

Sample Input: A = (1.5206873, -0.56709507), B = (1.1318772, -0.14851698), C = (1.3371227, -0.83706997)

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!