Simple trigonometry / geometry question. Diagram included

In summary, the conversation discusses a bug in a javascript application that causes letters to rotate individually instead of as a whole word. The solution proposed involves manually calculating the translating movements of each letter using the cosine law and Pythagorean theorem. The necessary variables for this calculation are the angle a, the angles b, and the 2 sides K. Two possible methods for solving this problem are also suggested.
  • #1
rekshaw
15
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
  • #2
Quick reply: find the cartesian location of every letter, switch to polar, rotate them the desire angle, switch back to cartesian
 
  • #3
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...
 
  • #4
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)
 
  • #5
As far as I can tell, you don't need the angle b.

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

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.
 
  • #6
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.
 

1. What is the purpose of trigonometry and geometry?

Trigonometry and geometry are branches of mathematics that deal with the measurement and relationships of angles, shapes, and distances. They are used to solve real-world problems related to land surveying, construction, navigation, and more.

2. What is the difference between trigonometry and geometry?

Trigonometry primarily deals with the study of triangles, while geometry is a broader field that includes the study of all shapes and their properties. However, both subjects are closely related and often used together to solve problems.

3. How are trigonometric functions used in real life?

Trigonometric functions, such as sine, cosine, and tangent, are used in many real-life applications, such as calculating heights and distances, determining the angles of elevation and depression, and designing structures like bridges and buildings.

4. What is a right triangle?

A right triangle is a triangle with one angle measuring 90 degrees. It is also known as a 90-degree triangle. The side opposite the right angle is called the hypotenuse, and the other two sides are known as the legs.

5. How do I find the missing sides or angles of a right triangle using trigonometry?

To find the missing sides or angles of a right triangle, you can use the trigonometric ratios sine, cosine, and tangent. These ratios are calculated by dividing the length of one side by another side of the triangle. Then, you can use inverse trigonometric functions to find the missing angles.

Similar threads

  • Special and General Relativity
Replies
6
Views
1K
Replies
7
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Replies
2
Views
17K
  • Calculus and Beyond Homework Help
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
265
  • Special and General Relativity
Replies
13
Views
2K
  • Introductory Physics Homework Help
Replies
5
Views
8K
Replies
2
Views
3K
  • Math Guides, Tutorials and Articles
Replies
8
Views
20K
Back
Top