1. Distance between 2 points

Hello,
Does any1 know how to calulate the distance and angle from
point A to point B given their coordinates.
Thanks
--PatRat (Thomas Parslow)
--               ()___()
--                (o o)
--                =\O/=
--             Rat Software
-- http://www3.mistral.co.uk/billparsl/

new topic     » topic index » view message » categorize

2. Re: Distance between 2 points

On Tue, 29 Sep 1998, PatRat wrote:

> Hello,
> Does any1 know how to calulate the distance and angle from
> point A to point B given their coordinates.
> Thanks

At the risk of answering homework here :)

opposite = b[Y] - a[Y]
adjacent = b[X] - a[X]

distance = sqrt(power(opposite,2)+power(adjacent,2))

angle = arctan(opposite/adjacent)

--
Carl R White
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
Url......: http://www.bigfoot.com/~cyrek/
"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa

new topic     » goto parent     » topic index » view message » categorize

3. Re: Distance between 2 points

> PS: Do you know what radians are? I know that they are a measurment
> of angle but nothing else.

A circle can be split up in a number of ways. The three most common (found
on any scientific calculator) are Degrees, Radians, and Gradians.

Degrees split the circle into 360 seperate units and Gradians 400
(decimalised: 100grads in a right angle).

Radians are mathematically more useful though, in that a circle is split
into 2*Pi radians. Since a circle's diameter = 2*Pi*Radius, 1 Radian is
the distance equivalent to the radius round the outside of the circle.
Hence the name "radian".

Pi = arctan(1) * 4 = about 3.1416.

A radian is equal to 180/Pi (or 360/(2*Pi), see the relation?) degrees.
That's about 57.2958 degrees in real money.

A gradian = 0.9 degrees. (360/400 or 9/10)

HTH,
Carl

--
Carl R White
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
Url......: http://www.bigfoot.com/~cyrek/
"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu