Tkinter对曲线使用什么插值?

2024-10-17 06:28:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我看到了这样一个帖子:

enter image description herehttps://pythongraphicgames.wordpress.com/tag/curved-line/)我想知道Tkinter使用什么插值算法来创建曲线。立方体的赫米特?余弦?我有没有办法具体说明这一点


Tags: httpscom算法tkintertaglinewordpress曲线
1条回答
网友
1楼 · 发布于 2024-10-17 06:28:23

它使用贝塞尔算法

直线和多边形对象有一个smooth选项用于控制平滑。这就是canonical documentation对该选项的看法:

-smoothsmoothMethod : 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.

相关问题 更多 >