21 this->
mass = host.getMass();
26 template <
typename Integrator = Euler>
void update(
double dt,
double momentOfInertia) {
27 this->
mass = host.getMass();
28 logger<DBG>(
"GhostCenter force = ", this->
force);
29 Integrator::updatePosition(*
this, dt);
30 Integrator::updateOrientation(*
this, momentOfInertia, dt);
31 auto dir = this->
position - host.getPosition();
35 double f = std::min(1.0 / dt, l *
fK);
36 host.receiveForce(dir * f);
37 host.receiveForce(-
host.getVelocity() * 0.05);
38 logger<DBG>(
"Host total force = ",
host.getForce(),
" (sent = ", dir * f,
")");
88 Cell *closestCell =
nullptr;
91 auto normal =
cell == con->cells.first ? -con->direction : con->direction;
92 double dot = normal.dot(d);
94 const auto &midpoint =
95 cell == con->cells.first ? con->midpoint.first : con->midpoint.second;
96 double l = -midpoint / dot;
97 if (l < closestDist) {
99 closestCell = con->cells.first ==
cell ? con->cells.second : con->cells.first;
103 return std::make_tuple(closestCell, closestDist);
void setRestRadius(double r)
std::vector< ElasticConnection< Cell > * > cellConnections
ElasticBody(Cell *c, Vector3D pos=Vector3D::zero())
std::tuple< Cell *, double > getConnectedCellAndMembraneDistance(const Vec &d) const
void updatePositionsAndOrientations(double dt)
void setPoissonCoef(double p)
void receiveForce(const Vec &f)
double getPoissonCoef() const
double getYoungModulus() const
void updateInternals(double dt)
void setYoungModulus(double y)
double getPreciseMembraneDistance(const Vec &d) const
void moveTo(Vector3D newpos)
Cell * getConnectedCell(const Vec &d) const
GhostCenter< OrientedParticle > ghostCenter
OrientedParticle realCenter
double getMomentOfInertia() const
double getBoundingBoxRadius() const
void receiveTorque(const Vec &t)
void setMass(const double m)
Rotation< Vec > orientationRotation
general purpose 3D vector/point class.
double length() const
compute the length of the vector
static Vector3D zero()
constructs a zero vector
Represents a cell in the simulation.
A simple vector class template.
this file contains various miscellanious utility functions & helpers *
static constexpr double DEFAULT_CELL_POISSONCOEF
static constexpr double DEFAULT_CELL_RADIUS
static constexpr double DEFAULT_CELL_YOUNGMOD
An Elastic Connection is a connection between two cells.
void update(double dt, double momentOfInertia)