How would you express the common line equation programmatically. for example say if you have a straight line across the screen is there a way to work out the gradient. ect..
Printable View
How would you express the common line equation programmatically. for example say if you have a straight line across the screen is there a way to work out the gradient. ect..
hi there !
i'm not a mathematician, but i can help you with programming only if you wrote the exact formula in the most explicit way.
my code will be in C++ and you can run it either under an MS DOS Consol or embed it in to a Visual C++ application.
out.
This is very (!) elementary maths.
In your equation m is the gradient equalling tan (alpha) with alpha being the angle between positive x-axis and your line.
You can easily transform this equation to the more commonly known form which is easy to code
y = m * x + n
with n = y1 - m * x1 as a constant giving the point where the line intersects the y-axis.
Norbert