library(gifski)
#Plots out Initials CC.
x = c(seq(0,1.5,length.out = 500), seq(0,1.5,length.out = 500), seq(2,3.5,length.out = 500), seq(2,3.5,length.out = 500))
y = c(sqrt(1-(seq(0,1.5,length.out = 500)-1)^2), -sqrt(1-(seq(0,1.5,length.out = 500)-1)^2), sqrt(1-(seq(2,3.5,length.out = 500)-3)^2), -sqrt(1-(seq(2,3.5,length.out = 500)-3)^2))
z = rbind(x,y)
plot(y~x, xlim = c(-3,7), ylim = c(-2,2), pch = 16)
### 1 Shear in the horizontal direction (x-direction), y stays
constant.
#Shear in the horizontal direction (x-direction), y stays constant
for (a in seq(0,1,length.out=15)) {
z_shear<-apply(z,2,function(x) x %*% matrix(c(1,a,0,1),nrow=2,ncol=2))
plot(z_shear[2,]~z_shear[1,], xlim=c(-4,8), ylim=c(-2,2), col='green', xlab = "x axis", ylab = "y axis", main = "X Shear of Initials")
}
### 2 Scaling Initials
#Scaling Initials
for(b in seq(1,2,length.out = 15)){
z_scale_up<-apply(z,2,function(x) x %*% matrix(c(b,0,0,b),nrow=2,ncol=2))
plot(z_scale_up[2,]~z_scale_up[1,],xlim=c(-6,14),ylim=c(-4,4),col='green', xlab = "x axis", ylab = "y axis", main = "Scaling of Initials")
}
#Scaling Initials
for(d in seq(0,2*pi,length.out = 25)){
z_transform<-apply(z,2,function(x) x %*% matrix(c(cos(d),-sin(d),sin(d),cos(d)),nrow=2,ncol=2))
plot(z_transform[2,]~z_transform[1,],xlim=c(-10,10),ylim=c(-4,4),col='green', xlab = "x axis", ylab = "y axis", main = "Rotation of Initials")
}
#Projecting Initials Incrementally
z_temp = 0
for(a in seq(0,2*pi,length.out = 25)){
z_temp <- rbind(z,rep(0,ncol(z)))
z_scale_up<-apply(z_temp,2,function(x) x %*% matrix(c(cos(a),0,-sin(a),0,1,0,sin(d),0,cos(d)),nrow=3,ncol=3))
plot(z_scale_up[2,]~z_scale_up[1,],xlim=c(-6,14),ylim=c(-4,4),col='green', xlab = "x axis", ylab = "y axis", main = "Projection of Initials")
}