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: [mg26089] RE: [mg26060] Problem with finding angles between points in Cartesian plane
  • From: "Higinio Ramos Calle" <higra at gugu.usal.es>
  • Date: Tue, 28 Nov 2000 01:55:34 -0500 (EST)
  • References: <200011220655.BAA19930@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

----- Original Message -----
From: Blitzer <drek1976 at yahoo.com>
To: mathgroup at smc.vnet.net
Subject: [mg26089] [mg26060] Problem with finding angles between points in Cartesian
plane


> 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
>
Here you have a possible solution, that you can modify as you want
(I have included the graph whit the two points)
angle[{x1_, y1_}, {x2_, y2_}] := (ang =
      If[x1 != x2, ArcTan[(y2 - y1)/(x2 - x1)], Infinity];
    ListPlot[{{x1, y1}, {x2, y2}}, AspectRatio -> Automatic,
      PlotStyle -> RGBColor[1, 0, 0]];
    Print[ang, " =  ",    N[ang], " radians", "   ", N[ang]/ Degree,
      " degrees"])

H. Ramos



  • Prev by Date: How to plot field lines of conformal mapping
  • Next by Date: Re: Re: frontend problem: common characters automatically translated
  • 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