MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Azimuth in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95105] RE: [mg95071] Azimuth in Mathematica
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 6 Jan 2009 04:13:32 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Use the two argument form of ArcTan

az[ptA_, ptB_] := Pi/2 - ArcTan @@ (ptB - ptA)

ptA = {0, 0};
ptB = {1, 0};
ptC = {0, -1};

{#[[1]], #[[2]], az @@ ##} & /@
  DeleteCases[Tuples[{ptA, ptB, ptC}, 2], {x_, x_}]

{{{0, 0}, {1, 0}, Pi/2},
    {{0, 0}, {0, -1}, Pi},
    {{1, 0}, {0, 0}, -(Pi/2)},
    {{1, 0}, {0, -1}, (5*Pi)/4},
    {{0, -1}, {0, 0}, 0},
    {{0, -1}, {1, 0}, Pi/4}}



Bob Hanlon


On Mon, Jan 5, 2009 at 6:47 AM , TL wrote:

> Is there a function in Mathematica that would return the azimuth 
> between two points with known coordinates, 0 being North?
> For example having A(0,0), B(1,0) - the azimuth should be 90 degrees
> its like ArcTan[dx/dy], but I need the quadrant taken into account as 
> well and I need it to handle 90 and 270 degrees properly too
>
> /it doesn't need to convert the angles to degrees, rads is ok/


  • Prev by Date: Re: how to solve this problem?
  • Next by Date: Re: Azimuth in Mathematica
  • Previous by thread: Re: Azimuth in Mathematica
  • Next by thread: mathematica 7.0 Linux