Open dassaf4 opened 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
PolyfaceQuery::SearchClosestApproach
in PolyfaceVisitorSearch.cpp (with substantial support code in polygon3d.cpp).PolyfaceQuery::SearchClosestApproachToLinestring
in PolyfaceVisitorSearch.cpp.PolylineOps::AddCloseApproaches
in DPoint3dOpsRangeHeap.cppCurveCurve::CloseApproach
.Max Distance:
PolyfaceQuery.collectSilhouetteEdges
and PolyfaceQuery.collectBoundaryEdges
(added in https://github.com/iTwin/itwinjs-core/pull/6168). The returned curves are chains of xy-linestrings. Reduce to one linestring by constructing the largest outer negative xy-area loop from these chains with RegionOps.constructAllXYRegionLoops
. The idea is to reduce mesh cases to xy-linestring-linestring.LineString3dRangeContext.searchForClosestPoint
can return several close approaches within a given max distance. These projection segments can be examined for interior intersection with linestringA, and thrown out if so obstructed, so that vertexA contributes an unobstructed closest approach.Min distance with range tree speedup: https://github.com/iTwin/itwinjs-core/pull/6181
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: