Learn creative coding writing simple programs

60. Are two circles touching or intersecting?

Use the dist() function to calculate the distance between two points in the screen. Why would you want to do that? Well, you can use the distanceto know if two circles are overlapping. If the distance between the centers of the circles is less than the radius of the first circle plus the radius of the second circle, then they are touching.
The radius of a circle is the distance between the center of the circle and any point in the circle itself.

Tags: dist, distance, two, points, interescting, circles, touching, software tutorial

Code editor

You can make changes to the code below. Then

Questions and comments

Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)

To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:
``` void setup() { size(600, 600); } ```