-
June 9th, 2012, 02:34 PM
#1
Expressing y-y1=m(x-x1) programmatically
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..
-
June 9th, 2012, 05:48 PM
#2
Re: Expressing y-y1=m(x-x1) programmatically
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.
-
June 10th, 2012, 03:41 AM
#3
Re: Expressing y-y1=m(x-x1) programmatically
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|