Background: I'm writing some code in fanuc macro b for machining centers with touch probes, but I guess that's kindof irrelevent... anyways, I'm currently writing a little program to take 3 touches on a surface and output a unit normal vector.
Before I started, I did some searching for examples of vector cross products in other programming languages, and of course, I found lots of them. the thing I'm confused about is that none of the examples I found negate the y (or j) term.. this what I found in various forms across the web:
x = Ay * Bz - By * Az
y = Az * Bx - Bz * Ax
z = Ax * By - Bx * Ay
am I missing something? I thought it should look like this:
x = Ay * Bz - By * Az
y = -1 * (Az * Bx - Bz * Ax)
z = Ax * By - Bx * Ay
I mean I feel like I have to be wrong because the entire internet is rarely wrong.. but on paper it only works out when I do it my way...
thanks in advance.
Hmm, I think that the problem is the way you read the examples. Let us look at Wikipedia. I find:
You just write the second line:
s2 = -1 * (a1*b3 - a3*b1)
which is exactly the same thing...