mirror of
https://github.com/sinseman44/PyCNC.git
synced 2026-07-21 09:26:56 +00:00
fix division by zero in some cases
This commit is contained in:
+5
-2
@@ -132,8 +132,11 @@ class GMachine(object):
|
|||||||
eb = db
|
eb = db
|
||||||
eq = 5 # mark as non-existing to check all
|
eq = 5 # mark as non-existing to check all
|
||||||
else:
|
else:
|
||||||
b = (db - rb) / (da - ra)
|
if da - ra == 0:
|
||||||
ea = math.copysign(math.sqrt(r * r / (1.0 + abs(b))), da - ra)
|
ea = 0
|
||||||
|
else:
|
||||||
|
b = (db - rb) / (da - ra)
|
||||||
|
ea = math.copysign(math.sqrt(r * r / (1.0 + abs(b))), da - ra)
|
||||||
eb = math.copysign(math.sqrt(r * r - ea * ea), db - rb)
|
eb = math.copysign(math.sqrt(r * r - ea * ea), db - rb)
|
||||||
eq = self.__quarter(ea, eb)
|
eq = self.__quarter(ea, eb)
|
||||||
ea += ra
|
ea += ra
|
||||||
|
|||||||
Reference in New Issue
Block a user