I have a rectangle. Its height (RH) is 400. Its width (RW) is 500.
I have circle. Its height (CH) is 10. Its width (CW) is 10. Its starting location (CX1, CY1) is 20, 20.
The circle has moved. Its new location (CX2, CY2) is 30, 35.
Assuming my circle continues to move in a straight line. What is the circle's location when its edge reaches the boundary?

Hopefully you can provide a reusable formula.
Perhaps some C# method with a signature like this?
point GetDest(size itemSize, point itemPos1, point itemPos2, size boundarySize)
I need to calculate what that location WILL be once it arrives - knowing that it is not there yet.
Thank you.
PS: I need this because my application is watching the accelerometer on my Windows Phone. I am calculating the target necessary to animate the motion of the circle inside the rectangle as the user is tilting their device.
It is 1 radius away from the boundar(y/ies).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With