[R-sig-Geo] create a asymmetric ellipse

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Mar 24 08:12:24 CET 2010


Nice one, Barry! It shows up even nicer (IMO) when you add

plot(elly(10,5,3,5),type='l', asp=1)


Barry Rowlingson wrote:
> Here's a solution for four elliptical quadrants:
> 
> elly <- function(N,S,W,E,x=0,y=0,n=100){
> 
>   xo=yo=double(n*4)
>   step=pi/(2*n)
> 
>   xf=c(E,W,W,E)
>   yf=c(N,N,S,S)
>   j=1
>   for(q in 1:4){
>     for(i in 1:n){
>       theta=(q-1)*(pi/2)+(i-1)*step
>       xo[j]=xf[q]*cos(theta)
>       yo[j]=yf[q]*sin(theta)
>       j=j+1
>     }
>   }
> 
>   return(cbind(xo+x,yo+y))
> }
> 
> then try:
> 
> plot(elly(10,5,3,5),type='l')
> 
> Barry
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list