如何为多边形创建内部螺旋? [英] How can I create an internal spiral for a polygon?

查看:20
本文介绍了如何为多边形创建内部螺旋?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于任何形状,我如何在其中创建一个类似形状的螺旋.这将是一个类似于边界的想法(使用 Minkowski 和).而不是在形状内部创建相同的形状,尽管它会是相同形状的螺旋.

For any shape how can I create a spiral inside it of a similar shape. This would be a similar idea to bounding (using Minkowski sum). Rather than creating the same shape inside the shape though it would be a spiral of same shape.

我发现了这个 - http://www.cis.upenn.edu/~cis110/13su/lectures/Spiral.java

它根据传递的参数创建一个螺旋,因此它可以用于任何常规形状.

It creates a spiral based on the parameters passed so it can be for any regular shape.

我也想要所有形状,即不规则多边形.

I want the above for all shapes i.e. irregular polygons too.

我对几何术语不是很熟悉,但我也查过渐开线和内部螺旋搜索算法,但对我没有用处.

I am not hugely familiar with geometric terminology but I have looked up Involutes and an Internal Spiral Search Algorithm too but haven't been useful to me.

有没有人知道我在哪里可以找到这样的算法,或者至少知道我会如何想出一个算法?

Does anyone have any idea where I'd find an algorithm such as this or at least ideas of how I'd come up with one?

推荐答案

这个任务非常难做.

  1. 需要有你想用螺旋填充的边界多边形

我想你已经有了

通过逐步向内移动所有线条来创建新的更小的多边形.

类似于在多边形周围创建笔划线.步长是螺丝的宽度,所以在多边形的开头是 0,最后是 d

It is similar to create stroke line around polygon. Step is the screw width so at start of polygon it is 0 and on the end it is d

从新生成的螺丝中删除无效行

拐角和曲率上的一些线会相交.这很难可靠地检测/修复

Some lines on corners and curvatures will intersect. This is very hard to detect/repair reliably see

  • 了解基础知识
  • this for basics

重复(做下一个螺丝)...直到找不到螺丝空间

但现在在第一个螺丝之后,步骤总是 d 这不一定会填满整个形状.例如,如果形状上有一些较薄的点,填充的速度会比其他点快得多,因此仍然会留下一些孔.

But now after the first screw the step is always d this will not necessarily fill the whole shape. For example if you have some thinner spot on shape it will be filled much more faster then the rest so there can still be some holes left.

您应该检测它们并按照您认为合适的方式处理

You should detect them and handle as you see fit see

注意检测该区域是否被填满也不是微不足道的

Be aware detection if the area is filled is also not trivial

这就是这种方法的样子:

This is how this approach looks like:

[备注]

如果您忘记了螺旋并想用锯齿形或类似图案填充内部,那么这并不难.

If you forget about the spiral and want fill the interior with a zig zag or similar pattern then this is not that hard.

螺旋填充会产生很多困难的几何问题,如果您不精通几何和矢量数学,这项任务对于该领域的初学者甚至中级程序员来说可能是一个太大的挑战,无法使其正常工作.这至少是我的意见(就像我以前做过的那样)所以就这样处理吧.

Spiral filling makes a lot of hard geometric problems and if you are not skilled in geometry and vector math this task could be a too big challenge for beginner or even medium skilled programmer in this field to make it work properly. That is at least my opinion (as I done this before) so handle it as such.

这篇关于如何为多边形创建内部螺旋?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