[R] how to rotate a triangle image(ZMAT) ?
Cleber N.Borges
klebyn at yahoo.com.br
Wed Jun 28 01:22:35 CEST 2006
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)
More information about the R-help
mailing list