On 24 June 2010 21:24, Yaser Sulaiman <yaserbuntu / gmail.com> wrote: > [...] although I have to admit that > talking about generating random vectors sounds "cooler" :P Yes, and a Point + Point is not as meaningful > Because I'm not using Vectors anymore, Point + Point now performs > the equivalent 2D translation. Also, Point.distance_to now uses Math.hypot. Cool, but I believe your implementation of Point#+ is somehow bad, because it returns @y. So you probably want to return self if you accept the Point objects to be mutable, or create a new Point, which is a bit safer, but creates a new object (in both cases you could definitely get rid of this awful "return p" :) ) Also, @@origin should not be modified, and then should be a constant, and be #freeze if you want Point to be mutable. On 25 June 2010 03:05, Lars Haugseth <njus / larshaugseth.com> wrote: > * Benoit Daloze <eregontp / gmail.com> wrote: >> >> I had an intuition doing some Math.sqrt about the distance, and it >> revealed to be exact :) > > I bet you didn't do that right from the start, before seeing the > first results? At least I didn't. :-) > -- > Lars Haugseth I thought while writing it (without sqrt) that it was going wrong, and the next day I thought to sqrt. The night is a good adviser :-) B.D.