Home » Archimedes archive » Acorn User » AU 1994-02.adf » !FEMS_App_FEMS_App » sims/cloth/ClothLong

sims/cloth/ClothLong

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1994-02.adf » !FEMS_App_FEMS_App
Filename: sims/cloth/ClothLong
Read OK:
File size: 0603 bytes
Load address: 0000
Exec address: 0000
File contents
FEMS2
/* simulation definition file to drop a cloth on a sphere */
/* long-range bonding: compare with ClothSpher and ClothShort */

/* select output style */
rendering {
 type dots             /* draw scene with dots: "lines" takes more memory */
 resolution 320,256    /* use a 320 x 256 pixel screen mode */
 view -30,24           /* viewpoint: x-y rotation, elevation in degrees */
}

/* simulation parameters */
frame_aim 640          /* pause after 640 frames */
gravity 0,0,-600       /* set direction and strength of gravity */
time_div 1             /* time step division: 1 is fastest, larger values
                          (use 2,4,8, etc.) make objects stiffer */

/* create the cloth */
solid {   
 /* first create the object... */
 create {
  type sheet
  points 21            /* 21 points on each side, making 20 x 20 squares */
  size 16.3in          /* this sets the size of the cloth */
 }
 /* ...then join the points together */
 nearbonds {
  spring_const 40      /* this sets the strength of the springs */
  range 3.1            /* connect all points within 3.1 times the side
                          length of the squares */
 }
 damping 3
 translate 0,0,6.9in   /* move the cloth up */
}

