Skip to content
Snippets Groups Projects
Commit 2b631a97 authored by Marco Biasini's avatar Marco Biasini
Browse files

better fix for previous commit

There is no short-circuit logic in Python and division by zero gets
raised when abs(rr)==0.
parent 8682b16e
Branches
Tags
No related merge requests found
......@@ -23,7 +23,9 @@ class SpacenavControl(QtCore.QObject):
if r==0.0:
return 0.0
rr=r/abs(r)*max(0.0,abs(r)-0.9)
return abs(rr)>0 and rr/abs(rr)*(math.pow(1.01,abs(rr))-1.0)*40.0/self.speed or 0.0
if abs(rr)>0:
return rr/abs(rr)*(math.pow(1.01,abs(rr))-1.0)*40.0/self.speed
return 0.0
if(self.trans):
tf.ApplyXAxisTranslation(d(tx))
tf.ApplyYAxisTranslation(d(ty))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment