admin管理员组文章数量:1416642
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?
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?
-
what do you mean by equidistantly? equal distance along the spiral, or in the
xy
plane? And what range of the spiral do you want to split? Sincet
is not defined, it could be infinite. And you can't deal withinfinity
in a finite context. Please rewise and update your question. – Thomas Commented Jun 24, 2017 at 21:26 - All variables will be defined by the programme. I'm looking for a general solution. I feel like "n equidistant points around a spiral" should be fairly self explanatory – snazzybouche Commented Jun 24, 2017 at 21:55
-
1
Then how about
for(var i=0; i<n; ++i) console.log({x: i*r*Math.PI*2, y:0 })
? All points are on the parametric spiral and all exactly byr*Math.PI*2
away from each other. – Thomas Commented Jun 24, 2017 at 22:06 -
1
I'm not an expert but I'm fairly sure a curve with
y = 0
isn't a spiral – snazzybouche Commented Jun 24, 2017 at 23:00
1 Answer
Reset to default 8You want to place points equidistantly corresponding to arc length. Arc length for Archimedean spiral (formula 4) is rather plex
s(t) = a/2 * (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
本文标签: javascriptPlacing points equidistantly along an Archimedean spiralStack Overflow
版权声明:本文标题:javascript - Placing points equidistantly along an Archimedean spiral - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745255484a2650071.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论