 # 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...

##### 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 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 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 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 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 ## Create an account

Register a new account