4.9.5 Vector functions

length

length( vec ) // = length of of the vector argument = square root of x^2 + y^2 + z^2

Example
length( vec( 4, 3, 0 ) ) // returns 5
lenght( vec( 0, 0, 20 ) ) // returns 20


angle

angle( vec1, vec2 ) // = angle between vector1 and vector2 in degrees

Example
angle( vec( 10, 0, 0 ), vec( 0, 0, 10) ) // returns 90

// this can also be written like this:
acos( ( vector1 * vector2 ) / ( length( vector1 ) * length( vector2 ) ) )


cross product

cross( vec1, vec2 ) // = cross product of vector1 and vector2

Example
cross( vec( 10, 0, 0 ), vec( 0, 0, 10 ) ) // returns 0, 100, 0


spat product

spat( vec1, vec2, x ) // = spat product of two vectors

Example
spat( vec( 10, 0, 0 ), vec( 0, 0, 10 ), 2 ) // returns

// this can also be written like this:
cross( vector1, vector2 ) * x


distance

distance( vec1, vec2 ) // = distance between vector1 position and vector2 position

Example
distance( vec( 1, 2, 3 ), vec( 1, 5, 3 ) ) // returns 3


dot product

vec1 * vec2 // = dot product of two vectors (see arithmetic operators)


vector definition

vec( X, Y, Z ) // = a vector with components X, Y and Z


RGBtoHSV and HSVtoRGB

RGBtoHSV( vec ) // = outputs a HSV vector if you use an RGB vector as an argument

HSVtoRGB( vec ) // = outputs a RGB vector if you use an HSV vector as an argument


XZYtoXYZ etc.

XZYtoXYZ( Rotation ) // = converts rotation vectors between different object rotation orders

YXZtoXYZ( Rotation )

YZXtoXYZ( Rotation )

ZXYtoXYZ( Rotation )

ZYXtoXYZ( Rotation )

ZXYtoYXZ( Rotation )

YZXtoZXY( Rotation )

get demo project ZXYtoXYZ.prj

 

 

Xpressionist 3.5