转换贝塞尔曲线多边形链?多边形、塞尔、曲线

2023-09-10 23:56:08 作者:雨落倾城

我想拆分Bezier曲线为多边形链与正直线。线的数目依赖于2个连接线之间的最大允许角度。 我正在寻找一种算法来找到最优解(即降低尽可能的直线数)。

I want to split a bezier curve into a polygonal chain with n straight lines. The number of lines being dependent on a maximum allowed angle between 2 connecting lines. I'm looking for an algorithm to find the most optimal solution (ie to reduce as much as possible the number of straight lines).

我知道如何使用应用Casteljau或伯恩斯坦polynomals分裂Bezier曲线。我试图除以贝塞尔成半计算直线之间的角度,并再次分裂如果连接线之间的角度是一定的阈值范围内,但我可能会碰到的快捷方式。

I know how to split a bezier curve using Casteljau or Bernstein polynomals. I tried dividing the bezier into half calculate the angle between the straight lines, and split again if the angle between the connecting lines is within a certain threshold range, but i may run into shortcuts.

是否存在已知的算法或伪code可以做到这一点的转换?

Is there a known algorithm or pseudo code available to do this conversion?

推荐答案

使用去应用Casteljau递归算法,直至控制点大约共线。例如,见http://www.antigrain.com/research/adaptive_bezier/index.html.

Use de Casteljau algorithm recursively until the control points are approximately collinear. See for instance http://www.antigrain.com/research/adaptive_bezier/index.html.