NAME
Physics::Springs - Simulate Particle Dynamics with Springs
SYNOPSIS
use Physics::Springs;
ABSTRACT
Simulate particle dynamics with springs.
DESCRIPTION
This module is intended as an add-on to the Physics::Particles module (version 1.00 or higher required) and may be used to simulate particle dynamics including spring-like forces between any two particles you specify.
Since version 1.00 of this module, Physics::Particles version 1.00 is required. Version 1.00 is neither compatible to earlier versions nor to any versions below 1.00 of Physics::Particles and Physics::Springs::Friction.
The module extends the API of Physics::Particles by one method which is documented below. Please see the documentation to Physics::Particles for more information about the API.
There are several particle properties required by Physics::Springs in order to work: These are the x/y/z coordinates, the vx/vy/vz velocity vector components, and a non-zero mass 'm'. Furthermore, it uses the _fx, _fy, _fz properties which the user should never modify directly.
Methods
- add_spring
-
You may use the add_spring method to add springs to the system of particles. Each spring has a starting and end particle, a relaxed length, and a spring constant 'k'.
add_spring expects several named arguments. Required arguments are: The spring constant k, the starting (p1) and end (p2) points. Optional arguments are: The length of the relaxed spring 'len'. If len is not specified, the current distance between p1 and p2 will be used as the length of the relaxed spring.
- iterate_step
-
Iterates next simulation step. Please refer to the documentation of the super method to this in Physics::Particles.
DIAGNOSTICS
Some error messages you may encounter:
"Precondition 1 not met for Physics::Springs::new()."
new() does not take any parameters.
"Postcondition 1 not met for Physics::Springs::new()"
Complain to the author of the module. He screwed up.
"Physics::Springs::new called in void context."
It doesn't make sense to call constructors without action-at-a-distance
in void context so don't.
"Precondition 1 not met for Physics::Springs::add_spring()"
add_spring() takes at least nine arguments.
"Postcondition 1 not met for Physics::Springs::add_spring()"
Complain to the author of the module. He screwed up.
SEE ALSO
The newest version of this module may be found on CPAN or http://steffen-mueller.net
The module this module subclasses: Physics::Particles
A module that adds force field-like forces to the simulation: Physics::Springs::Friction
Math::Project3D, Math::Project3D::Plot for a reasonably simple way to visualize your data.
AUTHOR
Steffen Mueller, <springs-module at steffen-mueller dot net>
COPYRIGHT AND LICENSE
Copyright 2003-2005 by Steffen Mueller
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.