home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1996 #6 / AmigaPlus-eXtra-6-96.iso.7z / AmigaPlus-eXtra-6-96.iso / programme / dust / batchfiles / deform.bat next >
DOS Batch File  |  1996-03-22  |  1KB  |  82 lines

  1. ;This script creates a plane and deforms it
  2. ;init
  3.  
  4. ;parameters
  5. .buffer=2
  6. .buffer2=3
  7. .width=240
  8. .xmin:=-60
  9. .xmax:=40
  10. .ymin:=-70
  11. .ymax:=30
  12. .z:=0
  13. .xsect:=8
  14. .ysect:=8
  15.  
  16.  
  17. ;create the plane
  18. .xstep=(xmax-xmin)/(xsect-1)
  19. .ystep=(ymax-ymin)/(ysect-1)
  20.  
  21. for(i,0,xsect-2)
  22.  .x1=xmin+i*xstep
  23.  .x2=x1+xstep
  24.  for(j,0,ysect-2)
  25.   .y1=ymin+j*ystep
  26.   .y2=y1+ystep
  27.   addface(buffer,x1,y1,z,x2,y1,z,x2,y2,z)
  28.   addface(buffer,x1,y1,z,x1,y2,z,x2,y2,z)
  29.  end
  30. end
  31.  
  32. ;merge the points and edges
  33. merge(buffer)
  34.  
  35. ;show the generated object
  36. set(rotx,138)
  37. set(rotz,330)
  38. set(zoom,1.2)
  39. window(buffer)
  40.  
  41. copy(buffer,buffer2)
  42.  
  43. ;calculate the center
  44. pcount(buffer2)
  45. .cx=0
  46. .cy=0
  47. .cz=0
  48. for(i,0,pcount-1)
  49.  getpoint(buffer2,i)
  50.  .cx=cx+px
  51.  .cy=cy+py
  52.  .cz=cz+pz
  53. end
  54. .cx=cx/pcount
  55. .cy=cy/pcount
  56. .cz=cz/pcount
  57. ;show the result
  58. echo(----> centerX=,cx)
  59. echo(----> centerY=,cy)
  60. echo(----> centerZ=,cz)
  61.  
  62. ;deform it
  63. for(i,0,pcount-1)
  64.  getpoint(buffer2,i)
  65.  .dx=px-cx
  66.  .dy=py-cy
  67.  .dz=pz-cz
  68.  .pz=cz+(dx*dx+dy*dy+dz*dz)*0.01+(rnd(10)+1)*0.5
  69.  setpoint(buffer2,i,px,py,pz)
  70. end
  71.  
  72. ;show it
  73. window(buffer2)
  74. windowpos(2,width+10,11)
  75. for(i,1,10)
  76.  windowrotx(2,-12)
  77.  windowrotz(2,6)
  78. end
  79.  
  80. ;exit
  81. request("Exit",Yes,Yes)
  82.