 # The counterclockwise angle between 2 vectors or lines.

I need a function that gives me the angle between 2 vectors or lines.
I use the angle function from here http://www.blender.org/documentation/blender_python_api_2_57_release/mathutils.html but gives me the smallest angle. I need to know the counterclockwise angle.

Thank you!

Are you referring to 180-x?
For example,
Sin(x) = Sin(180-x)

I have a robot car witch at some point needs to steer in the direction of the target. So i only need the angle that my car needs to rotate so it will face the target. I found the smallest angle (lets say 45degrees) but i don;t know if it is to the left or to the right.

ah, well maybe you ought to post the code, so that i may see how you are achieving it.

well it’s a big code. the robot knows it’s location in the word and it’s rotation on the Z axis. It also knows the target’s location. All i need to know is if i need to steer 45 degrees or -45 degrees

ok, best post it anyway. I need to see it to work with it.

i found the answer. The formula is

x = ba.to_tuple()
y = bc.to_tuple()
angle = atan2(y,y) - atan2(x,x)