update ruleFunction and CollisionDetectionAlgorithm

update ruleFunction and CollisionDetectionAlgorithm