bresenham | R Documentation |
Generate integer x,y points between vertices by Bresenham's algorithm.
bresenham(x, y = NULL, close = TRUE)
x, y |
the x and y coordinates a points to be joined where y can
can be missing and the argument x is processed by |
close |
|
A list of length 2 with integer
x,y
coordinates connecting
the vertices
# simple line bresenham(x = c(1, 4), y = c(1, 12)) # closed and open polygon verts <- list(x = c(1, 9, 6, 4, 2), y = c(9, 9, 2, 3, 1)) plot(verts, type = "l", ylim = c(0, 10), xlim = c(0, 10)) points(bresenham(verts)) # closed points(bresenham(verts, close = FALSE), col = 2, pch = 16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.