For this assignment, build the first letters for both your first and last name using point plots in R.

library(gifski)
x1 = c(seq(-1.5, -0.5, length.out=1000), rep(-1, 1000), 
      seq(0, 0.75, length.out=750), rep(0, 1000), 
      seq(0, 0.5, length.out=500))

y1 = c(rep(1, 1000), seq(-1, 1, length.out=1000),
      rep(1, 750), seq(-1, 1, length.out=1000),
      rep(0, 500))

A = matrix(c(x1, y1), nrow=(length(x1)), ncol=2)

plot(A[,2] ~ A[,1], xlim=c(-3, 3), ylim=c(-3, 3))

Then, write R code that will left multiply (%>%) a square matrix (x) against each of the vectors of points (y). Initially, that square matrix will be the Identity matrix.

M0 <- matrix(rep(0, 4), nrow=2, ncol=2)

e <- A %*% M0

Use a loop that changes the transformation matrix incrementally to demonstrate 1) shear, 2) scaling, 3) rotation , and 4) projection in animated fashion.

#shear
M1 <- matrix(c(1, 0, 0.5, 1), nrow=2, ncol=2, byrow=TRUE)
a <- A %*% M1
#scale by 2x, 3y
M2 <- matrix(c(2, 0, 0, 3), nrow=2, ncol=2, byrow=TRUE)
b <- A %*% M2
  
#rotate clockwise 90 degrees
M3 <- matrix(c(cospi(0.5), -1*sinpi(0.5), sinpi(0.5), cospi(0.5)), nrow=2, ncol=2, byrow=TRUE)
c <- A %*% M3
  
# projection
M4 <- matrix(c(0.75, 0.5, -0.75, 0.5), nrow=2, ncol=2, byrow=TRUE)
d <- A %*% M4

w1 <- list(A[,1], a[,1], b[,1], c[,1], d[,1])
w2 <- list(A[,2], a[,2], b[,2], c[,2], d[,2])

for (i in 1:5) {
  plot(unlist(w2[i]) ~ unlist(w1[i]), xlim=c(-3, 3), ylim=c(-3, 3))
}