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): ...@@ -46,7 +46,7 @@ def get_bisector(p1, p2, p3, up_vector):
bisector_dir = bisector_dir.mul(-1) bisector_dir = bisector_dir.mul(-1)
return bisector_dir 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 """ calculate the angle between three points
Visualization: Visualization:
p3 p3
...@@ -75,6 +75,10 @@ def get_angle_pi(p1, p2, p3, up_vector): ...@@ -75,6 +75,10 @@ def get_angle_pi(p1, p2, p3, up_vector):
# The points are in anti-clockwise order. Thus the angle is greater # The points are in anti-clockwise order. Thus the angle is greater
# than 180 degree. # than 180 degree.
angle = 2 * math.pi - angle angle = 2 * math.pi - angle
if pi_factor:
# the result is in the range of 0..2
return angle / math.pi
else:
return angle return angle
......
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