简体   繁体   中英

Equally spaced points on archimedian spiral

I know how to plot an archimedian spiral

a <- 20 #distance from origin
b <- 1 #distance between loops
maxtheta <- 20*pi  #10 times round the loop

theta <- seq(0,maxtheta,0.01) #my sequence of angles
r <- a + b*theta # equation for the spiral

df <- data.frame(x=r*cos(theta), y=r*sin(theta)) # convert points to Cartesian coordinates
#then plot them to get spiral

In addition, I would also like to plot evenly distributed points on the spiral, but my points are always unequally spaced so far.

You could systematically select rows using modular math.

plot(df, pch=20, cex=.1, asp=1)
points(df[seq_len(nrow(df)) %% 50 == 0, ], pch=20, col='red')

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM