• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Program to calc leg lengths on a slope

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

engjohn

Senior Member
Joined
Dec 18, 2000
Location
SoCal
I need a little help, what I need is a program that will calc leg lengths at a 2 foot interval for a platform that would be placed on a slope. see pic...

The program would take the platform length, the high point, and low point and then calc the leg lengths at 2 foot intervals to have a level platform...

Point me in the right direction...
 

Attachments

  • slope.jpg
    slope.jpg
    8 KB · Views: 49
Im assuming that you will also have the user input the angle of the slope, yes?
well anyway, what if you considered the top of the platform y=0, and the slope would be y= whatever the slope is, then you just need to calculate y for the slope at 2 foot intervals, until you got to the end of the platform. How do you know where the platform starts? Because you would just want to offset the slope equation enough to put the start of the platform at (0,0). It shouldn't be too hard to do this.
 
If you have two points, you can get the equation of a line. The formula is:

y-y1 = [(y2-y1)/(x2-x1)] * (x-x1)

Where (x1,y1) and (x2,y2) are two points on the line.

Then you have a linear equation. You solve it for y and you give it an x value and it will give you a y value. This will tell you the location of the point where the leg contacts the slope. Now just subtract all these points from a constant height to get the lengths of the legs.
 
You will also notice that the difference between 2 adjacent legs, assuming they are evenly spaced horizontally, will be a constant, regardless of which legs you are talking about.
 
Back