-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QgsAbstrcatGeometry and childs: Add fuzzyEqual and fuzzyDistanceEqual. Replaces operator== with fuzzyEqual and uses epsilon=1E-8 #55648
QgsAbstrcatGeometry and childs: Add fuzzyEqual and fuzzyDistanceEqual. Replaces operator== with fuzzyEqual and uses epsilon=1E-8 #55648
Conversation
6966b16
to
ecb8af3
Compare
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
…. Replaces operator== with fuzzyEqual and uses epsilon=1E-8 The comparisons among QGIS were conducted on coordinates using a fixed epsilon: specifically, 1e-8 for QgsPoint and the default value for qgsDoubleNear: 4 * DBL_EPSILON. Initially, I've standardized its use to 1e-8 universally; it's already significantly adequate for our Cartesian cases (1e-3 should suffice for many), potentially fitting just right for geographical contexts. Furthermore, in response to precision concerns, we're using the fuzzyEqual and fuzzyDistanceEqual methods. These methods enable users/developers to compare geometries more easily and with a given precision. The API remains intact as operator==/equals() have been shifted into fuzzyEqual (with an epsilon of 1e-8). To consolidate the code between fuzzyEqual and fuzzyDistanceEqual, helper functions, fuzzyHelpers, have been introduced following the logic of the respective segments to be executed.
…ollection, QgsPolygon, QgsMultiPoint, QgsMultiPolygon, QgsCompoundCurve
…ert not geom1 == geom2
ecb8af3
to
4e9b635
Compare
…s a 'distance comparison'
Description
The comparisons among QGIS were conducted on coordinates using a fixed epsilon:
specifically, 1e-8 for QgsPoint and the default value for qgsDoubleNear: 4 *
DBL_EPSILON.
Initially, I've standardized its use to 1e-8 universally; it's already
significantly adequate for our Cartesian cases (1e-3 should suffice for many),
potentially fitting just right for geographical contexts.
Furthermore, in response to precision concerns, we're using the fuzzyEqual
and fuzzyDistanceEqual methods. These methods enable users/developers to
compare geometries more easily and with a given precision.
The API remains intact as operator==/equals() have been shifted into fuzzyEqual
(with an epsilon of 1e-8).
To consolidate the code between fuzzyEqual and fuzzyDistanceEqual, helper
functions, fuzzyHelpers, have been introduced following the logic of the
respective segments to be executed.
Side note: epsilon could be a variable, but will not be proposed in this PR.
Followup: #55625