0
$\begingroup$

I have two 3D vectors, v1 and v2, that lay in the same plane in a 3D space. When calculating the cross product between them to find the normal to the plane, the right-hand rule applies for the direction of the resulting vector in the range of theta = 0...pi (considering that the angle is always counter-clockwise). However, when the angle between the two vectors is theta > pi, the direction swaps. This is a problem when I don't know the angle, and calculating the angle is not trivial. How can I prevent this, or fix the direction of the cross product for the whole range 0...2pi?

$\endgroup$
6
  • 1
    $\begingroup$ There is a direct formula for the cross product of two vectors if you know their components. Is that what you need? $\endgroup$ Dec 3, 2016 at 15:35
  • $\begingroup$ Calculating the angle is, relatively speaking, very easy. What constraint do you have that makes it hard? $\endgroup$
    – rschwieb
    Dec 3, 2016 at 16:19
  • $\begingroup$ Thanks for the response. I want to calculate the real angle, as in always counter-clockwise (as in my comment just added below). In order to do that I need the normal to the plane (as shown here link). But how can I calculate the normal to the plane by having only the two vectors given without knowing the "real"/CCW angle, such that the direction of the normal doesn't change regardless on whether the angle is smaller or larger than pi? $\endgroup$
    – user56574
    Dec 3, 2016 at 16:30
  • $\begingroup$ There’s nothing intrinsic to the two vectors that you can use. The “real” angle you want—equivalently, which way is “up” for the plane of the vectors—can only be defined relative to some external reference. Try finding a concrete definition for why you would say that the angle between two vectors is $\gt pi$. $\endgroup$
    – amd
    Dec 3, 2016 at 21:23
  • $\begingroup$ Thank you, amd. I guess there's no nice way to make this calculation more general than having that external reference. I'll think about it and see what I can do. $\endgroup$
    – user56574
    Dec 4, 2016 at 4:43

1 Answer 1

1
$\begingroup$

The right-hand rule still applies to $[-\pi,0]$ as well, if you interpret the angle between $\pi$ and $2\pi$ instead as an angle between $-\pi$ and $0$.

Maybe you should be content with the range $[-\pi,\pi]$ instead.

$\endgroup$
3
  • $\begingroup$ Thanks for the response. The problem is that I don't know the real angle or the sign of the angle. Say, I have a vector v1 = (1,0,0) and a vector v2 = (0,0,1). The angle between the two is 1/2pi and v1 x v2 = (0,-1,0). If v2 changes to v2 = (0,0,-1), the calculated angle is still 1/2pi, but the actual CCW angle is 3/2pi, and the cross product now changes the direction to v1 x v2 = (0,1,0). How can I get the same cross product for both cases? $\endgroup$
    – user56574
    Dec 3, 2016 at 16:26
  • $\begingroup$ @user56574 I don't know what to tell you. Of course, you can do whatever weird thing you want after the cross product to get what you want, but the original cross product is not going to change. Why would you want this behavior that's inconsistent with the right hand rule anyway? $\endgroup$
    – rschwieb
    Dec 3, 2016 at 23:08
  • $\begingroup$ Not a problem. Maybe I just don't fully understand, and maybe the cross product isn't even the right way to approach this. All I want is a (normal) vector to two vectors that points in the same direction regardless of the angle between the two vectors. Maybe I really need some external reference, as amd suggested above. Thank you for your help. $\endgroup$
    – user56574
    Dec 4, 2016 at 4:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .