•      Sign In
• Create Account

# How to center a rotated line between two angles

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

7 replies to this topic

### #1JoeJ  Members   -  Reputation: 194

Like
-1Likes
Like

Posted 18 March 2013 - 04:46 PM

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

Sponsor:

### #2Álvaro  Crossbones+   -  Reputation: 9885

Like
1Likes
Like

Posted 18 March 2013 - 08:15 PM

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?

### #3JoeJ  Members   -  Reputation: 194

Like
0Likes
Like

Posted 19 March 2013 - 02:01 AM

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.

### #4Tom KQT  Members   -  Reputation: 1289

Like
0Likes
Like

Posted 20 March 2013 - 09:11 AM

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 ;)

### #5Álvaro  Crossbones+   -  Reputation: 9885

Like
0Likes
Like

Posted 20 March 2013 - 09:55 AM

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?

### #6Tom KQT  Members   -  Reputation: 1289

Like
0Likes
Like

Posted 20 March 2013 - 12:32 PM

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, 20 March 2013 - 12:33 PM.

### #7Tom KQT  Members   -  Reputation: 1289

Like
0Likes
Like

Posted 25 March 2013 - 03:37 AM

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

### #8Tom KQT  Members   -  Reputation: 1289

Like
2Likes
Like

Posted 03 April 2013 - 06:49 AM

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.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS