[Seqinr-commits] r1642 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Sep 5 21:08:21 CEST 2009


Author: lobry
Date: 2009-09-05 21:08:20 +0200 (Sat, 05 Sep 2009)
New Revision: 1642

Added:
   pkg/R/circle.R
Log:
 

Added: pkg/R/circle.R
===================================================================
--- pkg/R/circle.R	                        (rev 0)
+++ pkg/R/circle.R	2009-09-05 19:08:20 UTC (rev 1642)
@@ -0,0 +1,10 @@
+circle <- function(x = 0, y = 0, r = 1, theta = c(0, 360), n = 100, ...){
+  a <- seq(theta[1], theta[2], length = n)
+  xx <- x + r*cos(a*2*pi/360)
+  yy <- y + r*sin(a*2*pi/360)
+  	if(!identical(theta, c(0, 360))){
+  	  xx <- c(xx, x)
+  	  yy <- c(yy, y)
+  	}
+  	polygon(xx, yy, ...)
+}



More information about the Seqinr-commits mailing list