Hi,
I don't think pythagoras is involved here.
try:
factor = vectorLength/c;
coordX = startX + (endX-startX)*factor;
coordY = startY + (endY-startY)*factor;
greetz
JC
On Wed, Aug 27, 2008 at 7:00 PM, allandt bik-elliott
(thefieldcomic.com) <[EMAIL PROTECTED]> wrote:
> hi guys
>
> I'm doing som
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.
-Orig
Why not just use Point.polar()? That would do exactly what it seems you
are describing.
Jason Merrill
Bank of America
Enterprise Technology & Global Risk L&LD
Instructional Technology & Media
Join the Bank of America Flash Platform Developer Community
Are you a Bank of America associate int
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 fi
May I ask a related question? How can I detected if a user has clicked
on a line (or later a bezier path) ? I am having the starting and ending
coordinates of this line and so also the distance.
Now I am would like to check if the user has clicked within this line
with/or without a specific radi
Let's call the position of the mouse click on the stage (clickedX, clickedY)
The starting coordinates are (startX, startY)
The ending coordinates are (endX , endY)
The general equation of your line, for any variables X and Y, is:
Y == (X - startX) * (endY - startY) / (endX - startX)
So when the u
ugust 30, 2008 8:19 AM
To: Flash Coders List
Subject: Re: [Flashcoders] pythagoras question
May I ask a related question? How can I detected if a user has clicked
on a line (or later a bezier path) ? I am having the starting and ending
coordinates of this line and so also the distance.
Now I
Merrill, Jason wrote:
A simple solution could be to create a sprite to draw the line onto, and
add a listener to the sprite to see if it was clicked on.
Yes, but then you still have the problem that a two pixel line is not a
great hit area for drawn line. That's why I asked the question
to im
Hello,
> Yes, but then you still have the problem that a two pixel line is not a
> great hit area for drawn line. [...]
- also you can draw 5 pixel transparent line.
like this:
http://bezier.ru/wp-content/uploads/2008/06/bezier.swf?demo=3
--
iv
http://www.bezier.ru
http://bezier.googlecode.com
IL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Weyert
de Boer
Sent: Saturday, August 30, 2008 8:19 AM
To: Flash Coders List
Subject: Re: [Flashcoders] pythagoras question
May I ask a related question? How can I detected if a user has clicked
on a line (or later a bezier path) ? I am having the
Expand the idea of Jason and draw an invisible rectangle "under" your
specific line. Assumed your line should be 30px long and your click radius
should be 5xp
var line:Sprite = new Sprite();
var g:Graphics = line.graphics;
g.clear();
// hit radius
*g.beginFill(0xff,0);*
g.drawRect(0,-3,30,5);
11 matches
Mail list logo