Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need some math - Projecting Slope

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?

enter image description here

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.

like image 836
Jerry Nixon Avatar asked Nov 26 '25 19:11

Jerry Nixon


1 Answers

It is 1 radius away from the boundar(y/ies).

like image 173
Ignacio Vazquez-Abrams Avatar answered Nov 29 '25 08:11

Ignacio Vazquez-Abrams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!