python - Tkinter 对曲线使用什么插值?

标签 python python-3.x tkinter interpolation

我看到这篇文章:

enter image description here (https://pythongraphicgames.wordpress.com/tag/curved-line/),我想知道 Tkinter 使用什么插值算法来创建曲线。立方体?隐士?余弦?有没有办法可以指定这一点?

最佳答案

它使用贝塞尔算法。

线和多边形对象具有用于控制平滑的smooth选项。这就是canonical documentation关于该选项的说明:

-smooth smoothMethod : smoothMethod must have one of the forms accepted by Tcl_GetBoolean or a line smoothing method. Only true and raw are supported in the core (with bezier being an alias for true), but more can be added at runtime. If a boolean false value or empty string is given, no smoothing is applied. A boolean truth value assumes true smoothing. If the smoothing method is true, this indicates that the line should be drawn as a curve, rendered as a set of quadratic splines: one spline is drawn for the first and second line segments, one for the second and third, and so on. Straight-line segments can be generated within a curve by duplicating the end-points of the desired line segment. If the smoothing method is raw, this indicates that the line should also be drawn as a curve but where the list of coordinates is such that the first coordinate pair (and every third coordinate pair thereafter) is a knot point on a cubic Bezier curve, and the other coordinates are control points on the cubic Bezier curve. Straight line segments can be generated within a curve by making control points equal to their neighbouring knot points. If the last point is a control point and not a knot point, the point is repeated (one or two times) so that it also becomes a knot point.

关于python - Tkinter 对曲线使用什么插值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62836960/

相关文章:

python - GitPython是否可以在没有 checkout 的情况下从指定的提交中获取文件

python - 使用经过训练的 ConvNet 的参数预测图像类别

python - 如何将滚动条附加到 tkinter 中的下拉列表?

python - 计算适合 Tkinter 中列表框可视区域的项目数量

文本框中的 Python Tkinter 监听器

python - 如何在 Python Pandas Dataframe 中有条件地连接 2 列

python - 霍夫变换检测较短的线

python - 使用 Single Pass 算法将数据帧中通过 for 循环生成的列表与具有字典值的列表相交的快速方法

python - 在 python 中制作真值表

python-3.x - Serverless 无法导入本地文件;同一目录下;进入Python文件