/* create the sphere */
background {
 create {
  type sphere
  points 12            /* this sets the number of points used to draw the
                          sphere: 12 means 24 round the circumference */
  size 3.3in           /* this is the radius of the sphere */
 }
 translate 0,0,3.3in   /* move the sphere up */
}
00000000  46 45 4d 53 32 0a 2f 2a  20 73 69 6d 75 6c 61 74  |FEMS2./* simulat|
00000010  69 6f 6e 20 64 65 66 69  6e 69 74 69 6f 6e 20 66  |ion definition f|
00000020  69 6c 65 20 74 6f 20 64  72 6f 70 20 61 20 63 6c  |ile to drop a cl|
00000030  6f 74 68 20 6f 6e 20 61  20 73 70 68 65 72 65 20  |oth on a sphere |
00000040  2a 2f 0a 2f 2a 20 6c 6f  6e 67 2d 72 61 6e 67 65  |*/./* long-range|
00000050  20 62 6f 6e 64 69 6e 67  3a 20 63 6f 6d 70 61 72  | bonding: compar|
00000060  65 20 77 69 74 68 20 43  6c 6f 74 68 53 70 68 65  |e with ClothSphe|
00000070  72 20 61 6e 64 20 43 6c  6f 74 68 53 68 6f 72 74  |r and ClothShort|
00000080  20 2a 2f 0a 0a 2f 2a 20  73 65 6c 65 63 74 20 6f  | */../* select o|
00000090  75 74 70 75 74 20 73 74  79 6c 65 20 2a 2f 0a 72  |utput style */.r|
000000a0  65 6e 64 65 72 69 6e 67  20 7b 0a 20 74 79 70 65  |endering {. type|
000000b0  20 64 6f 74 73 20 20 20  20 20 20 20 20 20 20 20  | dots           |
000000c0  20 20 2f 2a 20 64 72 61  77 20 73 63 65 6e 65 20  |  /* draw scene |
000000d0  77 69 74 68 20 64 6f 74  73 3a 20 22 6c 69 6e 65  |with dots: "line|
000000e0  73 22 20 74 61 6b 65 73  20 6d 6f 72 65 20 6d 65  |s" takes more me|
000000f0  6d 6f 72 79 20 2a 2f 0a  20 72 65 73 6f 6c 75 74  |mory */. resolut|
00000100  69 6f 6e 20 33 32 30 2c  32 35 36 20 20 20 20 2f  |ion 320,256    /|
00000110  2a 20 75 73 65 20 61 20  33 32 30 20 78 20 32 35  |* use a 320 x 25|
00000120  36 20 70 69 78 65 6c 20  73 63 72 65 65 6e 20 6d  |6 pixel screen m|
00000130  6f 64 65 20 2a 2f 0a 20  76 69 65 77 20 2d 33 30  |ode */. view -30|
00000140  2c 32 34 20 20 20 20 20  20 20 20 20 20 20 2f 2a  |,24           /*|
00000150  20 76 69 65 77 70 6f 69  6e 74 3a 20 78 2d 79 20  | viewpoint: x-y |
00000160  72 6f 74 61 74 69 6f 6e  2c 20 65 6c 65 76 61 74  |rotation, elevat|
00000170  69 6f 6e 20 69 6e 20 64  65 67 72 65 65 73 20 2a  |ion in degrees *|
00000180  2f 0a 7d 0a 0a 2f 2a 20  73 69 6d 75 6c 61 74 69  |/.}../* simulati|
00000190  6f 6e 20 70 61 72 61 6d  65 74 65 72 73 20 2a 2f  |on parameters */|
000001a0  0a 66 72 61 6d 65 5f 61  69 6d 20 36 34 30 20 20  |.frame_aim 640  |
000001b0  20 20 20 20 20 20 20 20  2f 2a 20 70 61 75 73 65  |        /* pause|
000001c0  20 61 66 74 65 72 20 36  34 30 20 66 72 61 6d 65  | after 640 frame|
000001d0  73 20 2a 2f 0a 67 72 61  76 69 74 79 20 30 2c 30  |s */.gravity 0,0|
000001e0  2c 2d 36 30 30 20 20 20  20 20 20 20 2f 2a 20 73  |,-600       /* s|
000001f0  65 74 20 64 69 72 65 63  74 69 6f 6e 20 61 6e 64  |et direction and|
00000200  20 73 74 72 65 6e 67 74  68 20 6f 66 20 67 72 61  | strength of gra|
00000210  76 69 74 79 20 2a 2f 0a  74 69 6d 65 5f 64 69 76  |vity */.time_div|
00000220  20 31 20 20 20 20 20 20  20 20 20 20 20 20 20 2f  | 1             /|
00000230  2a 20 74 69 6d 65 20 73  74 65 70 20 64 69 76 69  |* time step divi|
00000240  73 69 6f 6e 3a 20 31 20  69 73 20 66 61 73 74 65  |sion: 1 is faste|
00000250  73 74 2c 20 6c 61 72 67  65 72 20 76 61 6c 75 65  |st, larger value|
00000260  73 0a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |s.              |
00000270  20 20 20 20 20 20 20 20  20 20 20 20 28 75 73 65  |            (use|
00000280  20 32 2c 34 2c 38 2c 20  65 74 63 2e 29 20 6d 61  | 2,4,8, etc.) ma|
00000290  6b 65 20 6f 62 6a 65 63  74 73 20 73 74 69 66 66  |ke objects stiff|
000002a0  65 72 20 2a 2f 0a 0a 2f  2a 20 63 72 65 61 74 65  |er */../* create|
000002b0  20 74 68 65 20 63 6c 6f  74 68 20 2a 2f 0a 73 6f  | the cloth */.so|
000002c0  6c 69 64 20 7b 20 20 20  0a 20 2f 2a 20 66 69 72  |lid {   . /* fir|
000002d0  73 74 20 63 72 65 61 74  65 20 74 68 65 20 6f 62  |st create the ob|
000002e0  6a 65 63 74 2e 2e 2e 20  2a 2f 0a 20 63 72 65 61  |ject... */. crea|
000002f0  74 65 20 7b 0a 20 20 74  79 70 65 20 73 68 65 65  |te {.  type shee|
00000300  74 0a 20 20 70 6f 69 6e  74 73 20 32 31 20 20 20  |t.  points 21   |
00000310  20 20 20 20 20 20 20 20  20 2f 2a 20 32 31 20 70  |         /* 21 p|
00000320  6f 69 6e 74 73 20 6f 6e  20 65 61 63 68 20 73 69  |oints on each si|
00000330  64 65 2c 20 6d 61 6b 69  6e 67 20 32 30 20 78 20  |de, making 20 x |
00000340  32 30 20 73 71 75 61 72  65 73 20 2a 2f 0a 20 20  |20 squares */.  |
00000350  73 69 7a 65 20 31 36 2e  33 69 6e 20 20 20 20 20  |size 16.3in     |
00000360  20 20 20 20 20 2f 2a 20  74 68 69 73 20 73 65 74  |     /* this set|
00000370  73 20 74 68 65 20 73 69  7a 65 20 6f 66 20 74 68  |s the size of th|
00000380  65 20 63 6c 6f 74 68 20  2a 2f 0a 20 7d 0a 20 2f  |e cloth */. }. /|
00000390  2a 20 2e 2e 2e 74 68 65  6e 20 6a 6f 69 6e 20 74  |* ...then join t|
000003a0  68 65 20 70 6f 69 6e 74  73 20 74 6f 67 65 74 68  |he points togeth|
000003b0  65 72 20 2a 2f 0a 20 6e  65 61 72 62 6f 6e 64 73  |er */. nearbonds|
000003c0  20 7b 0a 20 20 73 70 72  69 6e 67 5f 63 6f 6e 73  | {.  spring_cons|
000003d0  74 20 34 30 20 20 20 20  20 20 2f 2a 20 74 68 69  |t 40      /* thi|
000003e0  73 20 73 65 74 73 20 74  68 65 20 73 74 72 65 6e  |s sets the stren|
000003f0  67 74 68 20 6f 66 20 74  68 65 20 73 70 72 69 6e  |gth of the sprin|
00000400  67 73 20 2a 2f 0a 20 20  72 61 6e 67 65 20 33 2e  |gs */.  range 3.|
00000410  31 20 20 20 20 20 20 20  20 20 20 20 20 2f 2a 20  |1            /* |
00000420  63 6f 6e 6e 65 63 74 20  61 6c 6c 20 70 6f 69 6e  |connect all poin|
00000430  74 73 20 77 69 74 68 69  6e 20 33 2e 31 20 74 69  |ts within 3.1 ti|
00000440  6d 65 73 20 74 68 65 20  73 69 64 65 0a 20 20 20  |mes the side.   |
00000450  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000460  20 20 20 20 20 20 20 6c  65 6e 67 74 68 20 6f 66  |       length of|
00000470  20 74 68 65 20 73 71 75  61 72 65 73 20 2a 2f 0a  | the squares */.|
00000480  20 7d 0a 20 64 61 6d 70  69 6e 67 20 33 0a 20 74  | }. damping 3. t|
00000490  72 61 6e 73 6c 61 74 65  20 30 2c 30 2c 36 2e 39  |ranslate 0,0,6.9|
000004a0  69 6e 20 20 20 2f 2a 20  6d 6f 76 65 20 74 68 65  |in   /* move the|
000004b0  20 63 6c 6f 74 68 20 75  70 20 2a 2f 0a 7d 0a 0a  | cloth up */.}..|
000004c0  2f 2a 20 63 72 65 61 74  65 20 74 68 65 20 73 70  |/* create the sp|
000004d0  68 65 72 65 20 2a 2f 0a  62 61 63 6b 67 72 6f 75  |here */.backgrou|
000004e0  6e 64 20 7b 0a 20 63 72  65 61 74 65 20 7b 0a 20  |nd {. create {. |
000004f0  20 74 79 70 65 20 73 70  68 65 72 65 0a 20 20 70  | type sphere.  p|
00000500  6f 69 6e 74 73 20 31 32  20 20 20 20 20 20 20 20  |oints 12        |
00000510  20 20 20 20 2f 2a 20 74  68 69 73 20 73 65 74 73  |    /* this sets|
00000520  20 74 68 65 20 6e 75 6d  62 65 72 20 6f 66 20 70  | the number of p|
00000530  6f 69 6e 74 73 20 75 73  65 64 20 74 6f 20 64 72  |oints used to dr|
00000540  61 77 20 74 68 65 0a 20  20 20 20 20 20 20 20 20  |aw the.         |
00000550  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000560  20 73 70 68 65 72 65 3a  20 31 32 20 6d 65 61 6e  | sphere: 12 mean|
00000570  73 20 32 34 20 72 6f 75  6e 64 20 74 68 65 20 63  |s 24 round the c|
00000580  69 72 63 75 6d 66 65 72  65 6e 63 65 20 2a 2f 0a  |ircumference */.|
00000590  20 20 73 69 7a 65 20 33  2e 33 69 6e 20 20 20 20  |  size 3.3in    |
000005a0  20 20 20 20 20 20 20 2f  2a 20 74 68 69 73 20 69  |       /* this i|
000005b0  73 20 74 68 65 20 72 61  64 69 75 73 20 6f 66 20  |s the radius of |
000005c0  74 68 65 20 73 70 68 65  72 65 20 2a 2f 0a 20 7d  |the sphere */. }|
000005d0  0a 20 74 72 61 6e 73 6c  61 74 65 20 30 2c 30 2c  |. translate 0,0,|
000005e0  33 2e 33 69 6e 20 20 20  2f 2a 20 6d 6f 76 65 20  |3.3in   /* move |
000005f0  74 68 65 20 73 70 68 65  72 65 20 75 70 20 2a 2f  |the sphere up */|
00000600  0a 7d 0a                                          |.}.|
00000603