Commit 23b00b9e90bc862105d9ad59328880fda00c1d94
1 parent
cef788a8
Added overlap rect utility
Showing
2 changed files
with
9 additions
and
0 deletions
openbr/core/qtutils.cpp
| ... | ... | @@ -478,5 +478,11 @@ float euclideanLength(const QPointF &point) |
| 478 | 478 | return sqrt(pow(point.x(), 2) + pow(point.y(), 2)); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | +float overlap(const QRectF &r, const QRectF &s) { | |
| 482 | + QRectF intersection = r & s; | |
| 483 | + | |
| 484 | + return (intersection.width()*intersection.height())/(r.width()*r.height()); | |
| 485 | +} | |
| 486 | + | |
| 481 | 487 | } // namespace QtUtils |
| 482 | 488 | ... | ... |
openbr/core/qtutils.h