返回列表 回复 发帖
上楼文件,再加一个旋转角变换:
1.jpg
2.jpg
五角星陷阱旋转变换出五个五角星陷阱一,扫图:
1.jpg
再扫:
2.jpg
感谢柳老师的美图啊!想邀请柳老师到MC吧来,不知可否?
lnszdzg100就是lnszdzg,原先的用户登录不上了,重新注册的。
334# lnszdzg100
感谢杜老师邀请,空了来看看。
五角星陷阱20150312 {
init:
  int iter = 0
  float x = 0
  float y = 0
  float xB=0
  float yB=0
  float dAB=0
  float dBC=0
  float dAC=0
  float Dsgd1 = 0
  float ZtoPsqd = 0
  float Rc = @r
  float H=@h
  float ID=0
  bool Trapped = false
loop:
  z1=(#z-@xx-@yy*1i)*exp(-@an*pi/180*1i)
  x = real(z1)
  y = imag(z1)
  m1=tan(0.2*pi)*x-y
  m2=tan(0.4*pi)*x+y
  m3=tan(0.4*pi)*x-y
  m4=tan(0.2*pi)*x+y
if  m1>0&&m4>0
  ann=0
elseif m1<0&&m2>0
  ann=-0.4*pi
elseif  m2<0&&y>0
  ann=-0.8*pi
elseif y<0&&m3<0
  ann=0.8*pi
elseif  m3>0&&m4<0
  ann=0.4*pi
endif
  z1=z1*exp(ann*1i)
  x = real(z1)
  y = imag(z1)
  xB=0.309017*Rc
  yB=0.224514*Rc
  LOB=0.726543*x-y
  LOB1=x+0.726543*y-xB-0.726543*yB
  LOC=0.726543*x+y
  LOC1=x-0.726543*y-xB-0.726543*yB
  dAB=abs(yB*x-(xB-Rc)*y-yB*Rc)/sqrt(yB^2+(xB-Rc)^2)
  dBC=abs(x-xB)
  dAC=abs(yB*x+(xB-Rc)*y-yB*Rc)/sqrt(yB^2+(xB-Rc)^2)

if iter>@skip
  if (@rangevar==0&&!Trapped) ||(@rangevar==1)
   if LOB>0&&LOB1>0&&y>0&&dAB<H
   Dsgd1=dAB
   ID=iter
   ZtoPsqd= Dsgd1
   Trapped= true
   elseif LOB>0&&LOC>0&&LOB1<0&&LOC1<0&&dBC<H
   Dsgd1=dBC
   ID=iter
   ZtoPsqd= Dsgd1
   Trapped= true
   elseif  LOC>0&&LOC1>0&&y<0&&dAC<H
   Dsgd1=dAC
   ID=iter
   ZtoPsqd= Dsgd1
   Trapped= true
   endif
  endif
endif
iter= iter + 1
final:
  if !Trapped
    #solid=true
  else
    ID = (@off+ID)%8
    float Ratio = 1-ZtoPsqd/H
    float ColorIndex = 29 * Ratio + ID * 30
    #index = (ColorIndex +1) % 256 /256
  endif
default:
  title = "五角星陷阱20150312"
  param r
    caption = "Circle radius"
    default = 1.0
  endparam
    param h
    caption = "h"
    default = 0.15
  endparam
param an
    caption = "五角星旋转角"
    default =0
  endparam
param xx
    caption = "五角星中心横标"
    default =0.00000
  endparam
param yy
    caption = "五角星中心纵标"
    default =0.0000
  endparam
param rangevar
    caption="range variable"
    default=0
    enum="先上后下" "后来居上"
  endparam
param off
    caption = "off"
    default =1
  endparam
param skip
    caption = "skip"
    default =0
  endparam
}
1.jpg
336# 柳烟


柳老师来吧,肖老师xklppp 和向老师已经来了
五角星陷阱变换五个五角星20150312 {
init:
  int iter = 0
  float x = 0
  float y = 0
  float xB=0
  float yB=0
  float dAB=0
  float dBC=0
  float dAC=0
  float Dsgd1 = 0
  float ZtoPsqd = 0
  float Rc = @r
  float H=@h
  float ID=0
  bool Trapped = false
loop:
x=real(#z)
y=imag(#z)
n1=0.726543*x-y
n2=3.07768*x+y
n3=3.07768*x-y
n4=0.726543*x+y
if n1>0&&n4>0
  kn=0
elseif  n1<0&&n2>0
kn=-0.4*pi
elseif  n2<0&&y>0
kn=-0.8*pi
elseif y<0&&n3<0
kn=0.8*pi
elseif n3>0&&n4<0
kn=0.4*pi
endif
z1=#z*exp(kn*1i)-@zz

  z1=(z1-@xx-@yy*1i)*exp(-@an*pi/180*1i)
  x = real(z1)
  y = imag(z1)
  m1=tan(0.2*pi)*x-y
  m2=tan(0.4*pi)*x+y
  m3=tan(0.4*pi)*x-y
  m4=tan(0.2*pi)*x+y
if  m1>0&&m4>0
  ann=0
elseif m1<0&&m2>0
  ann=-0.4*pi
elseif  m2<0&&y>0
  ann=-0.8*pi
elseif y<0&&m3<0
  ann=0.8*pi
elseif  m3>0&&m4<0
  ann=0.4*pi
endif
  z1=z1*exp(ann*1i)
  x = real(z1)
  y = imag(z1)
  xB=0.309017*Rc
  yB=0.224514*Rc
  LOB=0.726543*x-y
  LOB1=x+0.726543*y-xB-0.726543*yB
  LOC=0.726543*x+y
  LOC1=x-0.726543*y-xB-0.726543*yB
  dAB=abs(yB*x-(xB-Rc)*y-yB*Rc)/sqrt(yB^2+(xB-Rc)^2)
  dBC=abs(x-xB)
  dAC=abs(yB*x+(xB-Rc)*y-yB*Rc)/sqrt(yB^2+(xB-Rc)^2)

if iter>@skip
  if (@rangevar==0&&!Trapped) ||(@rangevar==1)
   if LOB>0&&LOB1>0&&y>0&&dAB<H
   Dsgd1=dAB
   ID=iter
   ZtoPsqd= Dsgd1
   Trapped= true
   elseif LOB>0&&LOC>0&&LOB1<0&&LOC1<0&&dBC<H
   Dsgd1=dBC
   ID=iter
   ZtoPsqd= Dsgd1
   Trapped= true
   elseif  LOC>0&&LOC1>0&&y<0&&dAC<H
   Dsgd1=dAC
   ID=iter
   ZtoPsqd= Dsgd1
   Trapped= true
   endif
  endif
endif
iter= iter + 1
final:
  if !Trapped
    #solid=true
  else
    ID = (@off+ID)%8
    float Ratio = 1-ZtoPsqd/H
    float ColorIndex = 29 * Ratio + ID * 30
    #index = (ColorIndex +1) % 256 /256
  endif
default:
  title = "五角星陷阱变换五个五角星20150312"
  param r
    caption = "Circle radius"
    default = 0.50
  endparam
    param h
    caption = "h"
    default = 0.02
  endparam
param an
    caption = "五角星旋转角"
    default =0
  endparam
param xx
    caption = "五角星中心横标"
    default =0.00000
  endparam
param yy
    caption = "五角星中心纵标"
    default =0.0000
  endparam
param zz
    caption = "五个五角星微调"
    default =0.8
  endparam
param rangevar
    caption="range variable"
    default=0
    enum="先上后下" "后来居上"
  endparam
param off
    caption = "off"
    default =1
  endparam
param skip
    caption = "skip"
    default =0
  endparam
}
重新设计算法,一举拿下多边星——边数边宽可设
1.gif
2.gif
正多边星陷阱工具.gsp (16.83 KB)
返回列表