Jump to content

Angle Betwen 2 Vectors


MADjestic

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.

Link to comment
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).

Link to comment
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>...

Link to comment
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 :)

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