generated from millerm22/Engineering_4_Notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPart 1 (Functions)
27 lines (20 loc) · 1.07 KB
/
Part 1 (Functions)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import board
import math
def LZ(VX1, VX2, VX3):
LZA = 0.5 * (VX1[0] * (VX2[1] - VX3[1]) + VX2[0] * (VX3[1] - VX1[1]) + VX3[0]* (VX1[1] - VX2[1]))
# this is the formula to find area based off of the coordinates we also could've done this with herrons formula but this is easier because it requires less math
return abs(LZA)
while True:
try:
# point 1 is (VX1[0],VX1[1])
# point 2 is (VX2[0],VX2[1])
# point 3 is (VX3[0],VX3[1])
VX1 = input('Enter X1,Y1:').split(",")
VX2 = input('Enter X2,Y2:').split(",")
VX3 = input('Enter X3,Y3:').split(",")
print(f"The Landing Zone with vertices ({VX1[0]},{VX1[1]}),({VX2[0]},{VX2[1]}),({VX3[0]},{VX3[1]}) is {LZ((int(VX1[0]),int(VX1[1])), (int(VX2[0]),int(VX2[1])), (int(VX3[0]),int(VX3[1])))} square km.")
# This the print that uses the function that was made above.
# It is extremely long because each point had to be indexed here.
except:
print("VALUE ERROR PLEASE TRY AGAIN")
# This throws an error if the user inputs the wrong data.