Please Help! Drawing a diagonal in C
Author |
Message |
UWO
|
Posted: Thu Sep 29, 2005 8:08 pm Post subject: Please Help! Drawing a diagonal in C |
|
|
Hi all,
Please Please help me! I need to plot two diagonals in a rectangle or square. The dimensions of the rectangle is given by the user. I am totally at a loss how to do it. My Prof. told me to use a slope to plot a line but i am at total loss how do i do it.
I am confused with the equation of y=mx+b; i dunno how to draw a line with this equation. I would appreciate if you guys please help me out with this. Please hep.
Regards. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Fri Sep 30, 2005 7:38 am Post subject: (No subject) |
|
|
I don't know what library you're using to draw, but then again I don't think this is a syntax issue.
Should have paid attention in your algebra class.
y = mx + b
y is your Y coordinate position
x is your X coordinate position
m is the slope of the line
b is the Y coordinate at x value of 0.
slope m is defined as change in Y between two points divided by change in X over the same two points.
so if you want to draw a line from (a,b) to (c,d) you know that your slope is (d-b)/(c-a). Then for each value of X from a to c, calculate the value of coresponding Y and draw your point. |
|
|
|
|
|
UWO
|
Posted: Sat Oct 01, 2005 1:43 pm Post subject: Thanks! |
|
|
Hi Tony,
Thanks a bunch for your help. It was definately a great help and i really appreciate it. I am sorry for posting it in the wrong forum, i'll be careful next time. BTW, you sounded like my mom, should have paid attention in your algebra class .
Thanks again and take care.
Bye. |
|
|
|
|
|
|
|