correct cross-product method?

I don’t understand how this works… the equation for a cross product is:

A x B = A B sin()

so like (this is a mistake, right?)

A B C
x |3| |0| |0|
y |1| * |3| = |3|
z |4| |2| |8|

so now I’ve got vector C, but it won’t be perpendicular to AB and multiplying C by the sine of the angle between A and B will just increase the magnitude of C.

This must look very obvious to most people here, how do you do it right? I haven’t taken calculous yet.

Honestly, I have no idea what that chunk of characters in the middle of your post is supposed to look like. Please, either edit your message and put code tags around the chunk (and reformat it!), or post a new message with the chunk inside code tags.

A code tag is [ code ] <you text goes here> [ /code ] (without spaces in the square brackets).

Anyways, a crossproduct is calculated in the same way as a 3x3 matrix determinant, with the following matrix.

            [ i   j   k  ]

A cross B = det [ Ax Ay Az ]
[ Bx By Bz ]

A and B is the two vectors you want to cross, and (i j k) is the X, Y and Z axes.

You calculate it in the following way.

A cross B = iAyBz - iAzBy + jAzBx - jAxBz + kAxBy - kAyBx

A cross B = i * (AyBz - AzBy) + j * (AzBx - AxBz) + k * (AxBy - AyBx)

So, the resulting vector (X Y Z) is:

X = (AyBz - AzBy)
Y = (AzBx - AxBz)
Z = (AxBy - AyBx)

Now, if A and B are not unit vectors, you will have a resulting vector that is not unit length, and you must divide the resulting vector with the length of A and B.

And by the way, the formula you gave, A x B = A B sin(), is not correct, it should be more like |A x B| = A B sin().

[This message has been edited by Bob (edited 04-19-2002).]

There is some code at…
www.cs.cf.ac.uk/user/G.R.Powell
-> C CODE

You have confused the cross product and its magnitude.
What you wrote is the magnitude:
|AxB| = |A| |B| sin(theta)

What Bob wrote above is the vector AxB.

Gonna correct myself…

Now, if A and B are not unit vectors, you will have a resulting vector that is not unit length, and you must divide the resulting vector with the length of A and B.

I’m a little bit wrong here. If A and B are unit vectors, the resulting vector may not be of unit length. It’s length is equal to sin(theta), where theta is the angle between the two vectors. Sorry for that one.