http://www.mathworks.com/matlabcentral/newsreader/view_thread/320092
MATLAB Central Newsreader  Uniform spiral shape creation
Feed for thread: Uniform spiral shape creation
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Tue, 15 May 2012 10:30:07 +0000
Uniform spiral shape creation
http://www.mathworks.com/matlabcentral/newsreader/view_thread/320092#876867
Noa Armon
Hi,<br>
<br>
I've the following lines in order to define a spiral shape:<br>
>> t = linspace(0,10*pi,400);<br>
>> x = t.*cos(t)/(10*pi)*0.5;<br>
>> y = t.*sin(t)/(10*pi)*0.5;<br>
>> plot(x,y,'.')<br>
<br>
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.<br>
I assume linspace is not the answer...<br>
<br>
Thanks,<br>
Noa

Tue, 15 May 2012 13:44:15 +0000
Re: Uniform spiral shape creation
http://www.mathworks.com/matlabcentral/newsreader/view_thread/320092#876884
Matt J
"Noa Armon" wrote in message <jotb7f$jpr$1@newscl01ah.mathworks.com>...<br>
> Hi,<br>
> <br>
> I've the following lines in order to define a spiral shape:<br>
> >> t = linspace(0,10*pi,400);<br>
> >> x = t.*cos(t)/(10*pi)*0.5;<br>
> >> y = t.*sin(t)/(10*pi)*0.5;<br>
> >> plot(x,y,'.')<br>
> <br>
> 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.<br>
==============<br>
<br>
You really do mean 2D "area" density? You're not just trying to have the points evenly spaced along the path of the spiral?<br>
<br>
If so, how would you choose to quantify area density? If you define it based on the number of points occupying a square patch of area, then if you make the squares small enough, eventually you'll get uniformly 1 point per patch for any finite set of points.

Tue, 15 May 2012 20:24:05 +0000
Re: Uniform spiral shape creation
http://www.mathworks.com/matlabcentral/newsreader/view_thread/320092#876936
Roger Stafford
"Noa Armon" wrote in message <jotb7f$jpr$1@newscl01ah.mathworks.com>...<br>
> I've the following lines in order to define a spiral shape:<br>
> >> t = linspace(0,10*pi,400);<br>
> >> x = t.*cos(t)/(10*pi)*0.5;<br>
> >> y = t.*sin(t)/(10*pi)*0.5;<br>
> >> plot(x,y,'.')<br>
> <br>
> 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.<br>
         <br>
In your equations if 's' denotes the arc length along the spiral, the following can be derived:<br>
<br>
dsdt = sqrt(dxdt^2+dydt^2) = k*sqrt(1+t^2)<br>
<br>
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:<br>
<br>
s = k/2*(t*sqrt(1+t^2)+log(t+sqrt(1+t^2)))<br>
<br>
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.<br>
<br>
However we can achieve an inverse by taking the reciprocal<br>
<br>
dtds = 1/k/sqrt(1+t^2)<br>
<br>
which defines a differential equation that can be solved using one of the ode solvers where s is regarded as the independent variable.<br>
<br>
In other words, using some kind of evenlyspaced 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.<br>
<br>
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 areawise 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.<br>
<br>
Roger Stafford

Tue, 15 May 2012 22:43:08 +0000
Re: Uniform spiral shape creation
http://www.mathworks.com/matlabcentral/newsreader/view_thread/320092#876948
ImageAnalyst
Noa:<br>
Try John D'Errico's "interparc":<br>
<a href="http://www.mathworks.com/matlabcentral/fileexchange/34874interparc">http://www.mathworks.com/matlabcentral/fileexchange/34874interparc</a><br>
I think you can give it any curve and it will give you evenly spaced<br>
coordinates along the curve.

Wed, 16 May 2012 06:28:08 +0000
Re: Uniform spiral shape creation
http://www.mathworks.com/matlabcentral/newsreader/view_thread/320092#876970
Bruno Luong
"Noa Armon" wrote in message <jotb7f$jpr$1@newscl01ah.mathworks.com>...<br>
> Hi,<br>
> <br>
> I've the following lines in order to define a spiral shape:<br>
> >> t = linspace(0,10*pi,400);<br>
> >> x = t.*cos(t)/(10*pi)*0.5;<br>
> >> y = t.*sin(t)/(10*pi)*0.5;<br>
> >> plot(x,y,'.')<br>
> <br>
> 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.<br>
> I assume linspace is not the answer...<br>
<br>
Try this:<br>
<br>
rmax = 30;<br>
thetamax = 10*pi;<br>
n = 400;<br>
<br>
theta = sqrt(linspace(1,thetamax^2,n));<br>
r = sqrt(linspace(1,rmax^2,n));<br>
x = r.*cos(theta);<br>
y = r.*sin(theta);<br>
plot(x,y,'.')<br>
<br>
%Bruno<br>
<br>
% Bruno