Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
562 views
in Technique[技术] by (71.8m points)

javascript - Placing points equidistantly along an Archimedean spiral

I have an Archimedean spiral determined by the parametric equations x = r t * cos(t) and y = r t * sin(t).

I need to place n points equidistantly along the spiral. The exact definition of equidistant doesn't matter too much - it only has to be approximate.

Using just r, t and n as parameters, how can I calculate the coordinates of each equidistant point?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You want to place points equidistantly corresponding to arc length. Arc length for Archimedean spiral (formula 4) is rather complex

s(t) = 1/(2*a) * (t * Sqrt(1 + t*t) + ln(t + Sqrt(1+t*t)))

and for exact positions one could use numerical methods, calculating t values for equidistant s1, s2, s3... arithmetical progression. It is possible though.

First approximation possible - calculate s(t) values for some sequence of t, then get intervals for needed s values and apply linear interpolation.

Second way - use Clackson scroll formula approximation, this approach looks very simple (perhaps inexact for small t values)

 t = 2 * Pi * Sqrt(2 * s / a)

Checked: quite reliable result

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...