bug fix for collision detection

use the standard formula, don't re-invent the wheel.
Merge pull request #1 from JeffreyMJohnson/patch-1

bug fix for collision detection