diff --git a/exp/geometry.py b/exp/geometry.py --- a/exp/geometry.py +++ b/exp/geometry.py @@ -13,7 +13,8 @@ class Line: @staticmethod def fromNormal(a,b,c): """ax + by + c = 0""" - norm=-c/abs(c)*math.sqrt(a**2+b**2) + sign=-c/abs(c) if c!=0 else 1 + norm=sign*math.sqrt(a**2+b**2) (a_,b_,c_)=(a/norm,b/norm,c/norm) alpha=math.acos(a_) if b_>=0 else 2*math.pi-math.acos(a_) return Line(alpha,-c_)