# Closest point on a polygon

This topic is 4074 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm looking for a way to compute the closest point on a polygon to any point. This would be used many times, so I'm looking for some way to preprocess the polygon so that the search time can be reduced.

##### Share on other sites
You can build the Voronoi regions corresponding to the edges of the polygon. Look at the related topic of "medial axes".

##### Share on other sites
Are you assuming the point to lie on the plane of the polygon?

##### Share on other sites
Quote:
 Original post by smitty1276Are you assuming the point to lie on the plane of the polygon?

I am. The important question is whether the OP has this constraint in mind. If the problem is in 3D and the point is not necessarily on the plane of the polygon, the approach is nearly the same.

##### Share on other sites
Yeah, this is meant to be used in 2d space. It seems that constructing a voronoi may be more work that it's worth. I'm currently using an algorithem that searches outwards from the point in a box manner, which is giving better performance than brute force. I don't know if there's any alternatives.

##### Share on other sites
An alternative might be to do a series of closest-point-on-line-segment tests for each edge of the polygon and choose the closest point out of all the tests, and possibly precompute a bunch of information required for each test. But I haven't actually implemented any of these methods to know which one would be fastest.

##### Share on other sites
Quote:
 Original post by AxiverseYeah, this is meant to be used in 2d space. It seems that constructing a voronoi may be more work that it's worth. I'm currently using an algorithem that searches outwards from the point in a box manner, which is giving better performance than brute force. I don't know if there's any alternatives.

Are your polygons convex?

1. 1
Rutin
25
2. 2
3. 3
JoeJ
19
4. 4
5. 5

• 10
• 11
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
631753
• Total Posts
3002098
×