home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / animate / thresh / blbmv2.inc < prev    next >
Encoding:
Text File  |  1994-12-31  |  7.4 KB  |  246 lines

  1. if (frame == start_frame) {
  2.    // Set the initial position and velocity of each blob component
  3.    static define px0  0
  4.    static define py0  0
  5.    static define vx0 0.5 * brownian(<0, 0, 0>, 1)[0]
  6.    static define vy0 0.5 * brownian(<0, 0, 0>, 1)[1]
  7.  
  8.    static define px1  0
  9.    static define py1  0
  10.    static define vx1 0.5 * brownian(<0, 0, 0>, 1)[0]
  11.    static define vy1 0.5 * brownian(<0, 0, 0>, 1)[1]
  12.  
  13.    static define px2  0
  14.    static define py2  0
  15.    static define vx2 0.5 * brownian(<0, 0, 0>, 1)[0]
  16.    static define vy2 0.5 * brownian(<0, 0, 0>, 1)[1]
  17.  
  18.    static define px3  0
  19.    static define py3  0
  20.    static define vx3 0.5 * brownian(<0, 0, 0>, 1)[0]
  21.    static define vy3 0.5 * brownian(<0, 0, 0>, 1)[1]
  22.  
  23.    static define px4  0
  24.    static define py4  0
  25.    static define vx4 0.5 * brownian(<0, 0, 0>, 1)[0]
  26.    static define vy4 0.5 * brownian(<0, 0, 0>, 1)[1]
  27.  
  28.    static define px5  0
  29.    static define py5  0
  30.    static define vx5 0.5 * brownian(<0, 0, 0>, 1)[0]
  31.    static define vy5 0.5 * brownian(<0, 0, 0>, 1)[1]
  32.  
  33.    static define px6  0
  34.    static define py6  0
  35.    static define vx6 0.5 * brownian(<0, 0, 0>, 1)[0]
  36.    static define vy6 0.5 * brownian(<0, 0, 0>, 1)[1]
  37.  
  38.    static define px7  0
  39.    static define py7  0
  40.    static define vx7 0.5 * brownian(<0, 0, 0>, 1)[0]
  41.    static define vy7 0.5 * brownian(<0, 0, 0>, 1)[1]
  42.  
  43.    static define px8  0
  44.    static define py8  0
  45.    static define vx8 0.5 * brownian(<0, 0, 0>, 1)[0]
  46.    static define vy8 0.5 * brownian(<0, 0, 0>, 1)[1]
  47.  
  48.    static define px9  0
  49.    static define py9  0
  50.    static define vx9 0.5 * brownian(<0, 0, 0>, 1)[0]
  51.    static define vy9 0.5 * brownian(<0, 0, 0>, 1)[1]
  52.    }
  53. else {
  54.    // Recalculate the positions and velocities of each component
  55.  
  56.    static define px0 px0 + vx0
  57.    if (px0 > bwidth) {
  58.       static define px0 2 * bwidth - px0
  59.       static define vx0 -vx0 + rbounce
  60.       }
  61.    else if (px0 < -bwidth)  {
  62.       static define px0 -2 * bwidth - px0
  63.       static define vx0 -vx0 + rbounce
  64.       }
  65.    static define py0 py0 + vy0
  66.    if (py0 > bheight) {
  67.       static define py0 2 * bheight - py0
  68.       static define vy0 max(min(-vy0 + rbounce, 1), -1)
  69.       }
  70.    else if (py0 < -bheight) {
  71.       static define py0 -2 * bheight - py0
  72.       static define vy0 max(min(-vy0 + rbounce, 1), -1)
  73.       }
  74.  
  75.    static define px1 px1 + vx1
  76.    if (px1 > bwidth) {
  77.       static define px1 2 * bwidth - px1
  78.       static define vx1 -vx1 + rbounce
  79.       }
  80.    else if (px1 < -bwidth)  {
  81.       static define px1 -2 * bwidth - px1
  82.       static define vx1 -vx1 + rbounce
  83.       }
  84.    static define py1 py1 + vy1
  85.    if (py1 > bheight) {
  86.       static define py1 2 * bheight - py1
  87.       static define vy1 max(min(-vy1 + rbounce, 1), -1)
  88.       }
  89.    else if (py1 < -bheight) {
  90.       static define py1 -2 * bheight - py1
  91.       static define vy1 max(min(-vy1 + rbounce, 1), -1)
  92.       }
  93.  
  94.    static define px2 px2 + vx2
  95.    if (px2 > bwidth) {
  96.       static define px2 2 * bwidth - px2
  97.       static define vx2 -vx2 + rbounce
  98.       }
  99.    else if (px2 < -bwidth)  {
  100.       static define px2 -2 * bwidth - px2
  101.       static define vx2 -vx2 + rbounce
  102.       }
  103.    static define py2 py2 + vy2
  104.    if (py2 > bheight) {
  105.       static define py2 2 * bheight - py2
  106.       static define vy2 max(min(-vy2 + rbounce, 1), -1)
  107.       }
  108.    else if (py2 < -bheight) {
  109.       static define py2 -2 * bheight - py2
  110.       static define vy2 max(min(-vy2 + rbounce, 1), -1)
  111.       }
  112.  
  113.    static define px3 px3 + vx3
  114.    if (px3 > bwidth) {
  115.       static define px3 2 * bwidth - px3
  116.       static define vx3 -vx3 + rbounce
  117.       }
  118.    else if (px3 < -bwidth)  {
  119.       static define px3 -2 * bwidth - px3
  120.       static define vx3 -vx3 + rbounce
  121.       }
  122.    static define py3 py3 + vy3
  123.    if (py3 > bheight) {
  124.       static define py3 2 * bheight - py3
  125.       static define vy3 max(min(-vy3 + rbounce, 1), -1)
  126.       }
  127.    else if (py3 < -bheight) {
  128.       static define py3 -2 * bheight - py3
  129.       static define vy3 max(min(-vy3 + rbounce, 1), -1)
  130.       }
  131.  
  132.    static define px4 px4 + vx4
  133.    if (px4 > bwidth) {
  134.       static define px4 2 * bwidth - px4
  135.       static define vx4 -vx4 + rbounce
  136.       }
  137.    else if (px4 < -bwidth)  {
  138.       static define px4 -2 * bwidth - px4
  139.       static define vx4 -vx4 + rbounce
  140.       }
  141.    static define py4 py4 + vy4
  142.    if (py4 > bheight) {
  143.       static define py4 2 * bheight - py4
  144.       static define vy4 max(min(-vy4 + rbounce, 1), -1)
  145.       }
  146.    else if (py4 < -bheight) {
  147.       static define py4 -2 * bheight - py4
  148.       static define vy4 max(min(-vy4 + rbounce, 1), -1)
  149.       }
  150.  
  151.    static define px5 px5 + vx5
  152.    if (px5 > bwidth) {
  153.       static define px5 2 * bwidth - px5
  154.       static define vx5 -vx5 + rbounce
  155.       }
  156.    else if (px5 < -bwidth)  {
  157.       static define px5 -2 * bwidth - px5
  158.       static define vx5 -vx5 + rbounce
  159.       }
  160.    static define py5 py5 + vy5
  161.    if (py5 > bheight) {
  162.       static define py5 2 * bheight - py5
  163.       static define vy5 max(min(-vy5 + rbounce, 1), -1)
  164.       }
  165.    else if (py5 < -bheight) {
  166.       static define py5 -2 * bheight - py5
  167.       static define vy5 max(min(-vy5 + rbounce, 1), -1)
  168.       }
  169.  
  170.    static define px6 px6 + vx6
  171.    if (px6 > bwidth) {
  172.       static define px6 2 * bwidth - px6
  173.       static define vx6 -vx6 + rbounce
  174.       }
  175.    else if (px6 < -bwidth)  {
  176.       static define px6 -2 * bwidth - px6
  177.       static define vx6 -vx6 + rbounce
  178.       }
  179.    static define py6 py6 + vy6
  180.    if (py6 > bheight) {
  181.       static define py6 2 * bheight - py6
  182.       static define vy6 max(min(-vy6 + rbounce, 1), -1)
  183.       }
  184.    else if (py6 < -bheight) {
  185.       static define py6 -2 * bheight - py6
  186.       static define vy6 max(min(-vy6 + rbounce, 1), -1)
  187.       }
  188.  
  189.    static define px7 px7 + vx7
  190.    if (px7 > bwidth) {
  191.       static define px7 2 * bwidth - px7
  192.       static define vx7 -vx7 + rbounce
  193.       }
  194.    else if (px7 < -bwidth)  {
  195.       static define px7 -2 * bwidth - px7
  196.       static define vx7 -vx7 + rbounce
  197.       }
  198.    static define py7 py7 + vy7
  199.    if (py7 > bheight) {
  200.       static define py7 2 * bheight - py7
  201.       static define vy7 max(min(-vy7 + rbounce, 1), -1)
  202.       }
  203.    else if (py7 < -bheight) {
  204.       static define py7 -2 * bheight - py7
  205.       static define vy7 max(min(-vy7 + rbounce, 1), -1)
  206.       }
  207.  
  208.    static define px8 px8 + vx8
  209.    if (px8 > bwidth) {
  210.       static define px8 2 * bwidth - px8
  211.       static define vx8 -vx8 + rbounce
  212.       }
  213.    else if (px8 < -bwidth)  {
  214.       static define px8 -2 * bwidth - px8
  215.       static define vx8 -vx8 + rbounce
  216.       }
  217.    static define py8 py8 + vy8
  218.    if (py8 > bheight) {
  219.       static define py8 2 * bheight - py8
  220.       static define vy8 max(min(-vy8 + rbounce, 1), -1)
  221.       }
  222.    else if (py8 < -bheight) {
  223.       static define py8 -2 * bheight - py8
  224.       static define vy8 max(min(-vy8 + rbounce, 1), -1)
  225.       }
  226.  
  227.    static define px9 px9 + vx9
  228.    if (px9 > bwidth) {
  229.       static define px9 2 * bwidth - px9
  230.       static define vx9 -vx9 + rbounce
  231.       }
  232.    else if (px9 < -bwidth)  {
  233.       static define px9 -2 * bwidth - px9
  234.       static define vx9 -vx9 + rbounce
  235.       }
  236.    static define py9 py9 + vy9
  237.    if (py9 > bheight) {
  238.       static define py9 2 * bheight - py9
  239.       static define vy9 max(min(-vy9 + rbounce, 1), -1)
  240.       }
  241.    else if (py9 < -bheight) {
  242.       static define py9 -2 * bheight - py9
  243.       static define vy9 max(min(-vy9 + rbounce, 1), -1)
  244.       }
  245.    }
  246.