Incrementing the length of a QLineF in the negative direction?
-
The documentation seems to be spotty on this. Below is how I did it. Is this the correct way?
@
QLineF refLine(100,100, 500,500);
QLineF perpLine = refLine.normalVector(); //create a perpendicular line to the refLine
perpLine.setLength(-1); //this seems to set it in the negative direction and it stays in the negative directionfor(int i = 0; i < 50; i++)
{
perpLine.setLength(perpLine.Length + 1); // this will increment perpLine in a negative direction
}@
-
i read the docs of QLineF::setLength() pretty clear:
[quote]
Sets the length of the line to the given length. QLineF will move the end point (p2) of the line to give the line its new length
[/quote]The following code would rotate the line by 180° (around p1):
@
QLineF line(100,100, 500,500);
line.setLength( - line.length() );
@