A
A
anboo2020-06-17 22:24:58
Mathematics
anboo, 2020-06-17 22:24:58

How to avoid collision of two circles?

I have two circles with the same radius that intersect each other, I need to move one of them by some X and Y values ​​so that they intersect only at one point (so that they don’t lie on top of each other anymore).
How to calculate X and Y by which to move one of the circles?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Zagaevsky, 2020-06-18
@anboo

"Move" sounds like moving so that the centers remain on the same line. It would be
logical.
The straight line equation y = kx + b is constructed from two points. For simplicity, we move the center of one of the circles to the origin, then the equation will be y = kx.
From the distance condition we build another equation:
y^2 + x^2 = 4r^2
We solve a system of two equations, get x and y, then move the centers back.
Consider separately the case when the centers coincide and choose the trivial line y = 0, for example.

G
Grigory Boev, 2020-06-17
@ProgrammerForever

There are many options for how this can be done. One of them:
1) Convert ordinary Cartesian coordinates to polar ones . Then the center of the second relative to the center of the first will be at a distance
r=R1+R2
2) Then either choose phi arbitrarily, or go through the whole circle with some steps, calculating the distance between the center of the second circle now and the center of the second circle after moving. It is necessary to choose the minimum of the function, then the movement will be minimal.
3) Convert polar back to cartesian

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question