The Basic Incremental Algorithm for line

Simple incremental algorithm is well-known also look like DDA (Digital Differential Analyzer) algorithm. The pricnip of this algorithm is based on periodical increase dx for co-ordinate x and also dy for co-ordinate y. Start point is one from end point a line. Because we pattern in raster, increase on directional axis will be  (providing, if line be inclined to axis x is directional axis x) right one dot.

$$$APPLET

Applet Increase for value x and y.

Method is following. In one loop we shall step by step add to co-ordinate on a main axis value 1 and to co-ordinate on incident axis add increase. If axis x is main, value slope equal m.If axis y then value slope equal 1/m. Real number co-ordinates of the displayed objects must be rounded off. DDA algorithm used to calculations new co-ordinate values before dot.

$$$APPLET

Applet Dwawing a line from left top dot. Please select second end dot. Key 1,2 for zooming.

The Basic Incremental Algorithm [4].

Copyright (c) 1999-2017 Juraj Štugel. www.netgraphics.sk