D
D
Developer2016-05-20 20:01:11
Cartography
Developer, 2016-05-20 20:01:11

What is the algorithm for determining the nearest segment of the path to a point?

Given a path on the map as an ordered set of points.
There is a point that moves along this path, but with some error.
It is necessary to determine the nearest section of the path (segment, edge) to a given point.
The task at first seemed simple, but then pitfalls surfaced. I think that there is already an existing algorithm, but which one? Voronoi diagrams? Delaunay triangulation?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Developer, 2016-05-20
@samodum

Seems to have found the answer.
You need to use a BSP tree https://en.wikipedia.org/wiki/Binary_space_partitioning
stackoverflow.com/questions/3423852/algorithm-to-f...
and more options to choose from:
https://gist.github.com/ mbostock/8027637
stackoverflow.com/questions/18900642/get-point-on-...

V
Vitaly Stolyarov, 2016-05-21
@Ni55aN

Find distances to all points, adjacent segments to the closest point and a perpendicular to one of them. If one exists, the answer is the length of this perpendicular, otherwise, the distance to the nearest point

X
xmoonlight, 2016-05-20
@xmoonlight

normal to a line (or projection of a point onto a line): the line segment from a point to the intersection with a line at an angle of 90 degrees to that line.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question