Home arrow Articles arrow Flash arrow Collision detection & bouncing part 1: intersection of line segments
Collision detection & bouncing part 1: intersection of line segments Print E-mail
Sunday, 23 April 2006
Article Index
Collision detection & bouncing part 1: intersection of line segments
Slope-Intercept form
Parametric form
Flash demo and sample code

Flash demo and sample code

 


This demo will draw random line segments and calculate the intersection, if there is one.
Download source code (fla)



Buttons:
  • Test Slope-Intercept: will draw two random lines and mark the intersection, using the slope-intercept form
  • Test Parametric: will draw two random lines and mark the intersection, using the parametric form
  • Speed Test Slope-Intercept: will generate 5000 times two random lines and calculate their intersection, using the slope intercept form. After the loop, the duration is displayed in de field next to the button.
  • Speed Test Parametric: will generate 5000 times two random lines and calculate their intersection, using the parametric form. After the loop, the duration is displayed in de field next to the button. This is between 10 and 20% faster than the Slope-intercept form.

 



Comments
Great work on collision detection! I was searching the net for a solution to collision detection with lines and this is the best site so far! The only difficulty i have is understanding the math, particularly Cramer's rule. Other than that, everything else is quite simply explained. Keep it with the good work! :D
  Posted by israel, on Saturday, 10 March 2007 at 4:20

Thank you. it has been much more useful than anything else I found googling around.
M

  Posted by Marco, on Wednesday, 23 May 2007 at 4:54


 1 
Page 1 of 1 ( 2 comments )
©2005 MosCom

Add your comments to this article Collision detection & bouncing part... ...

Name (required)

E-Mail (required)
Your email will not be displayed on the site - only to our administrator
Homepage

Comment