Results 1 to 9 of 9

Math Help - Calculating an angle in 3D coordinates

  1. #1
    Member
    Joined
    Nov 2008
    Posts
    92

    Calculating an angle in 3D coordinates

    Hi

    A vector has x, y, and z components of Ax, Ay, and Az. I want to calculate the angle between the vector and the x-axis (call it theta).

    I work out the following:

    sqrt(Ax*Ax + Az*Az) * cos(theta) = Az
    sqrt(Ax*Ax + Az*Az) * sin(theta) = Ax

    So that theta = arctan(Ax/Az).

    But the notes I have state a different equation for theta:

    theta = arctan(Ax / sqrt(Az*Az + Ay*Ay))

    Could you please tell me where I am going wrong, and how the notes get the answer?

    Thanks.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor Also sprach Zarathustra's Avatar
    Joined
    Dec 2009
    From
    Russia
    Posts
    1,506
    Thanks
    1

    Re: Calculating an angle in 3D coordinates

    You have two vectors, one is a = (Ax,Ay,Az) and the second b =(1,0,0), now use:

    \theta = \arccos\frac{a \cdot b}  {|a||b|}
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Nov 2008
    Posts
    92

    Re: Calculating an angle in 3D coordinates

    Thanks. I didn't think about using that...but I'm still not getting it right.

    To find the angle the vector makes with the x-axis, we can consider only the x and z components (Ax and Az).

    Using the equation above: theta = arccos(Ax / sqrt(Ax*Ax + Az*Az))

    Whereas in the notes it's Ay*Ay on denominator, rather than Ax*Ax...
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor Also sprach Zarathustra's Avatar
    Joined
    Dec 2009
    From
    Russia
    Posts
    1,506
    Thanks
    1

    Re: Calculating an angle in 3D coordinates

    Quote Originally Posted by algorithm View Post
    Thanks. I didn't think about using that...but I'm still not getting it right.

    To find the angle the vector makes with the x-axis, we can consider only the x and z components (Ax and Az).

    Using the equation above: theta = arccos(Ax / sqrt(Ax*Ax + Az*Az))

    Whereas in the notes it's Ay*Ay on denominator, rather than Ax*Ax...

    \theta = \arccos\frac{a \cdot b}  {|a||b|}

    =\arccos\frac{(Ax,Ay,Az)\cdot (1,0,0)}  {|(Ax,Ay,Az)||(1,0,0)|}

    =\arccos\frac{(Ax\cdot 1+Ay\cdot 0+Az\cdot 0)}  {\sqrt{(Ax)^2+(Ay)^2+(Az)^2}\sqrt{1^2+0^2+0^2}}

    =\arccos\frac{Ax}  {\sqrt{(Ax)^2+(Ay)^2+(Az)^2}}

    =\arccos\frac{x}  {\sqrt{x^2+y^2+z^2}}
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    Nov 2008
    Posts
    92

    Re: Calculating an angle in 3D coordinates

    Thanks. The notes I have give a solution using arctan instead of arccos. The answer given is: theta = arctan(Ax / sqrt(Az*Az + Ay*Ay))

    The equation they give is on page 4: http://www.freescale.com/files/senso...ote/AN3461.pdf

    How can I get from your solution to the one in the notes?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor

    Joined
    Apr 2005
    Posts
    15,393
    Thanks
    1327

    Re: Calculating an angle in 3D coordinates

    Quote Originally Posted by Also sprach Zarathustra View Post
    \theta = \arccos\frac{a \cdot b}  {|a||b|}

    =\arccos\frac{(Ax,Ay,Az)\cdot (1,0,0)}  {|(Ax,Ay,Az)||(1,0,0)|}

    =\arccos\frac{(Ax\cdot 1+Ay\cdot 0+Az\cdot 0)}  {\sqrt{(Ax)^2+(Ay)^2+(Az)^2}\sqrt{1^2+0^2+0^2}}

    =\arccos\frac{Ax}  {\sqrt{(Ax)^2+(Ay)^2+(Az)^2}}

    =\arccos\frac{x}  {\sqrt{x^2+y^2+z^2}}
    You are assuming, are you not, that "A" is a single constant multiplying the vector <x, y, z>? I would have interpreted it merely to mean that " A_x", " A_y", and " A_z" the x, y, and z components, respectively, of the vector.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Super Member
    earboth's Avatar
    Joined
    Jan 2006
    From
    Germany
    Posts
    5,829
    Thanks
    123

    Re: Calculating an angle in 3D coordinates

    Quote Originally Posted by algorithm View Post
    Hi

    A vector has x, y, and z components of Ax, Ay, and Az. I want to calculate the angle between the vector and the x-axis (call it theta).

    I work out the following:

    sqrt(Ax*Ax + Az*Az) * cos(theta) = Az
    sqrt(Ax*Ax + Az*Az) * sin(theta) = Ax

    So that theta = arctan(Ax/Az).

    But the notes I have state a different equation for theta:

    theta = arctan(Ax / sqrt(Az*Az + Ay*Ay))

    Could you please tell me where I am going wrong, and how the notes get the answer?

    Thanks.
    1. Draw a sketch (see attachment).

    2. You'll find the angle \theta in a right triangle with
    the hypotenuse |\vec v|
    the opposite leg k= \sqrt{A_y^2+A_z^2}
    the adjacent leg A_x

    3. So to me the value of \theta is calculated by:

    |\theta|=\arctan\left(\dfrac{\sqrt{A_y^2+A_z^2}}{|  A_x|}  \right)

    which is the reciprocal value of the given solution (?)
    Attached Thumbnails Attached Thumbnails Calculating an angle in 3D coordinates-winklvektorachse.png  
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Member
    Joined
    Nov 2008
    Posts
    92

    Re: Calculating an angle in 3D coordinates

    @HallsOfIvy: Sorry, I mean that Ax is the actual x component, rather than a constant multiplying x.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Member
    Joined
    Nov 2008
    Posts
    92

    Re: Calculating an angle in 3D coordinates

    @earboth: Thanks for your diagram, it made it much clearer. I get the same result as you...

    I guess the notes are wrong. One of my answers agrees with the notes, whilst for the other two (angles phi and rho), I get the inverse of the expression inside arctan.
    Last edited by algorithm; September 6th 2011 at 12:26 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Calculating an angle of a none right angle triangle
    Posted in the Trigonometry Forum
    Replies: 14
    Last Post: August 19th 2011, 01:42 PM
  2. Calculating Coordinates
    Posted in the Differential Geometry Forum
    Replies: 1
    Last Post: March 14th 2010, 09:23 PM
  3. calculating coordinates for a pattern
    Posted in the Algebra Forum
    Replies: 2
    Last Post: March 1st 2010, 02:29 PM
  4. Help with calculating coordinates.
    Posted in the Algebra Forum
    Replies: 1
    Last Post: October 12th 2009, 05:16 PM
  5. Calculating Angle from Coordinates.
    Posted in the Trigonometry Forum
    Replies: 3
    Last Post: February 14th 2007, 02:01 PM

Search Tags


/mathhelpforum @mathhelpforum