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

[H3] Compute destination point from distance and azimuth using planar 3d math #93084

Merged
merged 5 commits into from
Jan 23, 2023

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Jan 19, 2023

Similarly to what we have done in #91492 we replace the method geoAzDistanceRads from using trigonometric maths to use planar 3d math . This results in a more efficient code, for example benchmarking the method h3ToGeoBoundary shows an improvement of 25%:

Benchmark                           Mode     Cnt    Score    Error  Units
H3Benchmark.readH3Boundary      thrpt   25  968,635 ± 16,450  ops/s
H3Benchmark.readH3Boundary3d  thrpt   25  1303,186 ± 14,407  ops/s

@iverase iverase added >enhancement :Analytics/Geo Indexing, search aggregations of geo points and shapes v8.7.0 labels Jan 19, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 19, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@elasticsearchmachine
Copy link
Collaborator

Hi @iverase, I've created a changelog YAML for you.


// check for due north/south azimuth
if (az < Constants.EPSILON || Math.abs(az - M_PI) < Constants.EPSILON) {
if (az < Constants.EPSILON) {// due north
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed all this optimisations in LatLng because there seems to never be called during the tests and they actually produce bad results if p1.getLatRad() + distance > Math.PI /2 or p1.getLatRad() - distance < -Math.PI/2

Copy link
Contributor

@craigtaverner craigtaverner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good improvement. I was wondering why two new algorithms were added, when only one old one was deleted?

@iverase iverase merged commit 4224026 into elastic:main Jan 23, 2023
@iverase iverase deleted the geoAzDistanceRads branch January 23, 2023 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants