You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
671 B

  1. /**
  2. * Draws a line from pointA to pointB on the canvas
  3. * with the Bresenham algorithm.
  4. * @param {Uint8ClampedArray} data - The linearised pixel array
  5. * @param {[number, number]} pointA - The start point of the line
  6. * @param {[number, number]} pointB - The end point of the line
  7. * @param {number} width - The width of the canvas
  8. * @param {number} height - The height of the canvas
  9. */
  10. export function bresenham(data: Uint8ClampedArray, pointA: [number, number], pointB: [number, number], width: number, height: number) {
  11. // TODO: Adapt the C-implementation at https://de.wikipedia.org/wiki/Bresenham-Algorithmus#C-Implementierung
  12. }