搜索资源列表
Bresenham高效画线算法
- 画线的算法不少,但要作到高速、简单并不容易。斜率相乘法是最简单的方法之一,但计算每个点均要花费不少时间用于乘、除法运算;下面介绍的是Bresenham s高效画线算法,对每个点的坐标计算只要加、减法就能完成。-line drawing algorithm, but a lot to be done fast, simple is not easy. The slope is the most simple multiplication is one of the ways, but each p
324234
- 假定直线斜率k在0~1之间(k的其它取值可以类似处理),当前象素点为(xp,yp),则下一个象素点有两种可选择点P1-assumed linear slope of the k-1 between 0 (k values can be other similar processing), the current pixel (xp, yp), the next one pixel can have two points P1
Bresenham
- 该程序实现了Bresenham算法画直线,将四个象限的问题通过交换端点的方法合并成一,四象限的问题。再利用sign变量,统一成一个问题。又考虑到斜率<=1,>1,不存在,最终问题分成了三种情况。-The program implements Bresenham algorithm for drawing a straight line, the four quadrants of the problem through the exchange of endpoint methods