DDA line algorithm point generation
npm install dda-line-algorithm
js
let dda = require('dda-line-algorithm') OR import dda from 'dda-line-algorithm'
let pointsList = dda.DDALine (1,4,5,9);
`
returns
` js
[ { x: 1, y: 4 },
{ x: 2, y: 5 },
{ x: 3, y: 6 },
{ x: 3, y: 7 },
{ x: 4, y: 8 },
{ x: 5, y: 9 } ]
`
Access points
you can access points using
` js
for(const point of pointsList) {
x = point.x
y = point.y
// ...
}
``