[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] 2D Vector Class
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] 2D Vector Class
- From: "Ulf Ekström" <uekstrom@xxxxxxxxx>
- Date: Wed, 16 May 2007 21:51:17 +0200
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Wed, 16 May 2007 15:51:27 -0400
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Tw/m7M7l57xFsY/5taFzsagxLVgf2yKYUkYPp81gMWVvvVyS8NR+h+pIghQSCiDjQVAMIbtJ733AEpByaU/tCuyYIVxjrQXS942FOjmrckWFs1OUyZUGNTvY//WwJuzrQFmrNI1rlFZVTU7rJu1ZCi9umBbbC1yKwblttS+9dAI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=tF+WDDJqQqL9ZTzeEAMDm357z+jG0ogk/Rvf4BdNAA8cMTsWUIYUZw3gnd2LcqCYI1W27lJN4U6ghM5wAZbrWjFiMukn8yraLA4UFTTVQR+9KHAT8QH8QT2wut7voZZJOLpEncF7y//OE+qxv/biS5/rkEilTfCw04iChrqSWrI=
- In-reply-to: <004001c797ef$ffbc7ff0$0201a8c0@naomi>
- References: <004001c797ef$ffbc7ff0$0201a8c0@naomi>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi
So, I've been working on a simple physics system, and have gotten to the
point where passing around a tuple just isn't cutting it. Can anybody
suggest a good 2D vector implementation?
Unfortunately not, but if you are interested in collaborating on a
little C/Python library for these kind of things please send me an
email.
So far I"ve found this one on the wiki (anybody know who wrote this?):
http://www.pygame.org/wiki/2DVectorClass
This looks a bit slow, but on the other hand it has support for
operations I didn't even know I wanted to do on 2-vectors. It also
looks like it doesn't support vector scaling, which is a bit of a
bummer; one reason for me to have 2-vectors is so that I can write
r += dt*v, where dt is a float and r and v are vectors.
I don't mean to bash the author of that code, but a fast vector
implementation which is designed for "physics" would be nice to have.
The complex number trick was very clever!
Regards,
Ulf