Without giving you any C++ code, if you know the X and Y cords of the circles center and the radius of each, this is simple.
You can find the distance between the two circles centers with this formula.
Distance = Sqr(Abs(Cir1X – Cir2X) ^ 2 + Abs(Cir1Y – Cir2Y) ^ 2)
Where Sqr returns the square root of a number and Abs returns the absolute value of a number.
Now that you have the distance from the centers, if the sum of the two radiuses are greater then or equal to the distance then the circles are touching or overlapping.
Enter your message below
Sign in or Join us (it's free).