To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 06-26-2007, 08:46 PM   #1
TOdorus
Funkalicious
 
TOdorus's Avatar
 
Join Date: Nov 2006
Location: Nijmegen, Netherlands
Posts: 599
intersection points of line on a circle

Hi all,

I have a bit of an algebraic problem, and my lack of attention during math is starting to show. I was experimenting with hit detection based on lines for a simple shooting game, and the enemies bieng circulair.

I already have a function to check the distance from the line to the circles centre, so I already know that there is a intersection (or hit). I also would like to know where it intersects, for graphics and some extra physics.

So here's what I got:

Known:
r
m
b

so these can be considered constant

Equitions so far

y = mx+b
r^2 = y^2 + x^2

this gives:
r^2 = (mx+b)^2 + x^2

And then my troubles begin, because writing that out would give:
r^2 + b^2 = x^2 + mx^2 + 2mbx

Googling around tells me that this is the way to go, and you should get a quadratic function, but I don't know how to solve this kind of equation. Can anybody help out? I hope to finish a prototype soon.

Tnx in advance,

TO
__________________
Blog: Vipe Games updated 3 dec 2009

Last edited by TOdorus; 06-26-2007 at 08:49 PM.
TOdorus is offline   Reply With Quote
Old 06-26-2007, 10:47 PM   #2
Exodar
Member
 
Join Date: Jun 2007
Posts: 36
Quote:
r^2 = (mx+b)^2 + x^2

And then my troubles begin, because writing that out would give:
r^2 + b^2 = x^2 + mx^2 + 2mbx
shouldn't you have the "b^2" over on the right side of the equation?
Like so,
r^2 = x^2 + mx^2 + 2mbx+ b^2

or alternatively,
r^2 - b^2 = x^2 + mx^2 + 2mbx
Exodar is offline   Reply With Quote
Old 06-27-2007, 05:42 AM   #3
TOdorus
Funkalicious
 
TOdorus's Avatar
 
Join Date: Nov 2006
Location: Nijmegen, Netherlands
Posts: 599
I noticed that too, this morning. I geuss it was kinda getting late.
I wanted it on the left side to have my known variables on one side.
__________________
Blog: Vipe Games updated 3 dec 2009
TOdorus is offline   Reply With Quote
Old 06-27-2007, 12:55 PM   #4
Exodar
Member
 
Join Date: Jun 2007
Posts: 36
and did you get that equation solved? or do you still need some help with it?
Exodar is offline   Reply With Quote
Old 06-27-2007, 01:20 PM   #5
TOdorus
Funkalicious
 
TOdorus's Avatar
 
Join Date: Nov 2006
Location: Nijmegen, Netherlands
Posts: 599
I think so, but I haven't tried it yet. It's in another forum:

http://www.physicsforums.com/showthr...53#post1365553
__________________
Blog: Vipe Games updated 3 dec 2009
TOdorus is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:58 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.