Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Uniform spiral shape creation Date: Tue, 15 May 2012 20:24:05 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 30 Message-ID: <joue15$c7$1@newscl01ah.mathworks.com> References: <jotb7f$jpr$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1337113445 391 172.30.248.47 (15 May 2012 20:24:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 15 May 2012 20:24:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:767968 "Noa Armon" wrote in message <jotb7f$jpr$1@newscl01ah.mathworks.com>... > I've the following lines in order to define a spiral shape: > >> t = linspace(0,10*pi,400); > >> x = t.*cos(t)/(10*pi)*0.5; > >> y = t.*sin(t)/(10*pi)*0.5; > >> plot(x,y,'.') > > How can I change the distribution of the points along the track of the spiral, so that eventually I'll have a uniform area density of point. - - - - - - - - - - In your equations if 's' denotes the arc length along the spiral, the following can be derived: dsdt = sqrt(dxdt^2+dydt^2) = k*sqrt(1+t^2) where dsdt, dxdt, and dydt refer to derivatives of s, x, and y with respect to t and where k = 1/(10*pi)*0.5 . It does have a known integral: s = k/2*(t*sqrt(1+t^2)+log(t+sqrt(1+t^2))) but this does us no good since we need the inverse of such a function and that does not seem to be readily available in explicit form. However we can achieve an inverse by taking the reciprocal dtds = 1/k/sqrt(1+t^2) which defines a differential equation that can be solved using one of the ode solvers where s is regarded as the independent variable. In other words, using some kind of evenly-spaced values for s you can derive corresponding values for the parameter t that become more and more tightly spaced as you trace out the spiral so as to provide even spacing along the spiral's path. You can further refine this so that the intervals in s are approximately equal to the orthogonal distance between successive winds of the spiral in order to achieve some kind of approximate area-wise uniformity of points. Of course it won't be exact because arc length between points is not precisely the same as the chord length between them. Roger Stafford