Tempest_design

04-16-2002, 12:51 PM

How can I get the distance btween two MCs?

Click to See Complete Forum and Search --> : [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] Distance Bet

Tempest_design

04-16-2002, 12:51 PM

How can I get the distance btween two MCs?

bit-101

04-16-2002, 01:02 PM

first get the distance between their _x's, then the distance between their _y's. this can be used to draw a right triangle in which the hypotenuse is the line between the two mcs. using some elementary trig/geometry, we know that the square of the hyp. is equal to the sum of the squares of the two sides, so...

dx=mc1._x-mc2._x;

dy=mc1._y-mc2._y;

dist=Math.sqrt(dx*dx+dy*dy);

dx=mc1._x-mc2._x;

dy=mc1._y-mc2._y;

dist=Math.sqrt(dx*dx+dy*dy);

Tempest_design

04-16-2002, 02:21 PM

Cool It worked Thanks!