Hi

How to calculate straight line starting point x,y values(a) and ending point x,y values(b). I know the slope of the line , width of the line and center point of the line(c).

Thanks in advance.

Printable View

- Sep 1st 2009, 06:25 AMkumarStraight line points
Hi

How to calculate straight line starting point x,y values(a) and ending point x,y values(b). I know the slope of the line , width of the line and center point of the line(c).

Thanks in advance. - Sep 1st 2009, 06:53 AMaidan
If you know the slope, and a point on the line then

what are you asking?

I'm guessing here:

Are you looking for the coordinates of a point that is

equidistant left & right from the center point?

$\displaystyle X_a = X_c + HorizontalDistanceLeft $

$\displaystyle Y_a = Y_c + HorizontalDistanceLeft \cdot Slope $

$\displaystyle X_b = X_c + HorizontalDistanceRight$

$\displaystyle Y_b = Y_c + HorizontalDistanceRight \cdot Slope $

You must be aware that

the HorizontalDistanceLeft will be NEGATIVE &

the HorizontalDistanceRight will be POSITIVE. - Sep 1st 2009, 07:28 AMHallsofIvy
What do you

**mean**by "calculate straight line"? If you know**any**one point on the line, a, or b, or c, and the slope, m, then the equation of the straight line is $\displaystyle y= m(x- a_x)+ a_y= m(x- b_x)+ b_y= m(x- c_x)+c_y$. You don't need to know the other points or the other information. If you know two points, say a and b, then you can calculate the slope, $\displaystyle m= \frac{a_y- b_y}{a_x- b_x}$.

Do you mean "find the**length**of the line**segment**"? If so, any two of the facts you have will suffice.

If you know the end points, a and b, the length is $\displaystyle \sqrt{(a_x- b_x)^2+ (a_y- b_y)^2}$.

If you know and endpoint, either a or b, and the center point, c, then the length is $\displaystyle 2\sqrt{a_x- c_x)^2+ (a_y- c_y)^2}$.

If you know the "width of the line" (by which, I take it, you mean the absolute value of the difference in x values of a and b) and the slope then, taking w= "width" and m= "slope", the "height", the absolute value of the difference in y value of a and b, is given by wm and so the length of the line segment is given by $\displaystyle \sqrt{w^2+ (wm)^2}= w\sqrt{1+ m^2}$.