QPoint test
(0,
5);
// on the boundary qDebug() << poly.containsPoint(test, Qt::OddEvenFill); // true
qDebug() << poly.containsPoint(test, Qt::WindingFill); // true
test
= QPoint(0,
10);
// corner of polyqDebug() << poly.containsPoint(test, Qt::OddEvenFill); // false
qDebug() << poly.containsPoint(test, Qt::WindingFill); // false
test
= QPoint(5,
5);
// mathematically on the diagonalqDebug() << poly.containsPoint(test, Qt::OddEvenFill); // false
qDebug() << poly.containsPoint(test, Qt::WindingFill); // false
QPolygon poly;
poly << QPoint(0, 0) << QPoint(0, 10) << QPoint(10, 10) << QPoint(0, 0);
QPoint test(0, 5); // on the boundary
qDebug() << poly.containsPoint(test, Qt::OddEvenFill); // true
qDebug() << poly.containsPoint(test, Qt::WindingFill); // true
test = QPoint(0, 10); // corner of poly
qDebug() << poly.containsPoint(test, Qt::OddEvenFill); // false
qDebug() << poly.containsPoint(test, Qt::WindingFill); // false
test = QPoint(5, 5); // mathematically on the diagonal
qDebug() << poly.containsPoint(test, Qt::OddEvenFill); // false
qDebug() << poly.containsPoint(test, Qt::WindingFill); // false
To copy to clipboard, switch view to plain text mode
There are edge cases where fixed precision or integer mathematics is involved.
Bookmarks