library(animation)
#dev.control('enable')
myani=ani.record(reset=TRUE, replay.cur=FALSE)
x=c(rep(0,500),seq(0,1,length.out=1000), rep(2,500),seq(2,3,length.out=1000),seq(2,3,length.out=1000),seq(2,3,length.out=1000), rep(3,500))
y=c(seq(-1,1,length.out=500),rep(-1,1000), seq(0,1,length.out=500),rep(1,1000),rep(0,1000),rep(-1,1000),seq(-1,0,length.out=500))
z=rbind(x,y)
plot(y~x, xlim=c(-2,3), ylim=c(-2,3))
mat1<-diag(2)
x11()
for (i in seq(-3,3,length.out=100))
{
j<-i*0.25
shear<-matrix(c(0 ,0,j, 0 ), nrow=2)
shear<-shear+mat1
newmat<-shear%*%z
y2<-newmat[2,]
x2<-newmat[1,]
plot(y2~x2, xlim=c(-2,5), ylim=c(-2,5))
ani.record()
}
This is a shear or slant.
mat1<-diag(2)
x11()
#j<-1
#scale<-mat1
for (i in seq(1,3,length.out=100))
{
j<-i*1.15
scale<-j*mat1
newmat<-scale%*%z
y2<-newmat[2,]
x2<-newmat[1,]
plot(y2~x2, xlim=c(-4,12), ylim=c(-4,12))
ani.record()
}
This was a scaling. O
mat1<-diag(2)
x11()
for (i in seq(0,20,length.out=100))
{
j<-i
rotat<-matrix(c(cos(j) ,-sin(j),sin(j), cos(j) ), nrow=2)
newmat<-rotat%*%z
y2<-newmat[2,]
x2<-newmat[1,]
plot(y2~x2, xlim=c(-5,5), ylim=c(-5,5))
ani.record()
}
This is a rotation.
x11()
for (i in seq(-3,1,length.out=100))
{
j<-i
proj<-matrix(c(j ,0,0, 1-j ), nrow=2)
newmat<-proj%*%z
y2<-newmat[2,]
x2<-newmat[1,]
plot(y2~x2, xlim=c(-14,15), ylim=c(-14,15))
ani.record()
}
This is a rotation / reflection on the x axis x=0.