1#ifndef MASSSPRINGDAMPER_HPP
2#define MASSSPRINGDAMPER_HPP
20template <
typename cell_t>
69 inline MassSpringDamper(cell_t* c1, cell_t* c2,
const float_t &
K,
const float_t &C,
const float_t &L)
109 bool compression = x < 0;
CGAL::Exact_predicates_inexact_constructions_kernel K
Class for managing mass-spring-damper physics.
void updateLengthDirection(const MecaCell::Vec &p0, const MecaCell::Vec &p1)
Updates the current length and direction.
double computeSpeedFromCells()
Computes the total speed from the connected cells.
MassSpringDamper(cell_t *c1, cell_t *c2, const float_t &K, const float_t &C, const float_t &L)
Constructor with parameters.
float_t getRestLength() const
Gets the rest length of the spring.
std::string toString()
Gets the connection as a string.
MassSpringDamper()=default
Default constructor.
std::pair< cell_t *, cell_t * > connection
std::pair< cell_t *, cell_t * > getConnection() const
Gets the connection between the cells.
void setRestLength(float_t L)
Sets the rest length of the spring.
void computeForces()
Computes the forces for the connected cells.
float_t getLength() const
Gets the current length of the spring.
general purpose 3D vector/point class.
double length() const
compute the length of the vector