option explicit
run Rhino.Integerbox("slices sum:",240),Rhino.Integerbox("waves sum:",20)
function run(n,nVp)
n=int(n/4)*4
dim cvs(3)
cvs(0)=rhino.addline(array(0,0,0),array(0,0,70))
cvs(1)=rhino.addline(array(0,0,0),array(10,0,0))
cvs(2)=rhino.addline(array(0,0,70),array(5,0,90))
cvs(3)=rhino.addcurve(array(array(10,0,0),array(10,0,20),array(30,0,40),array(50,0,60),array(50,0,90),array(40,0,100),array(25,0,105),array(15,0,100),array(5,0,90)))
dim srf : srf=rhino.AddEdgeSrf(cvs)
rhino.deleteobjects cvs
dim nU,nV : nU=1 : nV=nVp*2
dim domainU : domainU=Rhino.SurfaceDomain(srf,0)
dim domainV : domainV=Rhino.SurfaceDomain(srf,1)
dim dU: dU=(domainU(1)-domainU(0))/nU
dim dV: dV=(domainV(1)-domainV(0))/nV
dim puv() : redim puv(nU,nV)
dim pNormal,pTempUV,pTempXYZ,pTempXYZ1
dim i,j
dim alfa : alfa=360/n 'double sided
dim dAlfa
dim p : redim p((nU+1)*(nV+1)-1)
for i=0 to nU
for j=0 to nV
puv(i,j)=array(domainU(0)+i*dU,domainV(0)+j*dV)
pTempXYZ=Rhino.EvaluateSurface (srf, puv(i,j))
pNormal=rhino.surfaceNormal(srf,puv(i,j))
dAlfa=pTempXYZ(0)*tan(alfa*rhino.pi/180)
pTempXYZ1=shiftPt(pTempXYZ,array(0,0,0),pNormal,0.5*dAlfa*(-1)^j*abs(1-(-1)^i))
p(i*(nV+1)+j)=pTempXYZ1
next
next
rhino.deleteobject srf
dim srfA,srfB
srfA=rhino.AddSrfPtGrid(array(nU+1,nV+1), p,array(1,2))
for i=0 to ubound(p)
p(i)(1)=-p(i)(1)
next
srfB=rhino.AddSrfPtGrid(array(nU+1,nV+1), p,array(1,2))
srfB=rhino.RotateObject(srfB, array(0,0,0),alfa*2,array(0,0,1))
for i=1 to n/4
rhino.RotateObjects array(srfA,srfB), array(0,0,0),i*(alfa*4),array(0,0,1),true
next
end function
'distance of 2 pts
function shiftPt(p,p0,p1,d)
dim pp : pp=Array(0,0,0)
dim dd : dd=sqr((p1(0)-p0(0))^2+(p1(1)-p0(1))^2+(p1(2)-p0(2))^2)
pp(0)=(d/dd)*(p1(0)-p0(0))+p(0)
pp(1)=(d/dd)*(p1(1)-p0(1))+p(1)
pp(2)=(d/dd)*(p1(2)-p0(2))+p(2)
shiftPt=pp
end function作者: njyqqq 时间: 2010-6-18 13:56
楼主活雷锋啊,怎么着也的给楼主个管理员当把,{:3_51:}作者: skywoolf 时间: 2010-6-18 16:23
犀利的楼主~感谢分享!{:3_57:}作者: stratagem 时间: 2010-6-18 17:43
佩服楼主,为什么我看到代码之类的东西就头晕作者: 夜神 时间: 2010-6-18 18:11
还是个习惯问题,我看电池图也头晕,呵呵!作者: RRTYY 时间: 2010-6-18 19:12
看不懂{:3_54:}作者: panhao1 时间: 2010-6-18 19:14 5#夜神