#include <Spring.h>
Public Member Functions | |
| virtual | ~Spring (void) |
| Spring (Particle *particle, const float d, const float s0) | |
| Particle * | get_attached_particle () const |
| float | get_spring_constant () const |
| float | get_rest_length () const |
| void | set_attached_particle (Particle *particle) |
| void | set_spring_constant (const float d) |
| void | set_rest_length (const float s0) |
A force generator that applies spring forces to 2d particles. One instance should not be used for multiple particles. However, you may attach one instance to a particle and apply the same spring force between this particle and multiple others. Notice that the force generator creates a force for only one object (the particle passed in to function update_force). If you want to link two objects with a spring, then you have to individually create and register a generator for each.
| virtual bl7::particles2::Spring::~Spring | ( | void | ) | [inline, virtual] |
Destructor.
| bl7::particles2::Spring::Spring | ( | Particle * | particle, | |
| const float | d, | |||
| const float | s0 | |||
| ) | [inline] |
Explicit constructor with parameters specifying the permanently attached particle on the other side of the spring, the spring constant d and the rest length of the spring s0.
| Particle* bl7::particles2::Spring::get_attached_particle | ( | ) | const [inline] |
Returns the particle permanently attached to the spring.
| float bl7::particles2::Spring::get_rest_length | ( | ) | const [inline] |
Returns the rest length of the spring.
| float bl7::particles2::Spring::get_spring_constant | ( | ) | const [inline] |
Returns the spring constant.
| void bl7::particles2::Spring::set_attached_particle | ( | Particle * | particle | ) | [inline] |
Sets the particle permanently attached to the spring.
| void bl7::particles2::Spring::set_rest_length | ( | const float | s0 | ) | [inline] |
Sets the rest length of the spring.
| void bl7::particles2::Spring::set_spring_constant | ( | const float | d | ) | [inline] |
Sets the spring constant.
1.7.1