Shape touching shape

Shameless self-promotion: here is a tutorial on collision detection in Processing:

In general, you can google something like “ellipse line segment collision detection” for a ton of results. Don’t be afraid to do some research.