Draw a spiral

0

Please login or register to vote for this query.

(click on this box to dismiss)

Run query and go to the "GRAPH" tab

Robotics Meta

Q&A about the site for professional robotic engineers, hobbyists, researchers and students

--calculate circle points, gradually decreasing decrease radius  (circle: query #882633)
set nocount on
declare @Radius decimal(28,23) = ##Radius:Int?1400##  
declare @spirals float = ##Spirals:Int?10##
declare @numberOfPositions float = ##numberOfPositions:int?360##
declare @radiansPerPosition float = (360/@numberOfPositions)*pi()/180.0 --'radians = degrees × pi / 180°
declare @xStop float, @yStop float
create table #x ( groupSpace varchar(10), x float, y float)
declare @z float, @spiral int=0, @groupspace varchar(15)=N' '

while @spiral <= @spirals 
  begin
    set @spiral=@spiral+1
    set @groupspace=@groupspace+N' '
    set @z=20
    while @z <= @numberOfPositions-19
      begin --calculate points
        set @xStop = Cos(@radiansPerPosition * (@z*1.00)) * @Radius
        set @yStop = Sin(@radiansPerPosition * (@z*1.00)) * @Radius
        insert into #x(groupSpace,x,y) values (@groupspace,@xStop,@yStop)  --write to table (double the height)
        set @z=@z+1
        set @radius = case when ##accelerate:int?0## = 0 
           then @radius - ((1.0*@radius/@spirals)/@numberOfPositions)
            else  @radius -##accelerate:int?0## end
      end
  end
	
print @z
select x,groupspace,y from #x 
union all select  2660.0,N' ', 1333.0 --the keep circle away from edge
union all select -2660.0,'',-1333.0
--1400,10,180,0 =circle
--1400,100,360,0 = solid

--Radius:Radius (100-?):
--Spirals:# of Rotations (1-30?):
--accelerate: Oval-ize (0-30?):
--numberOfPositions:# of Dots in  a Circle (1-360):

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results