文件名称:BHcircle
介绍说明--下载内容均来自于网络,请自行研究使用
数值微分(DDA)法:
设过端点P0(x0 ,y0)、P1(x1 ,y1)的直线段为L(P0 ,P1),则直线段L的斜率 L的起点P0的横坐标x0向L的终点P1的横坐标x1步进,取步长=1(个象素),用L的直线方程y=kx+b计算相应的y坐标,并取象素点(x,round(y))作为当前点的坐标。因为:
yi+1 = kxi+1+b
= k1xi+b+kDx
= yi+kDx
所以,当Dx =1 yi+1 = yi+k。也就是说,当x每递增1,y递增k(即直线斜率)。根据这个原理,我们可以写出DDA画线算法程序。
2中点画线法
-Numerical differentiation (DDA) method: set off endpoints P0 (x0, y0), P1 (x1, y1) of the straight line for the L (P0, P1), the slope of the line segment L L abscissa x0 the starting point P0 to the L abscissa of the end of P1 x1 step, take steps = 1 (pixels), with L the linear equation y = kx+ b calculates the corresponding y coordinates, and take the pixel (x, round (y)) as the current point coordinates. As: yi+1 = kxi+1+ b = k1xi+ b+ kDx = yi+ kDx So, when Dx = 1 yi+1 = yi+ k. That is, when each increment x 1, y increases k (ie slope of the line.) According to this principle, we can write the DDA line drawing algorithm program. 2, dotted line method
设过端点P0(x0 ,y0)、P1(x1 ,y1)的直线段为L(P0 ,P1),则直线段L的斜率 L的起点P0的横坐标x0向L的终点P1的横坐标x1步进,取步长=1(个象素),用L的直线方程y=kx+b计算相应的y坐标,并取象素点(x,round(y))作为当前点的坐标。因为:
yi+1 = kxi+1+b
= k1xi+b+kDx
= yi+kDx
所以,当Dx =1 yi+1 = yi+k。也就是说,当x每递增1,y递增k(即直线斜率)。根据这个原理,我们可以写出DDA画线算法程序。
2中点画线法
-Numerical differentiation (DDA) method: set off endpoints P0 (x0, y0), P1 (x1, y1) of the straight line for the L (P0, P1), the slope of the line segment L L abscissa x0 the starting point P0 to the L abscissa of the end of P1 x1 step, take steps = 1 (pixels), with L the linear equation y = kx+ b calculates the corresponding y coordinates, and take the pixel (x, round (y)) as the current point coordinates. As: yi+1 = kxi+1+ b = k1xi+ b+ kDx = yi+ kDx So, when Dx = 1 yi+1 = yi+ k. That is, when each increment x 1, y increases k (ie slope of the line.) According to this principle, we can write the DDA line drawing algorithm program. 2, dotted line method
(系统自动生成,下载前可以参看下载内容)
下载文件列表
BHcircle.cpp