diff --git a/src/analyzer/epoint.py b/src/analyzer/epoint.py --- a/src/analyzer/epoint.py +++ b/src/analyzer/epoint.py @@ -24,12 +24,20 @@ class EPoint: if point.item(0)==0: return None return EPoint(point.item(1)/point.item(0),point.item(2)/point.item(0)) + @staticmethod + def fromPolar(point,center): + (alpha,length)=point + x=math.cos(alpha) + y=math.sin(alpha) + return length*EPoint(x,y)+center + def toProjective(self): return (1,self._x,self._y) def toPolar(self,center): v=self-center alpha=math.atan2(v.y,v.x) + if alpha<0: alpha+=2*math.pi k=self.dist(center) return (alpha,k)