Py2D
Py2D copied to clipboard
Divide by Zero prevention
/Math/Operations.py line 285
r = float(ap * ab) / ab.length_squared
could be changed to
r = float(ap * ab) / (1 if ab.length_squared == 0 else ab.length_squared)
Then anytime ab.length_squared is of length 0, that means float(ap * ab) is 0, which means r is 0, which means the function will return ap.length_squared