Learn R Programming

plotcli (version 0.2.0)

bresenham: Bresenham's line algorithm

Description

This function generates a list of points that form a line between two given points using Bresenham's line algorithm.

Usage

bresenham(x0, y0, x1, y1)

Value

A list of points that form a line between the two given points.

Arguments

x0

The x-coordinate of the starting point.

y0

The y-coordinate of the starting point.

x1

The x-coordinate of the ending point.

y1

The y-coordinate of the ending point.

Examples

Run this code
bresenham(0, 0, 5, 5)
bresenham(0, 0, -5, -5)

Run the code above in your browser using DataLab