Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Vector4d data type for scripting

The vector data type is corresponding to the Vec4d type in C++. The implementation of the scripting type is done in prototypeVec3d.

You can use the following functions:

var vec = Vector4(1,2,3,4)
var vec2 = Vector4(10,20,30,4)
vec.multiply(0.5) // Multiply vec with 0.5
vec.add(vec2) // Add vec2 to vec
vec.sub(vec2) // Subtract vec2 from vec
var norm = vec.norm() // Calculate the length of the vector
var sqrnorm = vec.sqrnorm() // Calculate the squared length of the vector
var sprod = vec.sprod(vec) //Compute scalar product with the vector and itself
vec.normalize() // Normalize vector
vec.zero() // Set all components of the vector to zero
print(vec) // Output vector to the console