Results 1 to 9 of 9

Thread: 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$\displaystyle = (Ax,Ay,Az)$ and the second b$\displaystyle =(1,0,0)$, now use:

    $\displaystyle \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...

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

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

    $\displaystyle =\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}}$

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

    $\displaystyle =\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
    19,781
    Thanks
    3030

    Re: Calculating an angle in 3D coordinates

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

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

    $\displaystyle =\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}}$

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

    $\displaystyle =\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 "$\displaystyle A_x$", "$\displaystyle A_y$", and "$\displaystyle 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,854
    Thanks
    138

    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 $\displaystyle \theta$ in a right triangle with
    the hypotenuse $\displaystyle |\vec v|$
    the opposite leg $\displaystyle k= \sqrt{A_y^2+A_z^2}$
    the adjacent leg $\displaystyle A_x$

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

    $\displaystyle |\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; Sep 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: Aug 19th 2011, 01:42 PM
  2. Calculating Coordinates
    Posted in the Differential Geometry Forum
    Replies: 1
    Last Post: Mar 14th 2010, 09:23 PM
  3. calculating coordinates for a pattern
    Posted in the Algebra Forum
    Replies: 2
    Last Post: Mar 1st 2010, 02:29 PM
  4. Help with calculating coordinates.
    Posted in the Algebra Forum
    Replies: 1
    Last Post: Oct 12th 2009, 05:16 PM
  5. Calculating Angle from Coordinates.
    Posted in the Trigonometry Forum
    Replies: 3
    Last Post: Feb 14th 2007, 02:01 PM

Search tags for this page

Search Tags


/mathhelpforum @mathhelpforum