def get_normal(a,b,v):
    global points
    predict=v.velocity.get()
    predict.setMag(50)
    predict.add(v.location)
    predict.sub(a)
    alongpath=Pvector(b.x-a.x,b.y-a.y)
    alongpath.norm()
    mag=predict.dot(alongpath)
    alongpath.mult(mag)
    alongpath.add(a)
    if  points.points[-1].x>points.points[0].x:
        if alongpath.x>b.x or alongpath.x<a.x:
            alongpath=b.get()
    else:
        if alongpath.x<b.x or alongpath.x>a.x:
            alongpath=b.get()
    return alongpath
 def seperate(self,others):
     sum=Pvector(0,0)
     count=0
     for v in others:
         loc=self.location.get()
         loc.sub(v.location)
         d=loc.magnitude()
         if d>0 and d<50:
             loc.mult(1/d)
             sum.add(loc)
             count=count+1
     if count!=0:    
         sum.mult(1/count)
         sum.norm()
         sum.mult(self.maxspeed)
         sum.sub(self.velocity)
         sum.limit(self.maxforce)
     return sum