fix: avoid the error of dividing by zero

This commit is contained in:
m-RNA 2024-12-01 00:38:39 +08:00
parent 9fe5ccaee4
commit 7eb3513e5d

View File

@ -368,18 +368,26 @@ class EyeProcessor:
else: else:
self.ts = 10 self.ts = 10
xl = float( temp = self.xmax - self.xoff
(cx - self.xoff) / (self.xmax - self.xoff) if (temp != 0.0):
) xl = float(
xr = float( (cx - self.xoff) / temp
(cx - self.xoff) / (self.xmin - self.xoff) )
) temp = self.xmin - self.xoff
yu = float( if (temp != 0.0):
(cy - self.yoff) / (self.ymin - self.yoff) xr = float(
) (cx - self.xoff) / temp
yd = float( )
(cy - self.yoff) / (self.ymax - self.yoff) temp = self.ymin - self.yoff
) if (temp != 0.0):
yu = float(
(cy - self.yoff) / temp
)
temp = self.ymax - self.yoff
if (temp != 0.0):
yd = float(
(cy - self.yoff) / temp
)
out_x = 0 out_x = 0
out_y = 0 out_y = 0