Re: Problem with finding angles between points in Cartesian plane
- To: mathgroup at smc.vnet.net
- Subject: [mg26124] Re: Problem with finding angles between points in Cartesian plane
- From: leko at ix.netcom.com (J. Leko)
- Date: Tue, 28 Nov 2000 01:56:09 -0500 (EST)
- References: <8vfqv9$jif@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <8vfqv9$jif at smc.vnet.net>, "Blitzer" <drek1976 at yahoo.com> wrote: > 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. > > Would be grateful for any help rendered. Thanks! > > Derek Strictly speaking, it is not possible to define an "angle" between two "points"- a line yes, but not an angle. Now if you are assuming that there is a third point common to both (i.e., an origin), _then_ you can define an angle. To check for perpendicularity, use the definition of the dot product: A.B = |A||B|Cos[theta] where |x| represents the magnitude of x. Which leads to: theta = ArcCos[(A.B)/(|A||B|)] If the "vectors" are perpendicular, theta will equal zero. Alternately, to determine an angle you could use the definitions of either the Sine or Cosine functions. This, however, entails determining the length of the hypotenuse (a minor extra step). J. Leko Please e-mail replies to leko*j at cspar.uah.edu and remove the *