On 23.07.2011 14:23, sam.hack...@sent.com wrote:
Well, when I type "-1**2" into Python, it returns -1. If I run "1**2 + -1**2" it returns 0. So, is there a bug in Python then? Running 2.6.6 on Ubuntu 10.10. Removing the if statement from get_angle fixed the angle problem for me, because of this.
On Sat, 23 Jul 2011 13:56 +0200, "DR0ID" <dr...@bluewin.ch> wrote:

Your mistake basically was that you assumed that -1 ** 2 == -1 which is not.


Hi again


    def  get_angle(self):
        if  (self.get_length_sqrd()  ==0):
            return  0
        return  math.degrees(math.atan2(self.y,self.x))



Well the 0 length check is ok, since a 0 length vector does not really have an angle. But I guess you see it now.

~DR0ID

Reply via email to