» 3d Vector Mathematics
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

3d Vector Mathematics

Italian

Definition

a vector is an element of vector space. a vector contains the same number of elements than the vector space has dimensions.

vvvv's vector space is (a numerical approximation to) R3, a 3-dimensional euclidean space of real numbers. so a vvvvector is a set of three numbers (x, y, z) of 3d vvvvector space of vvvv numbers.

Representation

a vector v can be interpreted as:

direction (x, y, z) and length |v|, arrow, a translation, connection between two points (see Subtrcation), as point (if the vector is a bounded vector to the origin), force, speed, velocity ....

as symbol:
letters, often bold or underlined v, v

as three numbers (x, y, z):
the vvvvector space is build up by combination of three orthogonal 1-dimensional directions, the x-, y- and z-axis. every direction that is not parallel to the axes could be described as a linear combination of three directions (vectors) that are parallel to the axes. a linear combination here is adding three vectors (see Addition). to include the second aspect of a vector (the length) the three (axis) vectors n1, n2, n3 are set to length one, this is a orthonormal base. to build all other vectors with this base, the three base vectors length gets scaled with the numbers x, y, z and then the vectors are added together:

v = x*n1 + y*n2 + z*n3 =

because the n vectors are (1, 0, 0), (0, 1, 0) and (0, 0, 1) the result is:

v = ( 1*x, 0*x, 0*x ) + ( 0*y, 1*y, 0*y ) + ( 0*z, 0*z, 1*z ) =

= ( x, 0, 0 ) + ( 0, y, 0 ) + ( 0, 0, z ) = (x, y, z)

Operations

Absolute value |v| (length)


mathematical

one real number defined by:

|v| = |(x, y, z)| = sqrt( x² + y² + z² )

vvvv node

use Normalize (3d). outputs at first output pin a vector with same direction but length one, the input length on the second output pin. multiplication of them with * (Value) is the original vector.

Multiplication with scalar s


mathematical

multiply a vector with a scalar is multiply every vector element with the scalar.

v*s = ( x*s, y*s, z*s ) ( = s*v )

vvvvnode

* (Value)

geometrical

scaling the length, the direction is invariant but gets negative if the scalar is negative.

imortant result:
|v*s| = |v|*|s|

Addition


mathematical

vector addition is adding the elements of same dimension.

v + w = ( x, y, z ) + ( a, b, c ) =

= ( x + a, y + b, z + c ) ( = w + v )

vvvv node

+ (Value)

geometrical

take vector v and place the start of vector w at the tip of v. now the vector from the start of v to the tip of w is the result of adding v and w (or w and v).

Subtraction


mathematical

by analogy to the addition the subtraction is the subtraction of the elements of same dimension. but here v - w is NOT w - v but -(w - v).

v - w = ( x, y, z ) - ( a, b, c ) =

= ( x - a, y - b, z - c ) = - ( w - v )

vvvv node

- (Value)

geometrical

place the start of v and w at the same point. now the vector from the tip of w to the tip of v is the result of subtracting w from v. subtracting v from w (w - v ) ist the same, but the resulting vector starts at the tip of v and ends at the tip of w.

Dot product


aka inner product or scalar product

mathematical

one real number defined (in every space) by the multiplication of elements at same dimension an adding the results. OR (in euclidean space) multiplication of the absolute values and the cosine of the angle phi between the vectors.

v * w = ( x, y, z ) * ( a, b, c ) =

= x*a + y*b + z*c ( = w * v )

or:

v * w = ( x, y, z ) * ( a, b, c ) =

= |v| * |w| * cos(phi)

vvvv node

 * (3d Dot)

geometrical

start v and w at a common start point, then the length of v is multiplied with the length of the projection (shadow) of w onto v (or vice versa). geometrically not really interesting, but with the two formulas the angle between two vectors can be calculated. if the result is zero the vectors are orthogonal (angle 90°).

Angle phi between two vectors


mathematical

the two formulas of the dot product are used to get the cosine of phi.

x*a + y*b + z*c = |v| * |w| * cos(phi)

cos(phi) = ( x*a + y*b + z*c ) / ( |v| * |w| )

vvvv nodes

use * (Value) and + (Value Spectral) to get the dot product. use two Normalize (3d Vector) nodes to get the absolute values (lengths) from the vectors and multiply them with another * (Value). now divide the dot product by the multiplication of the lengths using the / (Value) node, this is the cosine of phi. the term arccos(A) in Expr (Value) node gives phi in radian (from 0 to Pi).

Cross product


mathematical

the multiplication of: the legth of v and w, the sine of the angle phi between v and w and a unit vector n (length = one) that is orthogonal (perpendicular) to v AND w.

v x w = ( x, y, z ) x ( a, b, c ) =

= |v| * |w| * sin(phi) * n

there is simpler formula in the euclidean space:

v x w = ( x, y, z ) x ( a, b, c ) =

= ( y*c - z*b, z*a - x*c, x*b - y*a )

vvvv node

  • (3d Cross)

geometrical

a vector that is orthogonal to v an w. the value of the length is the area size of a parallelogram with v and w as sides.

by tf

anonymous user login

Shoutbox

~4d ago

tonfilm: how about debugging your #dx11 #GPU frames? debug-dx11-frames-with-nvidia-nsight

~6d ago

mrboni: Anyone know where I can get an Etherdream ILDA unit in the UK / West Europe delivery this week?https://ether-dream.com/

~7d ago

tobyk: @catweasel Re:KiNet yes, its pretty similar to artnet but with some different magic numbers. I can send you what I've used before.

~8d ago

microdee: @Hadasi: "read the field manual" I knew a slightly more explicit version of that abbreviation :D

~9d ago

Hadasi: Seemingly, many of the best approaches are right there in vvvv (click node, press F1)

~9d ago

maarja: anyone in Mexico City up for a beer?

~10d ago

andresc4: @motzi nice! , @catweasel at the moment Im using spot to ndi, but its quite cpu consuming