Vector classes

Erik Max Francis max at alcyone.com
Sun Apr 22 16:53:04 EDT 2007


Mizipzor wrote:

> During my coding Ive found two vector classes on the internet. Ive
> modified them both a little but the do both have advantages and
> disadvantages.
> 
> vector1: http://rafb.net/p/4FVdh699.html
> vector2: http://rafb.net/p/0KShGu30.html
> 
> With 1, I can typ vec.x and vec.y, very nice. With 2, I need to do
> vec.vals[0] and vec.vals[1], which makes my eyes bleed.
> 
> But with 2, I can create a vector by supplying a list of numbers as
> arguments. And I can also do maths with numbers (ints/floats) and not
> just vectors (something 1 forces me to do).
> 
> Is there any way to combine the two? The ultimate would be if I
> somehow could take vector2 and hook the member self.vals[0] to self.x
> or something.

There are also full-featured Vector and Matrix classes in the la.py 
module of ZOE:

	http://www.alcyone.com/software/zoe/

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
   Stretch a bow to the very full, / And you will wish you had stopped
    in time. -- Laotse, ca. 6th C. BC



More information about the Python-list mailing list