home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume19 / xspringies / part01 next >
Encoding:
Text File  |  1993-04-28  |  25.2 KB  |  800 lines

  1. Newsgroups: comp.sources.x
  2. From: dmd@gradient.cis.upenn.edu (Douglas DeCarlo)
  3. Subject: v19i053:  xspringies - it's a spring simulator...no, it's a game, Part01/16
  4. Message-ID: <csx-v19i053=xspringies.100951@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 91231db94a3805150dbe4606535765d5
  6. Date: Fri, 26 Mar 1993 16:11:24 GMT
  7. Approved: chris@sparky.imd.sterling.com
  8.  
  9. Submitted-by: dmd@gradient.cis.upenn.edu (Douglas DeCarlo)
  10. Posting-number: Volume 19, Issue 53
  11. Archive-name: xspringies/part01
  12. Environment: X11
  13. Supersedes: xspringies: Volume 14, Issue 25-30
  14.  
  15. README file for XSpringies 1.1                                    March 1, 1993
  16. ==============================
  17.  
  18. General info:
  19. -------------
  20.   XSpringies is a mass and spring simulation system.  It's intended use is more
  21. like that of a game, than some design package.
  22.  
  23.   It's written using Xlib only.  No Motif or any other widgets sets are used.
  24.  
  25.   The animation in XSpringies is done using an off-screen Pixmap.  The next
  26. frame is drawn on this pixmap, then is blitted onto the screen.  Since the
  27. frame rate is about 30 frames per second, slower machines (or machines which
  28. have poorly written bit-blitting code) will be deathly slow and blinky.
  29.  
  30. Installation info:
  31. ------------------
  32. First, edit the Imakefile/Makefile.std and change the value of DDIR to reflect
  33. where you want to install the xspringies files.  Don't forget the trailing /
  34. on the end of your filename.
  35.  
  36. If you are using the Imakefile, type "xmkmf".
  37.  
  38.     If you have problems at the beginning, and you are using the
  39.     Imakefile, it might be caused by the strange definition I have for
  40.     "MKDIRHIER", which I had to redefine because of the silly way Imake
  41.     is set up.  If this happens, type "which mkdirhier" to see what the
  42.     full path for mkdirhier is, and put this in place of the backquoted
  43.     expression in the Imakefile. (i.e. - if the full path is
  44.     "/usr/local/bin/mkdirhier", then you change the line to
  45.     "MKDIRHIER = BourneShell /usr/local/bin/mkdirhier").
  46.  
  47. Then, type "make install".
  48.  
  49. Then, just run xspringies and have fun.
  50.  
  51. Updates
  52. -------
  53. For version 1.1:
  54.  Bugs fixed:
  55.  - Compiles for NEWS system
  56.  - Keyboard input now works under openlook window manager
  57.  - Animation no longer gets 'stuck' after like 35 minutes
  58.  - File format is more compact by removing unnecessary zeros
  59.    (i.e. - before 1.500000, now 1.5) and has more precision to eliminate
  60.    tiny errors perceived when saving and reloading a file
  61.  - Strange ~-expansion behavior for filenames is gone
  62.  - The GO! button replaces the hard to find Action checkbox
  63.  - A Delete button was added, which is the same as the Delete key
  64.  
  65.  New features:
  66.  - Spring thickness can be specified using the "-st <number>" command
  67.    line switch (0 is default width - thin line)
  68.  - Instead of the entire screen being bit-blitted, only the bounding box
  69.    necessary to draw new objects and cover old objects is drawn.  This
  70.    greatly speeds up the animation when drawing small objects (such as
  71.    a "jello").  If the bounding box changes size periodically (as in the
  72.    "pendbees" file), the "-nbb" command line switch disables this feature
  73.    to allow for slower, but smoother animation.
  74.  - A cursor, and filename editing features were added.  It uses emacs-like
  75.    keys:
  76.       ^B/^F = back/forward
  77.       ^A/^E = goto beginning/end of line
  78.       ^K/^Y = kill to end of line/yank from kill buffer
  79.       ^D    = delete character under cursor
  80.       ^U    = kill all input
  81.       ^T    = transpose character under cursor with previous character
  82.       ESC   = exit from filename edit mode
  83.  
  84. Misc info:
  85. ----------
  86.   The author of xspringies is Douglas DeCarlo.
  87.   Email address:  dmd@gradient.cis.upenn.edu
  88.   Please send any bug-reports/comments/suggestions/demo-files to this address.
  89. #!/bin/sh
  90. # to extract, remove the header and type "sh filename"
  91. if `test ! -s ./xspringies.man`
  92. then
  93. echo "writting ./xspringies.man"
  94. cat > ./xspringies.man << '\BARFOO\'
  95. .TH XSPRINGIES 1 "September 1, 1992"
  96. .SH NAME
  97. xspringies \- a mass and spring simulation system for X windows
  98. .SH SYNTAX
  99. \fBxspringies\fP [ \fIoptions\fP ]
  100. .SH DESCRIPTION
  101. .B xspringies
  102. is a simulator which allows you to interactively create and edit a
  103. system of masses and springs.  The parameters of the masses and springs (such
  104. as mass elasticity and spring K) as well as those of the surrounding system
  105. (such as air viscosity and gravity) can be changed.
  106. .sp 0
  107. These systems can be loaded and saved into a file.
  108. .sp 1
  109. I guess you could use
  110. .B xspringies
  111. for real work, but it's really intended to
  112. be a time waster.
  113. .SH OPTIONS
  114. .IP "\-bg \fIcolor\fP"
  115. Specifies the color of the window background.  The default is black.
  116. .IP "\-d \fIdispname\fP"
  117. Specifies the display screen on which \fBxspringies\fP displays its window.
  118. If the display option is not specified, \fBxspringies\fP uses the display
  119. screen specified by your DISPLAY environment variable.
  120. .IP "\-display \fIdispname\fP"
  121. This option is the same as the \fB\-d\fP option.
  122. .IP "\-fg \fIcolor\fP"
  123. Specifies the foreground color of the window.  The default is white.
  124. .IP "\-geometry \fIgeom\fR"
  125. Specifies the width, height, and location of
  126. the
  127. .B xspringies
  128. window.
  129. If the geometry option is not specified,
  130. .B xspringies
  131. uses default values.
  132. The geometry option has the format
  133. .sp 0
  134. .in +0.5i
  135. [=][\fIwidth\fRx\fIheight\fR][+/-\fIxoffset\fR+/-\fIyoffset\fR].
  136. .in -0.5i
  137. .IP \-nbb
  138. This option turns off the bounding-box optimization.
  139. To produce smooth animation,
  140. .B xspringies
  141. redraws the smallest screen region which contains all objects.  For smaller
  142. objects, the performance improvement is very noticible -- this is the
  143. bounding-box optimization.  By disabling it with this option, 
  144. .B xspringies
  145. redraws the entire display window.  On slower machines or larger window
  146. sizes, this can produce slow results.
  147. The main reason for using this option is if the bounding-box changes
  148. size rapidly, causing uneven animation.
  149. .IP "\-hl \fIcolor\fP"
  150. Specifies the color of the button and selection highlights in the window.
  151. This defaults to the foreground color, or to green on color displays.
  152. .IP \-rv
  153. Specifies that the foreground and background colors be reversed.
  154. .IP "\-st \fIthickness\fP"
  155. Specifies the thickness of the springs in pixels (0 is the default value)
  156. .SH SUMMARY OF OPERATION
  157. .ti +2m
  158. The left side of the \fBxspringies\fR window contains the controls, and the
  159. right side contains the display.  Masses can be created and placed with the
  160. mouse when in \fBMass\fR mode, and springs can be created when in \fBSpring\fR
  161. mode.  Temporary springs that connect the mouse and any mass can be used
  162. to pull on objects.  Masses and springs can be selected in edit mode, and
  163. moved around.  Parameters of the masses and springs (such as Mass or
  164. Elasticity) can be set upon creation or if they are selected.
  165. .sp 1
  166. .ti +2m
  167. Forces (such as gravity) can be enabled by pressing the appropriate force
  168. button with customizable parameters.  Environment parameters such as viscosity
  169. of the medium and stickiness of the walls can also be set.  Each of the four
  170. walls can be disabled.
  171. .sp 1
  172. .ti +2m
  173. The animation/simulation is activated by pressing the \fBGO!\fR button.
  174. .sp 1
  175. .ti +2m
  176. The entire system (masses, springs and parameters) can be loaded and saved to
  177. files.  \fBXspringies\fR comes with many demonstration files.
  178.  
  179. .SH CONTROLS
  180. .ti +2m
  181. There are three types of controls (widgets) in \fBxspringies\fR.  There
  182. are push buttons, checkboxes and sliders.  The push buttons and checkboxes
  183. act in the obvious manner.  If you click on them, they get activated.
  184. .sp 1
  185. .ti +2m
  186. Sliders are a little more compilicated.  They consist of a left arrow button,
  187. a right arrow button, and a text box.  The text box displays the current value.
  188. Clicking on this text box causes it to become highlighted.  All text input
  189. then goes to the text box.  After entering a value, return accepts it, and
  190. escape cancels.
  191. .sp 0
  192. .ti +2m
  193. The value displayed can also be changed by pressing the arrow buttons.
  194. Using the
  195. .I Left mouse button
  196. causes the value to be incremented or decremented by one step.  The
  197. .I Middle mouse button
  198. is the same as the left mouse button, but holding it down causes it to scan
  199. by one step at a time.  The
  200. .I Right mouse button
  201. scans like the
  202. .I Middle mouse button
  203. except that it scans 10 steps at a time.
  204.  
  205. .SH EDITING MODES
  206. .ti +2m
  207. There are three main modes in \fBxspringies\fR.
  208. These are
  209. .I Edit,
  210. .I Mass
  211. and
  212. .I Spring.
  213. In
  214. .I Edit
  215. mode, you can select, move and throw objects.  In
  216. .I Mass
  217. mode, you can create masses.  In
  218. .I Spring
  219. mode, you can create springs and tug on an object with a spring
  220. connected to the mouse.
  221.  
  222. More specifically,
  223. .IP "\fIEdit\fR \fBmode:\fB"
  224. \fB-\fR
  225. .I Left mouse button
  226. selects objects.
  227. .sp 0
  228. .ti +2m
  229. If you click on or near an object, it becomes selected, and all other
  230. objects become unselected. If you hold down shift while clicking, the object
  231. becomes selected (or unselected if it was already selected), and all other
  232. objects remain the same.
  233. .sp 0
  234. .ti +2m
  235. If you do not click near an object, dragging the mouse causes a selection box
  236. to appear.  Anything within the selection box when the mouse is released 
  237. becomes selected.  All other masses become unselected, unless the shift
  238. key was held down for the initial click.
  239. .sp 1
  240. \fB-\fR
  241. .I Middle mouse button
  242. moves objects.
  243. .sp 0
  244. .ti +2m
  245. All selected objects move with the mouse.  The masses are frozen in their
  246. positions after the initial click.  They continue to move relative to the
  247. mouse movement until the middle button is released.
  248. .sp 1
  249. \fB-\fR
  250. .I Right mouse button
  251. throws objects.
  252. .sp 0
  253. .ti +2m
  254. This acts the same way as moving objects with the middle button, except for
  255. the fact that the mouse velocity is transferred to all selected objects when
  256. the right mouse button is released.
  257. .sp 0
  258. .ti +2m
  259. Note: a good way to stop an object from moving is to simply select it and
  260. click the right mouse button.
  261. .IP "\fIMass\fR \fBmode:\fB"
  262. .ti +2m
  263. When you click with the mouse, a mass appears.  The mass takes on the values
  264. of the
  265. .I Mass
  266. and
  267. .I Elasticity
  268. sliders.  The mass is placed when the mouse
  269. button is released.
  270. .IP "\fISpring\fR \fBmode:\fB"
  271. .ti +2m
  272. When you click with the mouse, if there is a mass nearby, one end of a
  273. spring is connected to it.  The other end of the spring is connected to the
  274. cursor until the mouse button is released.  If no mass is nearby when the
  275. spring is released, the spring is discarded.  The new spring takes on the
  276. values of the
  277. .I Kspring
  278. and
  279. .I Kdamp
  280. sliders.  The rest length of the spring is
  281. equal to the length of the spring when it was created.
  282. .sp 1
  283. \fB-\fR
  284. .I Left mouse button
  285. adds a spring between two masses while actively affecting the first mass.
  286. .sp 1
  287. \fB-\fR
  288. .I Middle mouse button
  289. adds a spring between the first mass and the cursor, actively affecting
  290. the first mass.  The spring is discarded when the mouse button
  291. is released.
  292. .sp 1
  293. \fB-\fR
  294. .I Right mouse button
  295. adds a spring between two masses.  The first mass is not affected by the
  296. spring until the spring is in place after the mouse is released.
  297.  
  298. .SH OPERATION
  299. .IP "Masses and Springs"
  300. .ti +2m
  301. Accelerations on the masses are calculated according to gravity (and other
  302. special forces), viscous forces, and by forces from the springs.  When a mass
  303. collides with a wall, its velocity in the direction of the wall is reversed.
  304. The resulting velocity is multipled by the
  305. .I Elasticity
  306. of the mass.  So, an
  307. elasticity of 0.0 causes an inelastic collision (it stops on the wall),
  308. and an elasticity of 1.0 results in an elastic collision.
  309. .sp 0
  310. .ti +2m
  311. If a mass is fixed, all forces on it are ignored.  It simply does not move.
  312. Think of it as a nail (a really good one).
  313. .sp 0
  314. .ti +2m
  315. The
  316. .I Mass
  317. and
  318. .I Elasticity
  319. of a mass can be changed by selecting the mass and
  320. changing the values on the corresponding sliders.  To make a mass fixed or
  321. unfixed, check or uncheck the
  322. .I Fixed Mass
  323. checkbox while the mass is selected.
  324. .sp 1
  325. .ti +2m
  326. A spring has three parameters associated with it.  \fIKspring\fR, \fIKdamp\fR
  327. and rest length.  The spring force is calculated as follows (according to
  328. Hooke's law):
  329. .sp 0
  330. .in +10m
  331. .ti -4m
  332. \fBF\fR = - \fIKspring\fR * (length - rest length) - \fIKdamp\fR *
  333. (velocity in spring direction)
  334. .in -10m
  335. .sp 1
  336. .ti +2m
  337. To change the
  338. .I Kspring
  339. or
  340. .I Kdamp
  341. of a spring, change the values of the sliders
  342. when the spring is selected.  Pressing the
  343. .I Set Rest Length
  344. button changes the rest length of a selected spring to its current length.
  345.  
  346. .IP "Forces and sticky stuff"
  347. .ti +2m
  348. There are four special forces.  They can be turned on and off by clicking
  349. their appropriate box.  When highlighted, the force is on.
  350. Each of these forces has two parameters associated with it (for example,
  351. .I Magnitude
  352. and
  353. .I Direction
  354. for gravity).  Only one forces's parameters are displayed at a time (below
  355. the force buttons).  Which particular force is shown by a darker box
  356. around that force.  This force selector box is moved to another force
  357. whenever a force is turned on.
  358. .sp 1
  359. .ti +2m
  360. Some of the forces are applied relative to some specified origin, or
  361. center point.  By default, this center point is the center of the screen.
  362. It can be changed to be any one particular mass by selecting a single mass,
  363. and pushing the
  364. .I Set Center
  365. button.  If no masses are selected, the current center is changed to be
  366. the center of the screen.
  367. .sp 0
  368. .ti +2m
  369. Center points are marked by a box around the center mass.
  370. .sp 1
  371. .ti +2m
  372. There are four forces that can be enabled.
  373. The first one, \fIGravity\fR, acts in the familiar manner.
  374. It accelerates masses by the value specified
  375. by
  376. .I Gravity
  377. in a direction specified by
  378. .I Direction.
  379. The
  380. .I Direction
  381. is measured in degrees, with 0.0 degrees being down, increasing
  382. counter-clockwise.
  383. .sp 0
  384. .ti +2m
  385. The second force is a bit strange, and isn't real.  Its a force which
  386. attracts the center of mass of all the objects toward the center point.
  387. It has a
  388. .I Magnitude
  389. and a
  390. .I Damping
  391. coefficient.
  392. .sp 0
  393. .ti +2m
  394. The third force is a force which attracts all masses toward the center point.
  395. This force has a
  396. .I Magnitude
  397. and an
  398. .I Exponent
  399. associated with it.  The
  400. .I Exponent
  401. is simply how the force relation works.  A value of 2.0 means inverse-square
  402. force (the force is inversely proportional to the distance squared).  A value
  403. of 0.0 is a constant force independent of position.  If the
  404. .I Magnitude
  405. of this force is negative, it becomes a repulsion force.
  406. .sp 0
  407. .ti +2m
  408. The fourth force is a wall repulsion force.  Masses are repelled by a force
  409. from each wall that is on.  This force has a
  410. .I Magnitude
  411. and
  412. .I Exponent
  413. associated with it.  The
  414. .I Exponent
  415. behaves similarly to that of the third force.
  416. .sp 1
  417. .ti +2m
  418. For the most part, most everything obeys 
  419. .I f = ma.
  420. The only exceptions are wall bounces and wall stickiness.  Another unphysical
  421. aspect is found in some of the special forces (the second and third ones).
  422. If a center point exists, that mass does not receive any force response
  423. from other masses due to the special force.  In other words, these two special
  424. forces are not \fIequal and opposite\fR forces.  They're pretty much just
  425. unreal.
  426. .sp 1
  427. .ti +2m
  428. .I Viscosity
  429. is a viscous drag force which applies a resistive force on the masses
  430. proportional to their velocity.
  431. .sp 0
  432. .ti +2m
  433. .I Stickiness
  434. is not a real force.  When a mass hits a wall, it loses part of its velocity
  435. component in the direction of the wall (in an amount proportional to the
  436. .I Stickiness).
  437. If it loses all of this component, it remains stuck to the
  438. wall.  It will remain stuck to the wall until a force (which exceeds an
  439. amount proportional to the
  440. .I Stickiness)
  441. pulls it off the wall.
  442.  
  443. .IP "Numerics"
  444. .ti +2m
  445. The internals of
  446. .B xspringies
  447. consist of a fourth order Runge-Kutta (RK4) differental equation solver.
  448. Consult a Numerical Methods text for more information.  The
  449. .I Time Step
  450. that is used by this solver (the \fBdt\fR) can be set using the slider.
  451. .sp 0
  452. .ti +2m
  453. The solver can be selectively made into an adaptive RK4 solver using the
  454. .I Adaptive Time Step
  455. checkbox.  An adaptive solver chooses the best time step value according
  456. to an error calculation.  The error is not allowed to exceed the
  457. .I Precision
  458. value.  Lower precision values result in smaller time steps.  While this
  459. is more accurate, the simulation runs slower.
  460. .sp 0
  461. .ti +2m
  462. You will notice that some objects will tend to "blow up" easily.  This is
  463. because the objects are unstable, or are sensitive to small numerical errors.
  464. An object will tend to "blow up" less with smaller time steps.
  465. By using an adaptive solver, the simulation can be made more
  466. accurate only when necessary.  This results in a more stable system which
  467. runs at a reasonable speed.
  468.  
  469. .IP "Walls"
  470. .ti +2m
  471. There are four walls.  In case you haven't guessed by now, they are the
  472. .I top, left, right
  473. and
  474. .I bottom
  475. walls.  They are located at the window boundaries; they move with
  476. window resizes.  Individual walls can be enabled and disabled by checking the
  477. corresponding
  478. .i Walls
  479. checkboxes.
  480. .sp 1
  481. .ti +2m
  482. Walls are only one-way.  An object moving from the screen toward a wall will
  483. bounce off the wall.  But an object moving from off screen toward
  484. the screen will pass through the walls.
  485.  
  486. .IP "Saving and Restoring State"
  487. .ti +2m
  488. The state of the world (at least for \fBxspringies\fR)
  489. includes all of the masses
  490. and springs, as well as the system parameters.  By pushing the
  491. .I Save State
  492. button, the current system state is saved.   By pushing the
  493. .I Restore State button
  494. the previously saved system state is restored (if no previous save was
  495. made, the initial state is used).
  496. .sp 1
  497. .ti +2m
  498. This is useful for temporarily saving a system configuration that you do
  499. not feel like setting up again (or saving to a file), that you might disturb
  500. with experimentation.  If you break it, you can
  501. .I Restore State
  502. any number of times you like.
  503. .sp 0
  504. .ti +2m
  505. The
  506. .I Reset
  507. button resets
  508. .B xspringies
  509. to its initial configuration.  All the masses and springs are removed, and
  510. the default system parameters are used.
  511.  
  512. .IP "Saving and Loading Files"
  513. .ti +2m
  514. The system state can be saved to and loaded from files.
  515. By pushing the
  516. .I Load File
  517. button, a previously saved file can be loaded.  This will load up all the
  518. masses and springs that were saved, as well as the system parameters.
  519. Any previous state before the load is cleared.  Pushing the
  520. .I Save File
  521. button saves this information in the designated file.  The
  522. .I Insert File
  523. button is much like the
  524. .I Load File
  525. button, except that the current state is not cleared.  Instead, only the
  526. masses and springs are loaded (the system paramaters are not changed), and
  527. are added to the current collection.   If no objects are selected when
  528. the
  529. .I Insert File
  530. button is pressed, then all the objects in the file are selected after they
  531. are loaded.
  532. .sp 1
  533. .ti +2m
  534. The filenames are entered in the text window, which is located at the bottom
  535. right of the window.   For consistency, the filenames should terminate
  536. with "\fB.xsp\fR".  When a file is loaded or saved, this extension is
  537. automatically added if not added by the user.
  538. Standard emacs-like editing features are present.  The following key controls
  539. can be used:
  540. .sp 0
  541. .in +1.0i
  542. .ti -0.5i
  543. \fBcontrol-B\fR  move cursor backward
  544. .sp 0
  545. .ti -0.5i
  546. \fBcontrol-F\fR  move cursor forward
  547. .sp 0
  548. .ti -0.5i
  549. \fBcontrol-A\fR  goto beginning of line
  550. .sp 0
  551. .ti -0.5i
  552. \fBcontrol-E\fR  goto end of line
  553. .sp 0
  554. .ti -0.5i
  555. \fBcontrol-K\fR  kill to end of line
  556. .sp 0
  557. .ti -0.5i
  558. \fBcontrol-Y\fR  yank from kill buffer
  559. .sp 0
  560. .ti -0.5i
  561. \fBcontrol-D\fR  delete character under cursor
  562. .sp 0
  563. .ti -0.5i
  564. \fBcontrol-U\fR  erase all input
  565. .sp 0
  566. .ti -0.5i
  567. \fBcontrol-T\fR  transpose character under cursor with previous character
  568. .sp 0
  569. .ti -0.5i
  570. \fBEscape   \fR  exit from filename edit mode
  571. .sp 0
  572. .sp 1
  573. .in -1.0i
  574. .ti +2m
  575. .sp 0
  576. By default, the directory which contains the 
  577. .B xspringies
  578. files is
  579. present automatically.  If the environment variable
  580. .B SPRINGDIR
  581. is set, then the default directory is changed to reflect it.
  582. .sp 0
  583. .ti +2m
  584. If a file error occurs (for example, the file does not exist), a beep is
  585. emitted.
  586.  
  587. .IP "Other stuff"
  588. .ti +2m
  589. The 
  590. .I GO!
  591. button simply turns on and off the animation.  With
  592. .I GO!
  593. turned off,
  594. .B xspringies
  595. uses up little CPU time.
  596. .sp 1
  597. .ti +2m
  598. The
  599. .I Show Springs
  600. checkbox controls whether or not the springs are drawn.  If there are a lot
  601. of springs, animation may go faster with this option on.  Sometimes an object
  602. will even look better with only the masses.
  603. .sp 1
  604. .ti +2m
  605. When placing masses or springs, objects can be placed in a gridlike fashion
  606. if the 
  607. .I Grid Snap
  608. checkbox is enabled.  Masses will be separated (vertically and horizontally)
  609. by the amount specified by the
  610. .I Grid Snap
  611. slider.
  612. .sp 1
  613. .ti +2m
  614. When the
  615. .I Duplicate
  616. button is pushed, all selected masses and springs are duplicated.  The copy
  617. is left in the same place, unselected.
  618. .sp 1
  619. .ti +2m
  620. By pushing the
  621. .I Select All
  622. button, all masses and springs are selected.
  623. .sp 1
  624. .ti +2m
  625. By pushing the
  626. .I Delete
  627. button, or pressing the 
  628. .I Delete
  629. key, all selected objects are deleted.  Note that if a mass is deleted, all
  630. attached springs are also deleted (even if they were not selected).
  631. .sp 1
  632. .ti +2m
  633. The
  634. .I Quit
  635. button quits the program.  This same effect is found by pressing the
  636. \fIQ\fR key.
  637.  
  638. .SH FILE FORMAT
  639. .ti +2m
  640. The
  641. .B xspringies
  642. file format is human readable.  Each line consists of a four letter command
  643. string, followed by the parameters for that command.  The file must start
  644. with the command "\fB#1.0\fR".  (This 1.0 refers to file format version 1.0,
  645. and not the version of xspringies being run) Each of the commands below is
  646. on a line by itself.  There are no blank lines allowed.  The file must end
  647. in a newline.
  648. .sp 1
  649. The file consists of the following commands:
  650. .sp 0
  651. .in +1.0i
  652. .ti -0.5i
  653. \fBcmas\fR <current \fIMass\fR value>
  654. .sp 0
  655. .ti -0.5i
  656. \fBelas\fR <current \fIElasticity\fR value>
  657. .sp 0
  658. .ti -0.5i
  659. \fBkspr\fR <current \fIKspring\fR value>
  660. .sp 0
  661. .ti -0.5i
  662. \fBkdmp\fR <current \fIKdamp\fR value>
  663. .sp 0
  664. .ti -0.5i
  665. \fBfixm\fR <boolean value for \fIFixed Mass\fR>
  666. .sp 0
  667. .ti -0.5i
  668. \fBshws\fR <boolean value for \fIShow Springs\fR>
  669. .sp 0
  670. .ti -0.5i
  671. \fBcent\fR <mass id number of center mass>
  672. .in -0.2i
  673. If there is no center mass (i.e. - center of screen is to be used), then
  674. the value of \fI-1\fR is used.
  675. .in +0.2i
  676. .sp 0
  677. .ti -0.5i
  678. \fBfrce\fR <force\ id\ number> <boolean\ active> <parameter\ #1\ value> <parameter\ #2\ value>
  679. .in -0.2i
  680. The <force\ id\ number> sequence is as follows:
  681. .in +0.3i
  682. \fB0\fR - Gravity
  683. .sp 0
  684. \fB1\fR - Center of mass attraction force
  685. .sp 0
  686. \fB2\fR - Center attraction force
  687. .sp 0
  688. \fB3\fR - Wall repulsion force
  689. .sp 0
  690. .in -0.3i
  691. .in +0.2i
  692. .sp 0
  693. .ti -0.5i
  694. \fBvisc\fR <current \fIViscosity\fR value>
  695. .sp 0
  696. .ti -0.5i
  697. \fBstck\fR <current \fIStickiness\fR value>
  698. .sp 0
  699. .ti -0.5i
  700. \fBstep\fR <current \fITime Step\fR value>
  701. .sp 0
  702. .ti -0.5i
  703. \fBprec\fR <current \fIPrecision\fR value>
  704. .sp 0
  705. .ti -0.5i
  706. \fBadpt\fR <boolean value for \fIAdaptive Time Step\fR>
  707. .sp 0
  708. .ti -0.5i
  709. \fBgsnp\fR <current \fIGrid Snap\fR value> <boolean\ enable>
  710. .sp 0
  711. .ti -0.5i
  712. \fBwall\fR <boolean\ top> <boolean\ left> <boolean\ right> <boolean\ bottom> 
  713. .sp 0
  714. .ti -0.5i
  715. \fBmass\fR <mass\ id\ number> <x\ position\ value> <y\ position\ value> <x\ velocity\ value> <y\ velocity\ value> <mass\ value> <elasticity\ value>
  716. .in -0.2i
  717. For each mass, the <mass\ id\ number> must be unique.  They do not need to
  718. be in any order.  If a mass is fixed, then the <mass\ value> field is negated.
  719. .in +0.2i
  720. .sp 0
  721. .ti -0.5i
  722. \fBspng\fR <spring\ id\ number> <mass\ #1\ id\ number> <mass\ #2\ id\ number> <Kspring\ value> <Kdamp\ value> <rest\ length\ value>
  723. .in -0.2i
  724. For each spring, the <spring\ id\ number> must be unique.  They do not need to
  725. be in any order.  The order of the <mass\ id\ number>'s is not important.
  726. .in +0.2i
  727. .sp 1
  728. .in -1.0i
  729. .ti +2m
  730. All \fIvalues\fR are floating point numbers.  All \fIid numbers\fR are
  731. positive integers, and all \fIboolean\fR values are non-zero/zero for
  732. True/False.  It is possible to feed \fBxspringies\fR bogus values.  It may
  733. produce interesting or amusing side effects, but will most likely cause
  734. an object to explode or \fBxspringies\fR to crash.
  735. .SH AUTHOR
  736. .PP
  737. Douglas DeCarlo (dmd@gradient.cis.upenn.edu)
  738. .sp 1
  739. Please send demo files, comments, suggestions, bug reports, bug fixes and
  740. enhancements.
  741.  
  742. .IP "With thanks to:"
  743. .sp 0
  744. Elliott Evans
  745. .sp 0
  746. .in +0.4i
  747. Bitmap slave.
  748. .in -0.4i
  749. .sp 1
  750. Nathan Loofbourrow
  751. .sp 0
  752. .in +0.4i
  753. I bothered him a whole lot about the user interface.
  754. .in -0.4i
  755. .sp 1
  756. Drew Olbrich
  757. .sp 0
  758. .in +0.4i
  759. The blame for "stickiness" falls on him, as well as a few other things.
  760. .in -0.4i
  761. .sp 1
  762. Andy Witkin
  763. .sp 0
  764. .in +0.4i
  765. For teaching a really great physically based modeling course at CMU.
  766. Many ideas (both methods and interface) came from that class.
  767. .in -0.4i
  768. .sp 1
  769. And thanks to the many other people who helped in testing
  770. .B xspringies
  771. and make some of the neat demo files, including
  772. James Helfrich, Brian Kelley, Patrick Lopez, Chris Newman and Jef Poskanzer.
  773.  
  774. .SH RESTRICTIONS
  775. .B xspringies
  776. runs faster on a monochrome display than on a color display (usually).
  777. .sp 1
  778. You probably don't want to run
  779. .B xspringies
  780. on a slow machine or a machine which does slow bit-blitting operations.
  781. Well, I guess you could... But you would be sorry for even trying.
  782. .sp 1
  783. Here is a good rule:  If
  784. .B xspringies
  785. isn't fun to use, then your machine is either too slow, or it is overloaded.
  786. Or maybe you just aren't a fun person.  :-)
  787. \BARFOO\
  788. else
  789.   echo "will not over write ./xspringies.man"
  790. fi
  791. echo "Finished archive 1 of 16"
  792. exit
  793.  
  794. exit 0 # Just in case...
  795. -- 
  796.   // chris@IMD.Sterling.COM            | Send comp.sources.x submissions to:
  797. \X/  Amiga - The only way to fly!      |
  798.  "It's intuitively obvious to the most |    sources-x@imd.sterling.com
  799.   casual observer..."                  |
  800.