gears: prevent division by zero

This commit is contained in:
Florian Festi 2020-02-01 13:59:30 +01:00
parent 37bff9d358
commit 9706816fe4
1 changed files with 2 additions and 2 deletions

View File

@ -78,14 +78,14 @@ def undercut_min_teeth(pitch_angle, k=1.0):
The return value should be rounded upwards for perfect safety. E.g.
min_teeth = int(math.ceil(undercut_min_teeth(20.0))) # 18, not 17
"""
x = sin(radians(pitch_angle))
x = max(sin(radians(pitch_angle)), 0.01)
return 2*k /(x*x)
def undercut_max_k(teeth, pitch_angle=20.0):
""" computes the maximum k value for a given teeth count and pitch_angle
so that no undercut occurs.
"""
x = sin(radians(pitch_angle))
x = max(sin(radians(pitch_angle)), 0.01)
return 0.5 * teeth * x * x
def undercut_min_angle(teeth, k=1.0):