- 6
- 0
- 约 8页
- 2016-08-22 发布于河南
- 举报
AI浓缩版11
一.追逐与闪躲
Bresenham算法的原理是,计算每一点与终点之间的的横轴与纵轴,然后比较两轴的长度,哪个轴比较长,就往该方向前进,如果两轴等长,则往斜边前进。if (deltaCol deltaRow)
{ fraction = deltaRow * 2 - deltaCol;
while (nextCol != endCol)
{ if (fraction = 0)
{ nextRow += stepRow;
fraction -= deltaCol;
}
nextCol += stepCol;
fraction += deltaRow;
pathRow[currentStep] = nextRow;
pathCol[currentStep] = nextCol;
currentStep++;
}}
else
{ fraction = deltaCol * 2 - deltaRow
原创力文档

文档评论(0)