Jump to content
MADjestic

Angle Betwen 2 Vectors

Recommended Posts

Hi there,

(I am trying this in VOPs but actualy it doesn't matter)

What I actually need is to use tangent to the surface - i.e. I need to determine the angle to pipe into my tangent. We've got a dot product that gives us cosine(angle) (if vectors are normalized) - is there any way to derive either the angle, or sine of the angle or anything that will allow me to use tangent?

there's also vangle(); expression function but it doesn't seem to work in VEX/VOPs context (I get "undefined function error")

again I can be justmissing something obvious...

Thanks in advance.

Share this post


Link to post
Share on other sites

Since the dot product of two unit-length vectors gives you the cosine of the angle between them, then the arc-cosine of said dot product will give you the angle (in radians, don't forget). The arc-cosine is the function "acos()" in VEX (and it's in the Trig VOP I think).

Is that what you're after?

P.S: If, for some reason, you need the resultant angle in degrees instead of radians, then you can use the degrees() function to convert (not sure if there's a VOP for that one).

Share this post


Link to post
Share on other sites

Thanks, Mario

This is all the inheritance of russian school - there were no arc* functions in traditional math. manuals - so I still have to fight this.

Thanks, I will keep this in mind.

Share this post


Link to post
Share on other sites
This is all the inheritance of russian school - there were no arc* functions in traditional math. manuals - so I still have to fight this.

Now that you mention it, I suddenly realize that I have no idea why it's called "arc" and not just "inverse" (well, inverse is also used, but arc is more common). Mathworld says there are two principal branches, so maybe "arc" is used to distinguish the positive branch? (but then what's the negative one called? "EvilCoz?)...

Who knows... maybe just a geometrical history quirk... <*shrug*>

Edit:

Oh wait... maybe it just refers to the arc length between the two vectors (two radii, or two sides of an equilateral triangle) -- and of course, the arc length *is* the angle (in radians), so... maybe <shrug^2>...

Share this post


Link to post
Share on other sites
Oh wait... maybe it just refers to the arc length between the two vectors (two radii, or two sides of an equilateral triangle) -- and of course, the arc length *is* the angle (in radians), so... maybe <shrug^2>...

From what I remember, this is pretty much it, yeah. When this stuff was first introduced, the mathematicians were looking at the lengths of chords and arcs for wedges of a circle. This ended up in eq'ns (for a unit circle) like:

chordLen = 2 * sin( theta/2 ) = 2 * sin( arcLen/2 )

arcLen = theta = 2 * invSin( chordLen/2 )

Ugh ... horrible memories :)

Share this post


Link to post
Share on other sites
chordLen = 2 * sin( theta/2 ) = 2 * sin( arcLen/2 )

arcLen = theta = 2 * invSin( chordLen/2 )

Ugh ... horrible memories :)

Cool! Thanks Rob!

Nothing horrible about those memories of yours.... please share at will :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×