diff --git a/src/analyzer/epoint.py b/src/analyzer/epoint.py --- a/src/analyzer/epoint.py +++ b/src/analyzer/epoint.py @@ -1,6 +1,12 @@ import math +def homogenize(v): + for k in v: + if k!=0: return v/k + return v + + ## Euclidean 2D plane point: (x,y). class EPoint: def __init__(self,x,y): @@ -21,6 +27,12 @@ class EPoint: def toProjective(self): return (1,self._x,self._y) + def toPolar(self,center): + v=self-center + alpha=math.atan2(v.y,v.x) + k=self.dist(center) + return (alpha,k) + def dist(self,a): return math.sqrt((self._x-a._x)**2+(self._y-a._y)**2)