2
« on: April 11, 2010, 03:45:22 pm »
Hey, very nice library.
I understand that a 'cross product', in it's sense, is only defined in 3-dimensional space; but there is that 'hack' for getting the perpendicular vector of a 2-D vector using the cross product.
You extend the 2-D vector to 3-D and add a z-component of zero and then find the cross product of that and a unit vector parallel to the z-axis (0,0,1); if you return the result of this as a 2-D vector (the z component will be zero anyway), then you get a vector that is perpendicular to the initial 2-D vector.
I was wondering if you could implement this somehow in the 2D vector class, maybe as a new method 'perpendicular' or whatever. (your existing 'cross' method for the Vector 2D class only returns the magnitude/z-value of the cross product between the two 2d vectors)
Anyway, I really hope you continue with this, it's very helpful.