Circle Intersection

Circle collision test

A method for testing collision / intersection between two circles on a 2D surface is presented below in Javascript. Code in made as simple as possible to support adaptation to other languages.

View example

function circlesIntersect(c1, c2)
{
	return (c1.r + c2.r) >= (Math.abs(Math.sqrt(
		((c1.x-c2.x) * (c1.x-c2.x)) +
		((c1.y-c2.y) * (c1.y-c2.y)))));
}

Page loaded in 0.011 second(s).