Line#coordinatesOnLine()

coordinatesOnLine(stepRate, results) → {array}

Using Bresenham's line algorithm this will return an array of all coordinates on this line.
The start and end points are rounded before this runs as the algorithm works on integers.

Parameters
Name Type Argument Default Description
stepRate number <optional>
1

How many steps will we return? 1 = every coordinate on the line, 2 = every other coordinate, etc.

results array <optional>

The array to store the results in. If not provided a new one will be generated.

Returns
array -

An array of coordinates.

Source code: geom/Line.js (Line 278)
doc_phaser
2017-02-14 10:53:57
Comments
Leave a Comment

Please login to continue.