PDA

View Full Version : Operations



Gelero
08-22-2001, 02:44 AM
hey guys!

what does it mean this B - A
B and A are both vectors[0..2]

ohhh in delphi...

is like
B[0] - A[0]
B[1] - A[1]
B[2] - A[2], or is another operation, like crossproduct ?

Mezz
08-22-2001, 04:16 AM
It means subtract vector A from vector B.

I think in your case the aim is to give the vector from A to B.

-Mezz

Coconut
08-22-2001, 06:20 AM
In standard math notions,

A * B is the dot product(the asterisk should be a dot in the middle)

A x B is the cross product.

Gelero
08-22-2001, 07:01 AM
Could you put the equations of the dot and cross products ???

Rob The Bloke
08-22-2001, 02:50 PM
dot: you'll probably use this one

A * B = A[0]*B[0] + A[1]*B[1] + A[2]*B[2]

to find:

A * B = |A|*|B|*cos(angleBetweenThem)

cross:

C[0] = A[1]*B[2] - A[2]*B[1]
C[1] = A[2]*B[0] - A[0]*B[2]
C[2] = A[0]*B[1] - A[1]*B[0]
A x B = C

This gives the vector normal to A & B. Its length is equal to the area of the polygon defined by them...