P
Pflugs
I would like to write a function that calculates the cross product of two 3D
vectors (that is, x1,y1,z1 and x2,y2,z2) The output of a cross product is
also a vector (that is, x3,y3,z3).
The math is simple enough, but I would like to export each variable to a
separate cell. That is, I select three linear cells in a row, type
"=CROSS(A1:A3)", hit CSE, and the value appears in each cell.
Could someone please advise on how to distribute the results to each cell?
The code to calculate x3,y3, z3 is below:
x3 = y1 * z2 - z1 * y2
y3 = z1 * x2 - x1 * z2
z3 = x1 * y2 - y1 * x2
The call line should be:
Function Cross(x1, y1, z1, x2, y2, z2) as Double
The inputs should not be set to a type since the user should be allowed to
enter either ranges or numbers.
Thanks,
Pflugs
vectors (that is, x1,y1,z1 and x2,y2,z2) The output of a cross product is
also a vector (that is, x3,y3,z3).
The math is simple enough, but I would like to export each variable to a
separate cell. That is, I select three linear cells in a row, type
"=CROSS(A1:A3)", hit CSE, and the value appears in each cell.
Could someone please advise on how to distribute the results to each cell?
The code to calculate x3,y3, z3 is below:
x3 = y1 * z2 - z1 * y2
y3 = z1 * x2 - x1 * z2
z3 = x1 * y2 - y1 * x2
The call line should be:
Function Cross(x1, y1, z1, x2, y2, z2) as Double
The inputs should not be set to a type since the user should be allowed to
enter either ranges or numbers.
Thanks,
Pflugs