MathGroup Archive 2000

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

Search the Archive

Re: Problem with finding angles between points in Cartesian plane

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26103] Re: [mg26060] Problem with finding angles between points in Cartesian plane
  • From: BobHanlon at aol.com
  • Date: Tue, 28 Nov 2000 01:55:47 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 11/22/00 2:43:01 AM, drek1976 at yahoo.com writes:

>I would like to find the angle between 2 points on the Cartesian plane.
>However, if I use "ArcTan", it is not able to recognise that points with
>the
>same x-coordinates have an angle of 90 degrees between them. It returns
>"Indeterminate".
>eg. for a point A (x1, y1) and a point (x1, y2), to find the angle between
>them, I use ArcTan[(y2-y1)/(x1-x1)]. However, as the denominator is equal
>to
>"0", this function returns "indeterminate". Is there a way to get around
>this problem? Or is there other possible functions which can be used.
>I am dealing with a very large array of numbers and thus, it's not possible
>to check the coordinates individually.

Use the form ArcTan[x, y]

Clear[theAngle];

theAngle[pt1_, pt2_] := ArcTan[Sequence @@ (pt2 - pt1)];

theAngle[{x, 0}, {x, 1}]

Pi/2

theAngle[{x, 0}, {x, -1}]

-(Pi/2)

Plot[theAngle[{0, 0}, {Cos[theta], Sin[theta]}], {theta, 0, 2Pi}];


Bob Hanlon


  • Prev by Date: Re: Problem with finding angles between points in Cartesian plane
  • Next by Date: "up" in 3D animations
  • Previous by thread: Re: Problem with finding angles between points in Cartesian plane
  • Next by thread: Re: Problem with finding angles between points in Cartesian plane