Re: [R] how to rotate a triangle image(ZMAT) ?

From: Cleber N.Borges <klebyn_at_yahoo.com.br>
Date: Wed 28 Jun 2006 - 09:22:35 EST

I thank François Pinard for your attention

one solution, but
very dirty
very ugly
and ~ 30% of calculations cut loose!

if somebody can give a tip, I thank...

Cleber

############
 f <- function(x,y){
 z=1-x-y
 z[ z < (-1e-15) ] <- NA
 return( -100*x + 0*y + 100*z )
}

 x = y = seq( 1, 0, by = -0.01 )
 z = outer(x,y,f)  

 t1 = length(x)

 aux = numeric(0)
 im  = numeric(0)
 for( i in seq( 1, t1, by = 2 ) ){

    idx = seq( i*t1, t1**2, by = t1 ) - (0:(t1 - i))     im = c(im, aux, z[idx], aux )
    aux = c(aux, NA)
}

 im = matrix(im,nr=t1)

 image(im, col=terrain.colors(256))
 contour(im, add=T)



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 28 09:25:25 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 28 Jun 2006 - 10:13:39 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.