Hi all. I'm working on a python file that will be included in a project I am working on. Unfortunately, I ran into some problems when it came to passing arguments from a function, to another function. Let me explain; I have two functions: dist and return_mouse_angle. dist returns the distance between two points, and return_mouse_angle returns the slope of two points...
def dist(p1,p2): # a^2 + b^2 = c^2 return math.sqrt( (p2-p1)^2+(p2-p1)^2 ) def return_mouse_angle(mouse_pos,object_pos): radians = math.asin( dist(mouse_pos,object_pos)/ dist(mouse_pos,[mouse_pos,object_pos]) ) degress = math.degrees( radians ) print degrees
for example, when I run
I get this error:
Traceback (most recent call last): File "<pyshell#59>", line 1, in <module> return_mouse_slope( [100,100],[154,129]) File "C:/Documents and Settings/Owner/Desktop/rewrite project warp/lib/maths.py", line 15, in return_mouse_slope dist(mouse_pos,[mouse_pos,object_pos]) ) ValueError: math domain error
I'm not able to pass mouse_pos and object_pos to the dist function. Is python not able to pass arguments (in this case, a list) from a function to another function?