[Flashcoders] pythagoras question

2008-08-27 Thread allandt bik-elliott (thefieldcomic.com)
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)

Re: [Flashcoders] pythagoras question

2008-08-27 Thread Hans Wichman
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

RE: [Flashcoders] pythagoras question

2008-08-27 Thread Steve Abaffy
. -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 bu

RE: [Flashcoders] pythagoras question

2008-08-27 Thread Merrill, Jason
2008 1: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 len

Re: [Flashcoders] pythagoras question

2008-08-30 Thread Arka Roy
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

Re: [Flashcoders] pythagoras question

2008-08-30 Thread Weyert de Boer
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

Re: [Flashcoders] pythagoras question

2008-08-30 Thread Arka Roy
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

RE: [Flashcoders] pythagoras question

2008-08-30 Thread Merrill, Jason
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

Re: [Flashcoders] pythagoras question

2008-08-31 Thread Weyert de Boer
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

Re: [Flashcoders] pythagoras question

2008-08-31 Thread Ivan Dembicki
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

Re: [Flashcoders] pythagoras question

2008-08-31 Thread allandt bik-elliott
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

Re: [Flashcoders] pythagoras question

2008-08-31 Thread dr.ache
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);