TheSwamp
Code Red => VB(A) => Topic started by: Patch61 on April 13, 2011, 01:06:56 PM
-
I am writing a small tool that will return the linear distance between two points on a given slope. The slope will be given in rise:distance such as 4" in 12". I need to return the distance 'X' (as the crow flies) that is a given distance down (or up) the slope.
I slept through geometry at school, so can anybody help me figure out the formula?
Thanks!
Steve
-
And you're doing some sort of program using VBA?
Just checking because you didn't post any WIP code.
-
an easy way is to use the 'rule of three'
for example:
side of triangle
a = 24
b = 8
c = 24 2 + 8 2
c = 576 + 64 root
c = 25.298
then
25.298 = 24
12.0 = X
X = 12.0 x 24.0 / 25.298 = 11.384
-
x= 12 * Cos (atan (8/24))
~= 11.3842
-
All that stuff that the other kids kept saying "I'll never find a use for that" keeps coming up.
A right-angle triangle will have the same proportions if you scale it around one vertex. Even though the sides are different lengths, the angles will be the same and the sides scale down (or up) to the same relative size. Once you have one of the new lengths then the rest is just Pythagorean or trig.
Triangles are beautiful things in math. :love:
-
Matt,
I didn't post code because I don't need help with code. I just need a formula. Can't post a 'FIP' (formula in progress) if I don't know where to start. :wink:
Le and dgorsman,
I don't get why you are talking about triangles. I don't think I am trying to solve a triangle. I show a triangle to give clarity to my problem. The measurement that shows as 1' could be any number, unrelated to the the other numbers. :|
Kerry,
Once again you have come through for me! :laugh:
Thanks to all for trying to help!
-
Le and dgorsman,
I don't get why you are talking about triangles. I don't think I am trying to solve a triangle. I show a triangle to give clarity to my problem. The measurement that shows as 1' could be any number, unrelated to the the other numbers. :|
:-o
You are solving a triangle, and want to calculate one of the sides.
-
I don't get why you are talking about triangles. I don't think I am trying to solve a triangle.
Kerry,
Once again you have come through for me!
Note that Kerry's solution directly uses right-angled triangle trigonometric identities, hopefully this small diagram clarifies things for you:
(http://www.theswamp.org/screens/leemac/RATrig.png)
-
or:
(http://www.theswamp.org/screens/Crank/Math.JPG)
-
Thanks for the clarification, guys!
I guess maybe high school was a bit important!