The WebSlinger program simulates meshes of nodes (masses) connected by (linear and non-linear) springs. It enables mouse-based interaction and saving of node positions during pulling.
When the program is run, it will open a configuration file to determine the structure and parameters of the structure to simulate. The default name for this file is webslinger.cfg and its default location is the directory where the program was run. You can specify a different configuration file by running on the command line or by dragging the configuration file and dropping it onto the WebSlinger program.
The format of the configuration file is shown below. All lines between the structure { opening line and the } final line are optional, and each optional line can appear more than once.
structure { mass_damping DAMPING mass_radius RADIUS mass NAME MASS X Y Z mass NAME MASS X Y Z DAMPING mass NAME MASS X Y Z DAMPING RADIUS spring_constant_over_length VALUE rest_length_fraction VALUE spring NAME1 NAME2 spring NAME1 NAME2 REST K spring NAME1 NAME2 REST K BREAKING_FORCE general_strain_force_curve NAME {
strain force strain force
}
generic_spring NAME1 NAME2 STRAIN_FORCE_CURVE_NAME generic_spring NAME1 NAME2 STRAIN_FORCE_CURVE_NAME REST K
generic_spring NAME1 NAME2 STRAIN_FORCE_CURVE_NAME REST K BREAKING_FORCE step_and_save {
file NAME
num_steps COUNT
relax COUNT
mass NAME1 DX DY
mass NAME2 DX DY ...
}
}
The mass_damping, mass_radius, spring_constant_over_length, and rest_length_fraction lines are parameters that apply to all following masses or springs. They can be interleaved between mass and spring definitions to result in different types of masses and springs in the same structure. The object to which they apply and their default values is shown in the table below:
Parameter | Applies to | Default Value | Units |
mass_damping | mass | 5 | f * (pixels/time step) |
mass_radius | mass | 0 | pixels |
spring_const_over_length | springs (all types) | 1 | f * pixels |
rest_length_fraction | springs (all types) | 1 | unitless |
general_strain_force_curve | generic_spring | None | unitless, f |
DX, DY | step_and_save | None | pixels |
COUNT | step_and_save | None | time steps |
The mass_radius parameter specifies the displayed radius of all following masses in pixels. This does not affect the solutions to the simulation; it is only there to help visualize the web. One approach is to put larger-radius masses with very large values (1e100) as fixed end-points for webs and smaller-radius masses at the nodes to make it clear where the mouse can grab the web.
The mass_damping parameter specifies how much damping is applied during the simulation of all following masses. It is the force per unit velocity that opposed motion. Velocity is in pixels/frame.
The rest_length_fraction parameter is used to compute the rest length of all following springs that do not have their rest length defined. This is a unitless parameter that indicates that the rest length of the spring is computed by taking the initial distance between the two masses and multiplying it by rest_length_fraction to find the rest length of the spring. For instance, a value of 1.0 (the default) makes the rest length equal to the initial length, whereas a value of 0.5 makes the rest length half of the initial length (the spring is initially under tension).
The spring_const_over_length parameter is used to calculate the spring constant of following linear springs whose spring constant is not defined in the file (the first spring option only takes the names of the two masses it is connected to). If a spring's spring constant is not specified, then it is computed as spring_const_over_length / rest_length. When applied to the general_spring class, this becomes the spring constant without being divided by the length (because the general_spring class maps strain to force, and strain is intrinsically independent of length.
The general_strain_force_curve specifies the mapping between strain and force for the generic_spring class. The force curve is given a name than can then be referred to. Note that you probably want the force to be 0.0 at a strain of 1.0 (rest length). Note also that at larger strains, you should probably subtract one from the strain value when computing the force (to take into account the fact that a strain of 1 is rest length).
The step_and_save entry will cause the program to go through an automatic simulation sequence when it starts up. It will run COUNT simulations steps to let things settle, then save to file NAME the masses. It will then move the specified mass NAME1 by the number of pixels specified in DX, DY and do this again. This is repeated for NUM_STEPS times, and then the simulation enters interactive mode. All follow_mass entries will be moved by the same trajectory as the original mass.