如何模拟左手规则?

时间:2016-11-23 07:27:11

标签: c++ physics

enter image description here

我使用结构来表示这样的方向:

struct POINT{
double x;
double y;
double z; 
}

鉴于B(Bx,By,Bz)I(Ix,Iy,Iz)。如何确定F?

1 个答案:

答案 0 :(得分:6)

您的问题实际上是vector cross-product的算法是什么。

POINT F;
F.x = (B.y * I.z) - (B.z * I.y);
F.y = (B.z * I.x) - (B.x * I.z);
F.z = (B.x * I.y) - (B.y * I.x);