Commit 8377faba authored by sumpfralle's avatar sumpfralle

added an optional parameter to the angle calculation function for returning...

added an optional parameter to the angle calculation function for returning 0..2 instead of multiples of PI


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@692 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 30335dbc
......@@ -46,7 +46,7 @@ def get_bisector(p1, p2, p3, up_vector):
bisector_dir = bisector_dir.mul(-1)
return bisector_dir
def get_angle_pi(p1, p2, p3, up_vector):
def get_angle_pi(p1, p2, p3, up_vector, pi_factor=False):
""" calculate the angle between three points
Visualization:
p3
......@@ -75,7 +75,11 @@ def get_angle_pi(p1, p2, p3, up_vector):
# The points are in anti-clockwise order. Thus the angle is greater
# than 180 degree.
angle = 2 * math.pi - angle
return angle
if pi_factor:
# the result is in the range of 0..2
return angle / math.pi
else:
return angle
class TransformableContainer(object):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment