def __neg__(self): """ return -self. That is an affine vector attached to the same point, but with the opposite direction. """ nx=self.I.x-self.Dx ny=self.I.y-self.Dy return AffineVector(self.I, Point(nx,ny) )
def rotation(self,angle): s=self.segment.rotation(angle) return AffineVector(s)
def orthogonal(self): ortho_seg=self.segment.orthogonal() return AffineVector(ortho_seg)
def numerical_approx(self): I=Point( numerical_approx(self.I.x),numerical_approx(self.I.y) ) F=Point( numerical_approx(self.F.x),numerical_approx(self.F.y) ) return AffineVector(I,F)
def fix_visual_size(self,l,xunit=None,yunit=None,pspict=None): s=self.segment.fix_visual_size(l,xunit,yunit,pspict) return AffineVector(s.I,s.F)
def __mul__(self,coef): I=self.I nx=self.I.x+self.Dx*coef ny=self.I.y+self.Dy*coef F=Point(nx,ny) return AffineVector(I,F)
def extend(self,other): I=self.I F=self.F.translate(other.Dx,other.Dy) return AffineVector(I,F)
def fix_origin(self,P): """ Return the affine vector that is equal to 'self' but attached to point P. """ return AffineVector(P,Point(P.x+self.Dx,P.y+self.Dy))
def translate(self,v): return AffineVector(self.I.translate(v),self.F.translate(v))
def copy(self): return AffineVector(self.I,self.F)