Original Post
I would like to knoow if my math is correct in calculating the distance between 2 objects on a 2D plain:
Thanks.
def distance(x1,x2,y1,y2):
# A squared + B squared = C squared
return ( ( (x2 - x1)**2) + ( (y2-y1)**2) )**.5
# Object 1 Location
coordinate1 = 2,8 # x,y
# Object 2 Location
coordinate2 = 5,10 # x,y
print (distance(coordinate1[0],coordinate2[0],coordinate1[1],coordinate2[1]))Thanks.