Simple trigonometry / geometry question. Diagram included

AI Thread Summary
The discussion revolves around solving a trigonometric problem related to rotating text in a JavaScript application using vectors. The user seeks to calculate the translation movements (x and y) of each letter due to a bug in the Raphael library that causes letters to rotate around their individual centers. Key mathematical insights include using the cosine law and Pythagorean theorem to determine the lengths of the blue and orange segments in the diagram provided. The blue length is derived from K multiplied by the sine of angle a, while the orange length is calculated as K minus K multiplied by the cosine of angle a. The conversation emphasizes the importance of understanding the geometric relationships in the problem to achieve the desired translation for each letter.
rekshaw
Messages
15
Reaction score
0
Hey all,

BACKGROUND: (please note that knowledge of this is not necessary):
I'm currently writing a javascript application using vectors (with jquery and raphaeljs) that enables me to rotate custom text (using font.js file, not normal fonts). However, due to a bug in the new version of raphael, when I rotate a text made up of multiple letters, all the letters rotate on their own relative center.

Don't worry, I'm not asking you to help me debug my scripting language, I'm asking you to help me get around this bug by manually calculating the translating movements (x and y) of each letter.

If I wasn't clear until now, don't worry, I'll show you exactly what I need (quick photoshop):

MATHEMATICAL PROBLEM:

[PLAIN]http://img534.imageshack.us/img534/1780/rotationtranslation.png

Variables I know:

- the angle a
- the angles b
- the 2 sides K

I need to find the blue and orange (y and x) lengths in order to translate my letters properly.
 
Last edited by a moderator:
Mathematics news on Phys.org
Quick reply: find the cartesian location of every letter, switch to polar, rotate them the desire angle, switch back to cartesian
 
gsal said:
Quick reply: find the cartesian location of every letter, switch to polar, rotate them the desire angle, switch back to cartesian
gsal's answer is probably what you really want but, to literally answer your question, what you're looking for is the cosine law...
 
Length of side opposite to angle a, = 2Ksin(a/2) ; for small a it will approximate to K.a (a in radian ) Let, say this side "Black"
Since,"Orange" line is perpendicular to "Blue". Orange, Blue and Black line form Pythagorean triangle. So the problem is reduced to finding the Pythagorean triplet. Length of Black line, l(Black) is already known, now we need to find, l(Orange) and l(Blue).

Length of Black line, l(Black) = 2Ksin(a/2). Now if l(Black) is not an integer, then divide l(Black) by a rational number "k", such that l(Black)/k is an integer. Let call this number "B".

If B is odd then, other two numbers of Pythagorean triplet are P1 = B2/2 - 1/2 and P2 = P1+1

If B is even then, other two numbers of Pythagorean triplet are P1 = B2/4 - 1 and P2 = P1+2

Now, l(orange), l(Blue) = kP1 , kP2 ( if kP1 > kP2 then l(Blue) = kP1 and l(orange)= kP2 otherwise l(Blue) = kP2 and l(orange)= kP1)
 
As far as I can tell, you don't need the angle b.

The blue side is K \ \sin \left(a\right). The orange part is K \ \left(1-\cos\left(a\right)\right).

You'll see that in your diagram, if you switch the blue line over you can make a right triangle with K as the hypotenuse. This means that sin(a) * k = the blue line.

You'll also notice that the other leg of the right triangle with hypotenuse K is cos(a) * k. Subtracting this from your length K gives you the length of your orange section.
 
Consider this:
You have an isosceles triangle
You know the measures of it's angles
You know the lengths of it's legs
You know the length of it's base

What you DON'T know is the angle that the triangle makes with either the vertical or horizontal translation lines.

In other words, you could rotate the triangle, keeping the same physical qualities as the original one, which would change the lengths of those translation lines.
Therefore, each line independently has the potential for having a length ranging from zero to the same length as the base of the triangle.
 
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...
Back
Top