Skip to content

Instantly share code, notes, and snippets.

@i2pi
Last active June 22, 2021 06:27
Show Gist options
  • Save i2pi/9f6fa6cb1b0694424960 to your computer and use it in GitHub Desktop.
Save i2pi/9f6fa6cb1b0694424960 to your computer and use it in GitHub Desktop.
Love Simple
heart <- function (w) {
x <- 16*sin(w)^3
y <- 13*cos(w)-5*cos(2*w)-2*cos(3*w)-cos(4*w)
return (cbind (x,y)/32)
}
wave <- function (a, R, p, w) {
h <- heart(a)
x <- (0.5 + 0.5*R*sin(p+w*a))*h[,1]
y <- (0.5 + 0.5*R*sin(p+w*a))*h[,2]
return (cbind(x,y))
}
par(bg=rgb(148/255,131/255,171/255))
par(fg='white')
t <- seq(0, 2*pi, length.out=5000)
M<-0.35
plot(c(-1, 1)*M, c(-1, 1)*M, pch='', bty='n', axes='F', xlab='', ylab='')
for (i in 0:7) lines(wave(t,0.3,2*pi*i/8,2), lwd=3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment