栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

How can I draw a bezier curve using Python's PIL?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

How can I draw a bezier curve using Python's PIL?

A bezier curve isn’t that hard to draw yourself. Given three points

A
,
B
,
C
you require three linear interpolations in order to draw the curve. We use
the scalar
t
as the parameter for the linear interpolation:

P0 = A * t + (1 - t) * BP1 = B * t + (1 - t) * C

This interpolates between two edges we’ve created, edge AB and edge BC. The
only thing we now have to do to calculate the point we have to draw is
interpolate between P0 and P1 using the same t like so:

Pfinal = P0 * t + (1 - t) * P1

There are a couple of things that need to be done before we actually draw the
curve. First off we have will walk some

dt
(delta t) and we need to be aware
that
0 <= t <= 1
. As you might be able to imagine, this will not give us a
smooth curve, instead it yields only a discrete set of positions at which to
plot. The easiest way to solve this is to simply draw a line between the
current point and the previous point.



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/637190.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号