Jump to content

Signed angle between vectors in VEX


guache

Recommended Posts

In Vex, I'm trying to find a signed angle between two vectors i.e. an angle which treats one vector as a "base" and the other as a rotating "clock hand", so that I get positive angle for a concave angle between the two (0-180 deg) and a negative angle for a convex angle between the two (180-360 deg). The dot product on normalized vectors gives me the angle, but it's symmetric. Is there a trick that gets me the sign?

Edited by guache
Link to comment
Share on other sites

If v is your base, and w the clock hand, and n is a reference vector perpendicular to both (this is necessary if you want an angle in 0-360), then the angle is given as

atan2(dot(cross(n,v), w), dot(v,w));

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...