Skip to content

Instantly share code, notes, and snippets.

@baptiste
Created April 16, 2025 10:26
Show Gist options
  • Save baptiste/dfa29b79af704d586ae9a3180e2ee296 to your computer and use it in GitHub Desktop.
Save baptiste/dfa29b79af704d586ae9a3180e2ee296 to your computer and use it in GitHub Desktop.
cornu spiral for course banners
library(ggplot2)
library(pracma)
library(ggplot2)
# remotes::install_github('houyunhuang/ggvwline')
library(grid)
library(vwline)
library(gggrid)
bump <- function(t) ifelse(abs(t)<1, exp(-1/(1-t^2)), 0)
cornu <- function(q){
data.frame(x=fresnelS(q) ,
y=fresnelC(q),
t=q,f=0.03+0.2*bump(t)+0.5*bump(t+0.2)+0.31*bump(t*2-3.2))
}
t <- seq(-0.92*pi,0.92*pi,length=600)
y <- cornu(t)
ggplot(y,aes(x,y,size=12*f/10)) +
theme_void() +
geom_path(col='gold') +
theme(legend.position = 'none')
ggsave('cornu.png')
last_plot() + coord_polar(theta = 'y')
ggsave('cornu-polar.png')
@baptiste
Copy link
Author

cornu

cornu-polar

@baptiste
Copy link
Author

figma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment