简体   繁体   English

如何计算中间轴?

[英]How to calculate the medial axis?

Does anyone know how to calculate the medial axis for two given curves? 有谁知道如何计算两条给定曲线的中间轴?

Medial axis: http://en.wikipedia.org/wiki/Medial_axis 内侧轴: http : //en.wikipedia.org/wiki/Medial_axis

Here is the shape I need to calculate it for: 这是我需要为其计算的形状: 替代文字

I drew in the medial axis myself, the dark black line, but I need to be able to calculate it dynamically. 我自己绘制了中间轴(深黑色线),但我需要能够动态地计算它。

Here is the applet and code of what I have done so far: http://www.prism.gatech.edu/~jstrauss6/3451/sample/ 这是到目前为止我做过的applet和代码: http : //www.prism.gatech.edu/~jstrauss6/3451/sample/

The known variables are: -pt A, B, C, D -radii of red, green, and black circles -pt Q and R (just outside the picture), the black circles. 已知变量为:-pt A,B,C,D-红色,绿色和黑色圆圈的半径-pt Q和R(仅在图片外部),黑色圆圈。

Let C1 and C2 be centers of circles with radii r1 and r2 . C1C2为半径为r1r2的圆的中心。 The medial axis (minus the two center points) of the figure made of the two circles is the set of points M satisfying 由两个圆组成的图形的中间轴(减去两个中心点)是满足以下条件的点集M

|M - C1| - r1 = |M - C2| - r2

which implies 这意味着

|M - C1| - |M - C2| = r1 - r2
|M - C1|^2 + |M - C2|^2 - (r1 - r2)^2 = 2 * |M - C1||M - C2|
(|M - C1|^2 + |M - C2|^2 - (r1 - r2)^2)^2 = 4 * |M - C1|^2 |M - C2|^2  (**)

so the medial axis is a fourth degree algebraic curve. 因此,中间轴是四次代数曲线。

Let us say that C1 and C2 are on the y axis, and suppose that the point (0,0) lies on the medial axis (so C1 = (0, -r1 - x) and C2 = (0, r2 + x) for some x you can compute from your data). 让我们说C1C2在y轴上,并假设点(0,0)在中间轴上(因此C1 = (0, -r1 - x)C2 = (0, r2 + x)对于某些x您可以根据自己的数据进行计算)。 This is something you can always transform into. 这是您始终可以转换成的东西。

Now, you want the curve y = f(x) which parametrizes the median axis. 现在,您希望曲线y = f(x)参数化中间轴。 For this, pick the x of your choice, and solve equation (**) in y with Newton's method, with initial guess y = 0 . 为此,选择您选择的x ,然后使用牛顿法在y = 0y求解方程(**) This is a polynomial you can compute exactly, as well as its derivative (in y ). 这是一个可以精确计算的多项式及其导数(以y )。

The medial axis is in this case a hyberbola. 在这种情况下,中轴是双曲线。

For more information see this article , particularly the following excerpt: 有关更多信息,请参见本文 ,尤其是以下摘录:

The center of any circles externally tangent to two given circles lies on a hyperbola, whose foci are the centers of the given circles and where the vertex distance 2a equals the difference in radii of the two circles. 与两个给定圆外部相切的任何圆的中心都位于双曲线上,其焦点是给定圆的中心,并且顶点距离2a等于两个圆的半径之差。

So the problem reduces to drawing a hyperbola, given its foci and vertex distance. 因此,考虑到焦点和顶点距离,问题可以简化为绘制双曲线。

If you embed the circles on a rectangular grid (think image), then you can use the distance transform of this image to compute your medial axis. 如果将圆嵌入矩形网格(如图像)中,则可以使用此图像的距离变换来计算中间轴。 See this link . 看到这个链接 Several O(nlogn) algorithms exist for computing the distance map on an image grid. 存在几种O(nlogn)算法,用于计算图像网格上的距离​​图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM