Followers 0

# How to center a rotated line between two angles

## 7 posts in this topic

I want to calculate the distance d that moves the beta angled blue line out of unit circle center so that both alpha angles are equal.

Seems not so easy than i initially thought - please help :)

-1

##### Share on other sites
Figure out the lines that delimit "alpha", intersect them with the blue line, take the middle point of both intersections, measure the distance to the center of the circle.

Do you think that solves your problem? Is there a step you don't know how to implement?
1

##### Share on other sites

Thx, but that would be only a part of the solution - Initially i have the line at the light blue position and alpha is unknown.

Note that if beta angle becomes larger, there should be more movement in d direction and alpha angle becomes larger too.

If i'd know alpha i could calculate d and vice virsa.

But if beta is 90 deg., any solution for d is correct, but alpha is 90 deg. So asking for alpha would have been wiser than asking for d.

I tried things like   sin(alpha) = pow(sin(beta), 2)   or   sin(alpha) = sqrt(sin(beta))

Both work for 0 and 90 degree case, but not in between.

0

##### Share on other sites

I'm near a solution, I must verify it and post it, but I won't be at the PC for few hours now so it will probably won't be sooner than in like 4 hours. And it isn't so easy, indeed ;)

0

##### Share on other sites
I spent a little bit of time trying to figure this out using the facts about geometry of a triangle that I used to know when I participated in Math competitions. It turns out it's been too long and I don't remember enough to tackle this one.

On the other hand, you have a computer. That means you can numerically solve pretty much anything without much effort. For instance, you could follow the procedure I described earlier and measure the length of the blue segment. If it's too long, increase alpha. If it's too short, decrease it.

What's the situation where you need to solve this problem?
0

##### Share on other sites

So, I ended with a quadratic equation, so there are two solutions, but one of them quite doesn't make sense, but you'll see when you try it (it gives you a negative d so large that the line would be completely out of the circle).

The quadratic equation looks like this:

d^2 * sin(beta) + d * R - R^2 * sin(beta) = 0


where d is your unknown variable, beta is the angle and R is radius of the circle. You said a unit circle so R probably will be 1, but it was better to make it universal I think ;)

The better of the two solutions is:

D = R^2 + 4 * (sin(beta))^2 * R^2

d = (-R + sqrt(D)) / (2 * sin(beta))


Because of one algebraic operation I did in the process, there arose a condition that cos(beta) cannot be zero. Which makes sense, because that's true for beta = 90°.

If you're interested in the whole calculation, let me know and I'll post it somehow.

Edited by Tom KQT
0

##### Share on other sites

So, did you try it, is it working? Are you still interested in it at all?

0

##### Share on other sites

I tested it a little bit more and it is working as expected.

May I please ask you - next time let us know on the forum when you aren't looking for the solution anymore. It's quite sad when somebody else is spending a good amount of time solving your problem for you, just to find then that you didn't probably even read the thread.

2

## 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