I think this is what you need. --------------- angle = Math.atan2( endY - startY, endX - startX ); trainX = vectorLength * Math.cos( angle ); trainY = vectorLength * Math.sin( angle ); ---------------
Notes: 1. I'm using atan2(), not atan(). 2. The function atan2() takes (endY - startY) as its first parameter, and (endX - startX) as its second. It's easy to make the mistake of assigning them the other way round. Hope this helps. A On Thu, Aug 28, 2008 at 2:00 AM, allandt bik-elliott (thefieldcomic.com) < [EMAIL PROTECTED]> wrote: > 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 > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

