|
CellModules
|
Class for managing mass-spring-damper physics. More...
#include <MassSpringDamper.hpp>
Public Member Functions | |
| MassSpringDamper ()=default | |
| Default constructor. More... | |
| MassSpringDamper (cell_t *c1, cell_t *c2, const float_t &K, const float_t &C, const float_t &L) | |
| Constructor with parameters. More... | |
| void | setRestLength (float_t L) |
| Sets the rest length of the spring. More... | |
| float_t | getRestLength () const |
| Gets the rest length of the spring. More... | |
| float_t | getLength () const |
| Gets the current length of the spring. More... | |
| std::pair< cell_t *, cell_t * > | getConnection () const |
| Gets the connection between the cells. More... | |
| void | computeForces () |
| Computes the forces for the connected cells. More... | |
| std::string | toString () |
| Gets the connection as a string. More... | |
Private Member Functions | |
| void | updateLengthDirection (const MecaCell::Vec &p0, const MecaCell::Vec &p1) |
| Updates the current length and direction. More... | |
| double | computeSpeedFromCells () |
| Computes the total speed from the connected cells. More... | |
Private Attributes | |
| std::pair< cell_t *, cell_t * > | connection |
| float_t | stiffness |
| float_t | dampCoef |
| float_t | restLength |
| float_t | length |
| MecaCell::Vec | direction |
Class for managing mass-spring-damper physics.
| cell_t | Type of the cell. |
Definition at line 21 of file MassSpringDamper.hpp.
|
inlinedefault |
Default constructor.
|
inline |
Constructor with parameters.
| c1 | Pointer to the first cell. |
| c2 | Pointer to the second cell. |
| K | Spring stiffness. |
| C | Damping coefficient. |
| L | Rest length. |
Definition at line 69 of file MassSpringDamper.hpp.
|
inline |
Computes the forces for the connected cells.
Definition at line 103 of file MassSpringDamper.hpp.
|
inlineprivate |
Computes the total speed from the connected cells.
Definition at line 48 of file MassSpringDamper.hpp.
|
inline |
Gets the connection between the cells.
Definition at line 98 of file MassSpringDamper.hpp.
|
inline |
Gets the current length of the spring.
Definition at line 91 of file MassSpringDamper.hpp.
|
inline |
Gets the rest length of the spring.
Definition at line 84 of file MassSpringDamper.hpp.
|
inline |
Sets the rest length of the spring.
| L | Rest length. |
Definition at line 77 of file MassSpringDamper.hpp.
|
inline |
Gets the connection as a string.
Definition at line 122 of file MassSpringDamper.hpp.
|
inlineprivate |
Updates the current length and direction.
| p0 | Position of the first cell. |
| p1 | Position of the second cell. |
Definition at line 37 of file MassSpringDamper.hpp.
|
private |
Pair of cells that are connected
Definition at line 24 of file MassSpringDamper.hpp.
|
private |
Spring's damping coefficient in ng/s
Definition at line 26 of file MassSpringDamper.hpp.
|
private |
Spring's current direction from node 0 to 1
Definition at line 29 of file MassSpringDamper.hpp.
|
private |
Spring's current length in µm
Definition at line 28 of file MassSpringDamper.hpp.
|
private |
Spring's rest length in µm
Definition at line 27 of file MassSpringDamper.hpp.
|
private |
Spring's stiffness in ng/s^2
Definition at line 25 of file MassSpringDamper.hpp.