Created
April 16, 2025 10:26
-
-
Save baptiste/dfa29b79af704d586ae9a3180e2ee296 to your computer and use it in GitHub Desktop.
cornu spiral for course banners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment