且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java中两个形状/区域之间的距离?

更新时间:2023-02-01 23:26:42

似乎没有一种方法可以做到这一点;但是,使用 PathIterators,您应该能够沿着形状的轮廓比较点对点并手动找到距离.

There doesn't seem to be a method that does that exactly; however, using PathIterators, you should be able to compare point to point along the outline of the shapes and find the distance manually.

http://docs.oracle.com/javase/6/docs/api/java/awt/geom/PathIterator.html

这篇***文章描述了如何有效地实施这是为了避免二次明显的实现.

This Wikipedia article describes how you could efficiently implement this to avoid the quadratic obvious implementation.