Again i came back with a question.
1.I have a line drawing from a point (x2,y2) for which i do no the end point(Say point unknown as in the fig),but i knew the line length and the angle from the vector (x2,y2). Can any one help me how to cal开发者_StackOverflow中文版culate the unknown points.
Thanks, Lokesh.
This looks like a job for ... Trigonometry-man.
Consider the following diagram:
/|
/B|
/ |
/ |
/ |
c / | a
/ |
/ |
/ _|
/A |C|
*----------+
b
You know the angle B
, it's 45o. You also know C
is 90o because that's the "right angle" bit of the right angle triangle.
And, because the angles inside a triangle add up to 180o, angle A
must also be 45o.
You also know the length of the hypotenuse c
. With trigonometry(a), you can get the lengths of the other two sides with:
a = c sin A
b = c cos B
Then simply add those to your starting point (making sure you get the signs right) and you have your ending point.
For example, let's say your hypotenuse was 1.414213562
, a number I just just picked at random off the top of my head :-)
The length a
is c sin A
or 1.414213562 * sin 45
, which is 1.414213562 * 0.707106781
or 1
.
Wow, what were the chances of that? :-)
(a) My children reminded me of the "soh cah toa" (pronounced so car toe ah) rule, where "opposite" and "adjacent" sides are location from the angle X
:
soh : sin X = opposite / hypotenuse
cah : cos X = adjacent / hypotenuse
toa : tan X = opposite / adjacent
/|
/ |
/ |
/ |
/ |
hyp / | opp
/ |
/ |
/ _|
/X | |
*----------+
adj
精彩评论