Skip to content
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

Merged
merged 16 commits into from
Jan 11, 2024

Conversation

lbartoletti
Copy link
Member

@lbartoletti lbartoletti commented Dec 18, 2023

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

@github-actions github-actions bot added this to the 3.36.0 milestone Dec 18, 2023
Copy link

github-actions bot commented Dec 18, 2023

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit ecb8af3)

@lbartoletti lbartoletti self-assigned this Dec 19, 2023
@lbartoletti lbartoletti force-pushed the qgsabstractgeometry_fuzzyequal branch 2 times, most recently from 6966b16 to ecb8af3 Compare December 20, 2023 11:08
@lbartoletti lbartoletti marked this pull request as ready for review December 20, 2023 11:08
@lbartoletti lbartoletti changed the title Qgsabstractgeometry fuzzyequal QgsAbstrcatGeometry and childs: Add fuzzyEqual and fuzzyDistanceEqual. Replaces operator== with fuzzyEqual and uses epsilon=1E-8 Dec 20, 2023
Copy link

github-actions bot commented Jan 4, 2024

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

  • that all unit tests are passing

  • that all comments by reviewers have been addressed

  • that there is enough information for reviewers, in particular

    • link to any issues which this pull request fixes

    • add a description of workflows which this pull request fixes

    • add screenshots if applicable

  • that you have written unit tests where possible
    In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request.
    If there is no further activity on this pull request, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Jan 4, 2024
@lbartoletti lbartoletti added API API improvement only, no visible user interface changes and removed stale Uh oh! Seems this work is abandoned, and the PR is about to close. labels Jan 4, 2024
@lbartoletti lbartoletti closed this Jan 4, 2024
@lbartoletti lbartoletti reopened this Jan 4, 2024
…. 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
@nyalldawson nyalldawson merged commit b55b411 into qgis:master Jan 11, 2024
28 of 29 checks passed
@lbartoletti lbartoletti deleted the qgsabstractgeometry_fuzzyequal branch March 13, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API API improvement only, no visible user interface changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants