几何

Line drawing Algorithm

设置

自定义 Polypad 功能和 UI,或使用高级图块属性和创作工具。

Loading…

Drawing Lines with Pixels by Csunplugged.org
24681012142468101214
How does a computer know which pixels to darken to make a line?
Computers draw images using pixels. Pixels are the tiny squares that make up the image you see on computer monitors. To draw a line, a computer must work out which pixels need to be filled so that the line looks straight. We can try this by coloring in squares on a grid.
PART A: Can you draw a straight line from A(3, 4) to B(16,9) by coloring the pixels?
A = 2× change in Y value B = A − 2× change in X value P = A− change in X value Fill the starting pixel. Then for every position along the X axis: • if P is less than 0, draw the new pixel on the same line as the last pixel, and add A to P. • if P was 0 or greater, draw the new pixel one line higher than the last pixel, and add B to P. • continue this process until we reach the end of the line
PART B: Brensenham’s Line Algorithm.
2468101214161824681012
A
B
谷歌验证失败。请稍后再试!您已达到每个帐户已保存的Polypad的最大数量。删除一些,然后重试! 加载此Polypad时出了点问题。请稍后再试! Polypad保存! 保存此Polypad时出了点问题。请稍后再试! 当前Polypad为空。保存前添加一些瓷砖! 该Polypad已保存。进行一些更改,然后重试! 删除时出了点问题。请稍后再试! 分享设置已更新! 无法更新共享设置。请稍后再试! 移动时出了点问题。请稍后再试! 重命名时出了点问题。请稍后再试! 网址已复制到剪贴板! 不可能平衡这些权重。 这不是有效的多面体网络。 覆盖解决方案仅支持多边形。