Hello
I have 2 QPoints(P,Q) from which i construct a straight line(inclined/horizontal/vertical).
In some scenarios the length of the line should be reduced.Please do suggest a method to shift the point P so that i can reduce the length of the line.
- We have P(x1,y1) Q(x2,y2)
- Currently we use the formula, y = mx + c and get the values of y(slope) and c intercept.
- Then assuming that the new point is 10 pixels horizontally from one end of the line.
- Determine the new y` which also lies on the line y=mx+c.
- We get the new P`(p.x()+10,y`).
This method does not work for all cases.
Please do let me know a good way to reduce the length of the line.
Thanks in advance.
Bookmarks