给定一矩形内的一个点,确定的一侧的最接近点矩形、最接近

由网友(荒岛晴空)分享简介:我很好奇,如果有一种优雅的方式从刚才计算从点到各边的距离,并找到最低做到这一点,放在一边。I was curious if there was an elegant way to do this, aside from just calculating the distance from the point to e...

我很好奇,如果有一种优雅的方式从刚才计算从点到各边的距离,并找到最低做到这一点,放在一边。

I was curious if there was an elegant way to do this, aside from just calculating the distance from the point to each side and finding the minimum.

有些事情我已经考虑过: 如果它是一个正方形,我们就可以画出对角线,并找出了4个区域中的点落在。每个区域对应于一个接近的侧

Some things I've thought about: If it's a square, we can just draw the diagonals and figure out which of the 4 regions the point falls on. Each of these region corresponds to a closest side.

也许我们可以将矩形划分成正方形,并​​从那里去的地方?

Perhaps we can divide up the rectangle into squares and go somewhere from there?

这似乎是一个替代的解决方案太复杂,不值得期待的。

It seems an alternative solution would be too complicated and not worth looking for.

推荐答案

有关矩形,您可以使用以下区域:

For rectangle you can use following regions:

阅读全文

相关推荐

最新文章