Author Topic: Need help with math formula  (Read 4210 times)

0 Members and 1 Guest are viewing this topic.

Patch61

  • Guest
Need help with math formula
« 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

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Need help with math formula
« Reply #1 on: April 13, 2011, 01:13:01 PM »
And you're doing some sort of program using VBA?

Just checking because you didn't post any WIP code.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

LE3

  • Guest
Re: Need help with math formula
« Reply #2 on: April 13, 2011, 01:26:43 PM »
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

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Need help with math formula
« Reply #3 on: April 13, 2011, 01:27:44 PM »
x= 12 * Cos (atan (8/24))
~= 11.3842
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Need help with math formula
« Reply #4 on: April 13, 2011, 01:38:42 PM »
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:
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Patch61

  • Guest
Re: Need help with math formula
« Reply #5 on: April 13, 2011, 01:56:27 PM »
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!

LE3

  • Guest
Re: Need help with math formula
« Reply #6 on: April 13, 2011, 02:14:27 PM »
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.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Need help with math formula
« Reply #7 on: April 17, 2011, 05:27:40 PM »
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:




Crank

  • Water Moccasin
  • Posts: 1503
Re: Need help with math formula
« Reply #8 on: April 17, 2011, 05:44:50 PM »
or:
Vault Professional 2023     +     AEC Collection

Patch61

  • Guest
Re: Need help with math formula
« Reply #9 on: April 20, 2011, 04:17:05 PM »
Thanks for the clarification, guys!

I guess maybe high school was a bit important!