|
@@ -288,3 +288,19 @@ StrengthLine* StrengthLine::getRandomLine (QImage * img)
|
|
|
}
|
|
|
return new StrengthLine( new QPoint(x1rand, y1rand), new QPoint(x2rand, y2rand) );
|
|
|
}
|
|
|
+
|
|
|
+StrengthLine* StrengthLine::getRandomLine (int width, int height)
|
|
|
+{
|
|
|
+ srand (time(NULL));
|
|
|
+
|
|
|
+ int x1rand = rand() % width;
|
|
|
+ int x2rand = rand() % width;
|
|
|
+ int y1rand = rand() % height;
|
|
|
+ int y2rand = rand() % height;
|
|
|
+ while ( x1rand == x2rand && y1rand==y2rand )
|
|
|
+ {
|
|
|
+ x2rand = rand() % width;
|
|
|
+ y2rand = rand() % height;
|
|
|
+ }
|
|
|
+ return new StrengthLine( new QPoint(x1rand, y1rand), new QPoint(x2rand, y2rand) );
|
|
|
+}
|