@SphericalArrangement2-1(Definition)
--track0:PolarSc,0,100,100
--track1:XScale,0,1000,100
--track2:YScale,0,1000,100
--track3:ZScale,0,1000,100
--check0:Draw objects at poles,0

pscale=obj.track0
xscale=obj.track1
yscale=obj.track2
zscale=obj.track3
pdraw=obj.check0

@SphericalArrangement2-2(Render)
--track0:LongVertex,1,50,10
--track1:LatVertex,1,50,10
--track2:Radius,1,1000,100
--track3:SelfSpin,-3600,3600,0
--param:dir=3;
keisen = math.floor(obj.track0)
isen = math.floor(obj.track1)
r = obj.track2
rotshift = obj.track3
for i=0,keisen-1 do
  if(pdraw) then
    ry = 90 - 180/(keisen+1) * (i+1)
  else
    ry = 90 - 90/keisen - 180/keisen * i
  end
  radY=math.rad(ry)
  
  zm = ((100-pscale)*math.cos(radY) + pscale) / 100
  
  
  for j=0,isen-1 do
    rx = 360/isen * j + rotshift
    rz = -90
    radX = math.rad(rx)
    px = -r * math.sin(radY) * xscale/100
    py = r * math.sin(radX) * math.cos(radY) * yscale/100
    pz = -r * math.cos(radX) * math.cos(radY) * zscale/100
    if(dir==-1) then
      rx = 0
      ry = 0
      rz = 0
    elseif(dir==0) then
      rx = 0
      ry = 0
    elseif(dir==1) then
      ry=0
    elseif(dir==2) then
      rx=rx+180
      ry=0
    elseif(dir==4) then
      px=-px
      py=-py
      pz=-pz
    end
    obj.draw(px,py,pz,zm,1,rx,ry,rz)
  end
end
if(pdraw) then
  
  px = r*xscale/100
  zm = pscale/100
  if(dir==-1) then
    obj.draw(-px,0,0,zm,1,0,0,0)
    obj.draw(px,0,0,zm,1,0,0,0)
  elseif(dir==0) then
    obj.draw(-px,0,0,zm,1,0,0,-90)
    obj.draw(px,0,0,zm,1,0,0,-90)
  elseif(dir==1) then
    obj.draw(-px,0,0,zm,1,rotshift,0,-90)
    obj.draw(px,0,0,zm,1,rotshift+180,0,-90)
  elseif(dir==2) then
    obj.draw(-px,0,0,zm,1,rotshift+180,0,-90)
    obj.draw(px,0,0,zm,1,rotshift,0,-90)
  elseif(dir==3) then
    obj.draw(-px,0,0,zm,1,rotshift,90,-90)
    obj.draw(px,0,0,zm,1,rotshift+180,-90,-90)
  elseif(dir==4) then
    obj.draw(-px,0,0,zm,1,rotshift+180,-90,-90)
    obj.draw(px,0,0,zm,1,rotshift,90,-90)
  end
end