"2D Vector" Module

BlitzMax Forums/BlitzMax Programming/"2D Vector" Module

Ok, to be honest I wasn't sure where to put this, so I think this is the least wrong category, so anyway - here we go:

Hi there folks!
As you might guess I'm a newbie here, but don't get too hasty, as I am not a noob in Blitzmax :). Truth be told I've been poking around it for over a year, and at some point I got myself into making few modules, and now I want to present it to you - 2D Vector module.

Basically this little fella gives you the ability to work with 2D vectors quickly and easily. Specially designed Vector objects have most of the functions you will need (if not every). A little list:
-Every vector can be increased, decreased, multiplied and divided both by vector and independent numbers.
-Calculate Length and Angle
-Calculate the smaller angle between two vectors - one function retaining the sign, one being Absolute value
-Create normalized vectors (vectors of length 1)
-Quick and easy creation of clones of vectors
-Calculating the dot product of two vectors
-Rotating a vector by an angle

Also worth mentioning is that, just like in those built-in modules, every function can be accessed both through reference to existing instance "vector.function()" or by using a function "vectorAdd()" which add ability to work on and return vector clone instead.

Two examples might too be useful for better understanding the module.
You can download the module from here:
http://www.fileden.com/files/2007/10/7/1489821/Mauft-Vector.zip

For other modules made by me I can suggest my site:
http://mauft.com/blitzmax

(hopefully) Enjoy!

Welcome and thanks for the modules! :-)

I've written vector objects a few times in the past, and I'm not sure they're worth the bother while we can't override the operators in BMax, to allow for example vec3=vec1+vec2.

Looks like a nicely written module anyway, and well documented!

I can assure you they are worthy, albeit they indeed happen to be a bit uncomfortable. But lately I was working on an Arkanoid/BreakOut engine with realistic bounce angles, and vectors were a true lifesaver - they are both more straightforward to use that two separate variables for position, speed, other speed, other something etc. And that most C++ developers, which helped me in coding, were using vectors.

But yeah, ability to make addition Operators, just like in C++, would be splendid. I wish they would add it sooner or later.

im using it to calculate angles between 2 points thanks