Re: Distance between 2 points

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu