mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Advanced snapping, basics of screenshot tool
This commit is contained in:
@ -471,6 +471,18 @@ private:
|
||||
T m_q;
|
||||
};
|
||||
|
||||
/// Fuzzy compares two points, with given tolerance (so, if points are at lower distance
|
||||
/// from each other than squared tolerance, they are considered as same and function returns true).
|
||||
/// \param p1 First point
|
||||
/// \param p2 Second point
|
||||
/// \param squaredTolerance Squared tolerance
|
||||
static inline bool isFuzzyComparedPointsSame(const QPointF& p1, const QPointF& p2, PDFReal squaredTolerance)
|
||||
{
|
||||
QPointF dp = p2 - p1;
|
||||
const qreal squaredDistance = QPointF::dotProduct(dp, dp);
|
||||
return squaredDistance < squaredTolerance;
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // PDFUTILS_H
|
||||
|
Reference in New Issue
Block a user