## Construct circles with increasing accuracy and of different spatial classes
disc1 <- discpoly(c(0,0), 5, npoly=4, class = "owin")
disc2 <- discpoly(c(0,0), 5, npoly=16, class = "Polygon")
disc3 <- discpoly(c(0,0), 5, npoly=64, class = "gpc.poly") # may warn
## Look at the results
print(disc1)
plot(disc1, axes=TRUE, main="", border=2)
str(disc2)
lines(disc2, col=3)
str(disc3) # a list or a formal "gpc.poly" (if gpclib is available)
if (is(disc3, "gpc.poly")) {
plot(disc3, add=TRUE, poly.args=list(border=4))
} else {
lines(disc3[[1]], col=4)
}
## to only _draw_ a circle
symbols(0, 0, circles=5, inches=FALSE, add=TRUE, fg=5)
Run the code above in your browser using DataLab