Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Adding together 3D angles

  1. Oct 3, 2007 #1
    Hi all,

    I'm trying to 'add' two angles in 3D spherical coords. The problem is easy enough in 2D polar coords. You just add Angle A to Angle B (both in the Z plane of course). However, there doesn't seem to be an easy 3D equivalent.

    Let's use this example:

    Point A is:
    Rot x: 0 (degrees)
    Rot z: 90
    Radius: 1

    Point B is:
    Rot x: 90
    Rot z: 0
    Radius: 1

    In cartesian format, these points A & B translate to 0,1,0 and 0,0,1 respectively.

    How do I 'add' these angles together? Any solutions I've found seem to arrive at answer that is still at Point A or Point B, rather than a different position.
     
    Last edited: Oct 3, 2007
  2. jcsd
  3. Oct 25, 2010 #2

    Okay - not much fun! Provided the Cartesian dimensions are perpendicular ("independent"), meaning for example you look first right x deg. and then, say, up y deg., and the z deg to the lower left back to your original position, the question is how to determine z from x and y only (no distances, no radii, no Cartesian methods, so no matrix/vector calculations)

    Here is the equation (jotted on my envelope, so check for yourself and make sure it works)

    Z = 2 * arcsin ( (sqrt[2]/2) * sqrt[ (sin^2(X/2) + sin^2(Y/2) ] )

    Yep... ugly! Don't try this without a calculator...

    Think of it this way - you at the top of a pyramid whose base is a rectangle and whose four inclined corner lines are all equal. From the top you can list the corner lines as a, b, c, d and all four are equal length. The angle between a and b ( written <ab) and between c and d are equal ( <ab = <cd ), let's call this angle X. Similarly, let's call angle Y = <bc = <da = <ad . Right? All these angles are going to be symmetric in two senses... The obey reflexiive (<ab = <ba ) and they are associative under addition (move up x and then to the right y is the same as to the right y and then up x).

    Okay, from the top of the pyramid, what we want then is the angle Z which is none other than the diagonal angles (again identical) <ac = <bd = <ca = <db

    Now, we don't know the length of the four sides a, b, c, d - but for convenience suppose they are 1. Notice then that the base of each angle will be 2 * sin ( angle/2). And so we can solve the diagonal base between the cross lines, <ac (or equivalently <bd, <ca, <db). Call that diagonal length H. Use Pythagorian to solve for H based on sin of the known angles.

    Now our angle Z has a relationship with H which is

    H = 2 * sin(Z/2)

    Thus Z = 2 * arcsin (H/2)

    Yep. Seems to be right. Remember that the two angles added have to be perpendicular in 3d space (or any higher dimensional space for that matter).
     
  4. Oct 26, 2010 #3

    Filip Larsen

    User Avatar
    Gold Member

  5. Oct 26, 2010 #4
    Yes - that is the right way to do complex angle arithmetic. And the right way to program it. But it won't get you away from having to take to evaluate some ugly arcsins and stuff at the end.

    Thanx for pointing this out and a rather good wikilinks article. Haven't seen some of that stuff in quite a few years.

    Cheers!
     
  6. Oct 26, 2010 #5

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    That is one of many ways to deal with rotations in three space. There are a whole lot of charts on SO(3).
     
  7. Oct 26, 2010 #6
    Indeed, many ways to skin a cat :-)
     
  8. Oct 26, 2010 #7

    chiro

    User Avatar
    Science Advisor

    Just be aware of 'gimbal lock' if you are using composition of rotations. To avoid this you can use quaternions and if you want to use multiple rotations look into SLERPing and SQUADing.

    I forget who introduced quaternions into the subject of computer graphics, but i'm sure you will be able to find a thorough article for free on the net for these topics.

    Good luck!
     
  9. Oct 26, 2010 #8

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    There is no gimbal lock with quaternions. This is one of the big advantages of using quaternions.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Adding together 3D angles
  1. 3d angles problem (Replies: 2)

  2. Angles in 3d (Replies: 2)

Loading...