iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
606 stars 210 forks source link

Compute min/max distance between two GeometryQuery objects #5833

Open dassaf4 opened 1 year ago

dassaf4 commented 1 year ago

This is a Civil iTwin user request for reporting min/max distance between points/linestrings/polyfaces.

See this video re: user request for max distance, as reported on Yammer: https://web.yammer.com/main/org/bentley.com/threads/eyJfdHlwZSI6IlRocmVhZCIsImlkIjoiMjM1MzY3OTA1NjI0MDY0MCJ9

Existing logic:

dassaf4 commented 1 year ago

Idea for initial framework: stroke both input GeometryQuery objects to LineString3d/IndexedPolyface so that the problem reduces to computing discretized min/max distance between meshes, linestrings, or one of each.

Later refinements can include exact computations to avoid stroking (where possible), and speedups to avoid the O(n^2) complexity.

Min Distance (port existing code from imodel-native): https://github.com/iTwin/itwinjs-core/pull/6181

Max Distance:

dassaf4 commented 10 months ago

Min distance with range tree speedup: https://github.com/iTwin/itwinjs-core/pull/6181