Better distance computation - #6
Merged
Merged
Conversation
…uting the current maximum euclideanDistance from the maxDist, (b) dynamically update the maxDist parameter during execution if a lower distance is found, (c) provide default arguments if only a max dist is given (then euclidean distance is assumed and the distance func and euclideanMaxDistance func parameters are set to simple functions assuming euclidean distance)
…start, dynamically update the upper distance bound (= the sweep padding) during sweep, redesign the API and add convenience methods for calculating the euclidean distance directly, also fix some minor bugs which caused unnecessarily large padding in some rare cases
…the basis for MULTI-Geometries / Collection holding XSortedGeometries, with an additional bbox index for faster operations involving a multi-XSorted geometry on one side
…ds for mercator/haversine distortion, simplify code by storing bboxes and areas directly in the XSorted geometry classes instead of optionally passing them to the various functions using them
…(with integrated box sweep)
…pairs, one test involving distance between multipoly and multipoint currently still failing
… padding function parameters
…an use XSortedGeoms
…able template parameter
This reverts commit a5a43a4.
This reverts commit 2954538.
This reverts commit 4bf1af2.
…l deferredOut queue (but with markers into the orignal list instead
…on raw geom withinDists() based on numb of expected comparisons, on the side avoid a copy in simplify() for lines
…b and boundedAdd to better handle adding and substracting padding values in Geo.tpp for small integer types like uint16, add tests for these types down to bool, split the GeoTest.cpp into more managable smaller files, also disable optimization for the test glue code to speed up test compile time
…dd self-contained build of this repo
…y types (returns empty list for points and lines)
Merged
yarox-1
pushed a commit
to yarox-1/util
that referenced
this pull request
Jul 24, 2026
…d-freiburg#6's rewrite PR ad-freiburg#5 (CRS/projection support: CRSType, getCRSType, *FromWKTProj with CRS-aware overloads, projectToCRS/CRS84/WGS84/WebMerc, lngLat<->latLng swap) predates ad-freiburg#6's large distance-computation rewrite, which touched the same WKT-parsing machinery and split the monolithic GeoTest.cpp into per-feature files. Master's (ad-freiburg#6) conventions were kept wherever the two overlapped: - CMakeLists.txt: kept ad-freiburg#6's standalone-build setup over ad-freiburg#5's temporary local scaffold. - geo/Geo.{h,tpp}: kept ad-freiburg#6's F&& forwarding-reference convention for the std::string WKT-wrapper overloads; also fixed three latent naming bugs where ad-freiburg#6's own .tpp definitions had dropped the "Proj" suffix (multiLineFromWKT/multiPolygonFromWKT/collectionFromWKT instead of ...WKTProj), leaving ad-freiburg#5's correctly-named declarations undefined. - Replaced ad-freiburg#5's `if constexpr`/`std::is_invocable_r_v`-based dispatch (used to detect whether a projFunc takes just a Point or also a CRSType) with a C++11-compatible SFINAE overload pair, since ad-freiburg#6's CMakeLists.txt targets C++11 for downstream compatibility. - Fixed a pre-existing (and now newly-exposed) declaration/definition mismatch for the std::string overload of pointFromWKTProj, latent in ad-freiburg#6 itself, now surfaced as an ambiguous-call by aligning it to the same F&& convention used everywhere else. - tests/GeoTest.cpp: restored ad-freiburg#6's minimal split-runner file; moved ad-freiburg#5's new coverage (IRI/CRS-type detection, CRS conversions, and CRS-aware WKT parsing for every geometry type) into a new tests/GeoTestCRS.cpp, following ad-freiburg#6's one-file-per-feature split. Full standalone build and test suite verified passing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
XSortedCollection, which is a collection of arbitraryXSortedgeometries.XSortedCollectionforMULTIgeometries to avoid naiven * mchecks between predicates on multigeomswithinDist()methods in two flavors:withinDist(geoma, geomb, maxDist)(euclidean distance), andwithinDist(geoma, geomb, maxDist, paddingFunc, maxEculideanDist, distFunc), wherepaddingFuncis used to compute a euclidean search padding based on current bounds. This function is present for each combination of geometry (xsorted and normal)dist()methods, basically aliases forwithinDist()with maxDist set to inf, also comes in the two flavors described abovemeterDist()methods, based on the methods above, with automatic padding and using thehaversineformula for compute the meter distancesqrt()callXSortedGeometrycomparisonGeoTest.cppinto several smaller compilation units and drop the-O3optimization for the tests (use-O0) to speed up compilationwithinDist()function which previously used an internal ring buffer to trace the OUT events for the padded side during the sweep with a variant proposed by @joka921 which does not use any additional data structure but index pointers into the original sweep event listsMissing: hierarchical sorted geometries, will be a separate PR