RedVector a vector of any dimension

superclass: FloatArray

for 2 and 3 dimensional vectors, consider using the subclasses RedVector2D and RedVector3D. these are optimized for speed.

instance methods:

mag

get the magnitude of the vector as a float

distance(redVec)

get the distance between two vectors as a float

dot(redVec)

dot product

normalize

get a new vector with normalized magnitude

limit(max)

get a new vector limited to max value

asPoint

return a Point (note: RedVector2D only)

cross(redVec)

cross product (note: RedVector3D only)

a= RedVector[10, 20]

b= a.normalize

a.mag

b.mag

c= a.limit(5)

c.mag

a.distance(b)

b.distance(c)

c.distance(a)

a+b

c*RedVector[100, 200].rand

RedVector2D[320, 240] //this one is hardcoded to 2 dimensions

RedVector3D[320, 240, 160] //this one is hardcoded to 3 dimensions

a= RedVector[1, 2, 3, 4, 5, 6] //6 dimensions

b= RedVector[10] //1 dimension

a+b