Cuby's implementation of vector algebra and basic 3D geometry in Vector class.
Access to the object can be locked using Locking module, all methods are locked
This is pure ruby implementation, in contrast to math_vector which uses binary library. It is intended as a replacement where the performance is not crucial, but portability is.
self.from_array(array) # new instance of the class
Creates new vector from array
v1 = Vector.from_array([1.0, 0.0, 0.0]) v2 = Vector.from_array(some_array)
self.of_size(size,fill=0.0) # new instance of the class
Creates new vector of given size filled with number fill
Vector.of_size(5,1.0) => Vector: [1.0,1.0,1.0,1.0,1.0]
self.zero(size) # new instance of the class
Creates new vector of given size filled with zeroes
Vector.of_size(5) => Vector: [0.0,0.0,0.0,0.0,0.0]
comutative_multiply(operand)
this method is equivalent to * operator, but is used by the numerical types extension found in algebra.rb
=~ (vector) # true | false
Loose comparison of two vectors, element by element. Max. allowed error is stored in class variable, accessible by methods self.epsilon and self.epsilon= .