It sounds to me like your trying to find the x,y coordinates along a line.
If this is the case then:

M = (starty-endy)/(startx-endx)
and
B = -startx + starty

Then
Y = m*x + b where x is the current x location of the train and y will be the
y-coordinate of the train.

I hope this helps.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of allandt
bik-elliott (thefieldcomic.com)
Sent: Wednesday, August 27, 2008 12:00 PM
To: Flash Coders List
Subject: [Flashcoders] pythagoras question

hi guys

I'm doing something wrong in my pythagoras theorum but i'm not seeing what
it is right now

i'm trying to find out the coordinates for a point on a line. I know the
start x, end x, start y, end y, c length for the line and i know how far
along c the point should be (call it vector length) but i'm a little stumped
as to where to go from there

the psuedo code for what i've been trying is

vector x = start x / end x
vector y = start y / end y
train x = (vector x * vector length) + start x
train y = (vector x * vector length) + start y

I think i have my maths very wrong here - hope you guys can help

a
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to