We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Read this - it contains many examples written using Processing
http://www.jeffreythompson.org/collision-detection/
Table of Contents:
http://www.jeffreythompson.org/collision-detection/table_of_contents.php
(you might want to use dist() rather than calculating the distance yourself though...)
more here: http://happycoding.io/tutorials/processing/collision-detection