I need to mathematically derive the direction of torque in a 2D plane(clockwise/anticlockwise), for a physics engine. I have torque calculated, but it is always positive, so rotation always is in the same direction. I know the right hand rule, but in a computer program, you don't exactly have thumbs.
-
1$\begingroup$ What exactly are you asking? It's not clear to me at all. $\endgroup$– David ZJan 6, 2014 at 4:32
-
$\begingroup$ @DavidZ I have the lever arm and the perpendicular force to the lever arm. How do I determine the direction of the torque? I know that by multiplying the magnitudes(in 2D), I can get the magnitude of the torque, but how do I get the direction of the torque? $\endgroup$– user1413725Jan 6, 2014 at 4:51
-
$\begingroup$ I guess what I'm not clear on is, if you know the right hand rule, why don't you use it? $\endgroup$– David ZJan 6, 2014 at 5:27
2 Answers
Torques are always in the $z$-direction in 2D. So you calculate the $z$-component of the outer product from your force, and its sign will determine whether it is in the $+z$ (i.e. anticlockwise) or $-z$ direction.
So if your force $\vec{F} = F_x \hat{x} + F_y \hat{y}$ is acting at position $\vec{r} = x \hat{x} + y \hat{y}$ the torque (with sign) is
$$(\vec{r}\wedge\vec{F}) \cdot \hat{z} = \left|\begin{array}{cc}x&y\\F_x&F_y\end{array}\right| = x\,F_y - y\,F_x$$
Another way to remember all this is that the geometric product (in the sense of geometric algebra, a particular take on Clifford algebras promoted by people like Doran and Lasenby) in 2D can be encoded into complex multiplication. Represent $\vec{F} = F_x + i\,F_y$ and $\vec{r} = x + i\,y$, then we have the following:
$${\rm Scalar\,Product} = {\rm Re}(\vec{r}^*\,\vec{F}) = {\rm Re}( (x-i\,y)(F_x + i\,F_y)) = x\,F_x + y \, F_y$$ $${\rm Cross\,Product} = {\rm Im}(\vec{r}^*\,\vec{F}) = {\rm Im}( (x-i\,y)(F_x + i\,F_y)) = x\,F_y - y \, F_x$$
and the cross product is correctly signed: positive means anticlockwise.
-
$\begingroup$ I can't quite understand what your saying. I know that +z is anticlockwise and vice versa, and I know magnitude is the two magnitudes multiplied, what would be the direction? Those equations don't make any sense. $\endgroup$ Jan 6, 2014 at 4:55
-
$\begingroup$ @Nabla No, I've formed the inner product with $\hat{z}$ to find the $z$-component: so I've chopped the basis vector $\hat{z}$ off and left the direction to be encoded in the sign of resulting the triple product, since we know the torque is along the $z$ axis. $\endgroup$ Jan 6, 2014 at 5:06
-
$\begingroup$ @user1413725 What you need to do is resolve your vectors into components, then the equations should make sense. Moreover, the sign of $x\,F_y - y\,F_x$ is your direction, since we know that the torque must be in the $z$ direction. You can check that the magnitude $|x\,F_y - y\,F_x|$ is indeed $\sqrt{x^2 +y^2}\sqrt{F_x^2 + F_y^2}\sin\theta$ where $\theta$ is the angle between the two vectors (i.e. component of lever arm times the force times the sine of the angle between them). $\endgroup$ Jan 6, 2014 at 5:11
-
$\begingroup$ @WetSavannaAnimalakaRodVance Yes, sorry, stupid me. $\endgroup$– user35332Jan 6, 2014 at 5:12
-
$\begingroup$ @Nabla No problem, I can assure you I've done stupider many times! $\endgroup$ Jan 6, 2014 at 5:12
If you want to be able to distinguish directions in your code, then you must introduce a coordinate system, with one dimension for the radius of the turn, one dimension for the Force, and one dimension for the torque. All three are orthogonal, hence the need for a third dimension for torque for a rotation in 2D space.
$\tau= r \times F$
You can use the following coordinate system to find the polarity of one term given the polarities of the other two terms.
You can visualise r and F as forming the 2D plane of rotation. If you use this coordinate system, it is equivalent to giving your code "thumbs". If either r or F is negative, tau will be negative, while if both r and F are negative, tau will be positive.