Sign in to follow this  
DirectXXX

Moving Circle with respect to a point

Recommended Posts

I have a circle and a point. The point may exist inside or outside circle. All i want is to move the circle "upwards" so that the point lies in the lower half at radius/circumferece. Of course this is only possible if point is inside vertical boundings of circle. I dont want to implement an iterative method like simply moving circle upwards until point lies on its circum.

Share this post


Link to post
Share on other sites
Easy way: fix a point in the lower part of the circle, then find the vector between that point and your other point, then translate along the vector.

How to fix a point? why not just pick one halfway down the lowest radius.

Share this post


Link to post
Share on other sites
You didnt understand my requirements. Let me show an image.



See part A:
dots legend.
Blue: Center of circle.
Red: the point inside circle.
Yellow: vertical projection of red dot on circle boundry.

I want to know the distance between red and yellow dots. So I can multiply it with UNIT_Y unit vector to move circle upward. And red dots will be at boundry, 2 red dot examples are shown in image.

Share this post


Link to post
Share on other sites
Im not sure if you can do it non-numerically unless you define the translation to be restricted to an x or y direction. Maybe im just not that good at linear algebra but here is what I have:
Vector r = vector from circle center to final position on edge
Vector u = vector of translation
Vector w = original vector from center of circle to previous position

We can see if we draw a diagram that
r = w + u
lets call magintudes of u, Ux and Uy, in i and j directions
so
u = Uxi + Uyj (unit vector)
M = magnitude of translation, Mu
w = Wxi + Wyj
r = w + Mu = (Wx+MUx)i+(Wy+MUy)j
we know that the magnitude of r is the radius of the circle, which i assume is known as "R" so
|r| = R = sqrt((Wx+MUx)^2 + (Wy+MUy)^2)
square each side, and multiply our the RHS

R^2 = Wx^2 +2WxMUx + (MUx)^2 + Wy^2 +2WyMUy + (MUy)^2

Now we know R, Wx, Wy, Ux, and Uy. Just solve for M.

Share this post


Link to post
Share on other sites
IGNORE THE PREVIOUS POST. For some reason it wont let me edit. Here is the corrected bersion.

Vector r = vector from circle center to final position on edge
Vector u = unit vector of translation
Scalar M = MAgnitude of translation along u
Vector w = original vector from center of circle to previous position

We can see if we draw a diagram that
r = w + Mu
lets call magintudes of u, Ux and Uy, in i and j directions
so
u = Uxi + Uyj (unit vector)
M = magnitude of translation, Mu
w = Wxi + Wyj
r = w + Mu = (Wx+MUx)i+(Wy+MUy)j
we know that the magnitude of r is the radius of the circle, which i assume is known as "R" so
|r| = R = sqrt((Wx+MUx)^2 + (Wy+MUy)^2)
square each side, and multiply our the RHS

R^2 = Wx^2 +2WxMUx + (MUx)^2 + Wy^2 +2WyMUy + (MUy)^2

Now we know R, Wx, Wy, Ux, and Uy. Just solve for M.

Share this post


Link to post
Share on other sites
Thanx for the help, I knew Ux always will be = 0 and and Uy will be = 1.
and -(Wx^2+Wy^2) will be = |W|^2.

So it simplfies to
R^2 - W^2 = + 2WyM + M^2
let t = (R^2 - W^2)
let p = 2Wy

So finally
M^2 + pM - t = 0

Solving for M.... It worked. Thanx again, I was trying to solve this problem using trignometry.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this