CellModules
|
Class for managing Delaunay triangulation and Hertzian physics. More...
#include <PluginHertzianPhysics.hpp>
Public Member Functions | |
PluginHertzianPhysics () | |
Constructor. More... | |
void | setCoherenceCoeff (double c) |
Sets the coherence coefficient. More... | |
template<typename world_t > | |
void | beginUpdate (world_t *w) |
Begin update hook for MecaCell. More... | |
template<typename world_t > | |
void | onAddCell (world_t *w) |
On add cell hook for MecaCell. More... | |
template<typename world_t > | |
void | preDeleteDeadCellsUpdate (world_t *w) |
Pre-delete dead cells update hook for MecaCell. More... | |
template<typename world_t > | |
void | preBehaviorUpdate (world_t *w) |
Pre-behavior update hook for MecaCell. More... | |
void | setMinConstraint (MecaCell::Vec min) |
Sets the minimum constraint. More... | |
void | setMaxConstraint (MecaCell::Vec max) |
Sets the maximum constraint. More... | |
PhysicsConstraints | getConstraints () |
Gets the physics constraints. More... | |
void | addPlane (MecaCell::Vec _n=MecaCell::Vec(0, 1, 0), MecaCell::Vec _p=MecaCell::Vec(0, 0, 0), bool _sticky=false) |
Adds a plane constraint. More... | |
void | addSymAxis (std::function< double(double, MecaCell::Vec, MecaCell::Vec)> _radiusFunction, MecaCell::Vec _axis=MecaCell::Vec(0., 1., 0.), MecaCell::Vec _origin=MecaCell::Vec(0., 0., 0.), double _length=100, double _maxEffectRadius=100, bool _fitShape=true, double _velocity_attraction=0.001) |
Adds a symmetrical axis constraint. More... | |
void | addVelocity (MecaCell::Vec _v=MecaCell::Vec(0, 1, 0)) |
Adds a velocity constraint. More... | |
void | setCurvedBox (double radiusBoxPlane, double curvedDistToMaxSpeed, double maxSpeed) |
Sets the curved box parameters. More... | |
Private Member Functions | |
bool | isDelaunayCoherent () |
Checks the coherence of the Delaunay triangulation. More... | |
void | moveDelaunay () |
Moves the points in the triangulation to match their real positions. More... | |
template<typename world_t > | |
void | computeDelaunay (world_t *w) |
Computes the Delaunay triangulation from the list of cells. More... | |
template<typename world_t > | |
void | addCells (world_t *w) |
Adds new cells to the triangulation. More... | |
void | removeCells () |
Removes dead cells from the triangulation. More... | |
template<typename world_t > | |
void | updateConnections (world_t *w) |
Updates the connections between cells. More... | |
template<typename world_t > | |
void | customConstraint (world_t *w) |
Applies custom spatial constraints to the cells. More... | |
template<typename world_t > | |
double | updateForces (world_t *w) |
Updates the forces acting on the cells. More... | |
void | updateInteractionForces (cell_t *c1) |
Updates the interaction forces between cells. More... | |
template<typename world_t > | |
void | updatePositions (world_t *w, double dt) |
Updates the positions of the cells. More... | |
template<typename world_t > | |
void | resetForces (world_t *w) |
Resets the forces acting on the cells. More... | |
template<typename world_t > | |
void | applyPhysics (world_t *w) |
Applies the physics with a coherent time step. More... | |
Private Attributes | |
Delaunay | triangulation |
double | coherenceCoeff = 0.2 |
bool | areForcesNegligible = false |
bool | areMovementsNegligible = false |
MecaCell::Vec | minConstraint |
MecaCell::Vec | maxConstraint |
PhysicsConstraints | constraints |
Class for managing Delaunay triangulation and Hertzian physics.
cell_t | Type of the cell. |
Definition at line 41 of file PluginHertzianPhysics.hpp.
|
inline |
Constructor.
Initializes the custom constraints.
Definition at line 366 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Adds new cells to the triangulation.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 133 of file PluginHertzianPhysics.hpp.
|
inline |
Adds a plane constraint.
_n | Normal vector of the plane. |
_p | Point on the plane. |
_sticky | Indicates if the plane is sticky. |
Definition at line 464 of file PluginHertzianPhysics.hpp.
|
inline |
Adds a symmetrical axis constraint.
_radiusFunction | Radius function. |
_axis | Axis vector. |
_origin | Origin point. |
_length | Length of the axis. |
_maxEffectRadius | Maximum effect radius. |
_fitShape | Indicates if the shape should fit. |
_velocity_attraction | Attraction velocity. |
Definition at line 477 of file PluginHertzianPhysics.hpp.
|
inline |
Adds a velocity constraint.
_v | Velocity vector. |
Definition at line 486 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Applies the physics with a coherent time step.
Applies the physics with a coherent physics dt. Stops when movements or forces are too weak.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 343 of file PluginHertzianPhysics.hpp.
|
inline |
Begin update hook for MecaCell.
Recomputes or readjusts the triangulation and regenerates the connections.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 386 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Computes the Delaunay triangulation from the list of cells.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 113 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Applies custom spatial constraints to the cells.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 197 of file PluginHertzianPhysics.hpp.
|
inline |
Gets the physics constraints.
Definition at line 455 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Checks the coherence of the Delaunay triangulation.
Definition at line 58 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Moves the points in the triangulation to match their real positions.
Definition at line 86 of file PluginHertzianPhysics.hpp.
|
inline |
On add cell hook for MecaCell.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 398 of file PluginHertzianPhysics.hpp.
|
inline |
Pre-behavior update hook for MecaCell.
Applies the physics to each cell.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 429 of file PluginHertzianPhysics.hpp.
|
inline |
Pre-delete dead cells update hook for MecaCell.
Removes the dead cells from the triangulation.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 411 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Removes dead cells from the triangulation.
Definition at line 145 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Resets the forces acting on the cells.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 327 of file PluginHertzianPhysics.hpp.
|
inline |
Sets the coherence coefficient.
c | Coherence coefficient. |
Definition at line 375 of file PluginHertzianPhysics.hpp.
|
inline |
Sets the curved box parameters.
radiusBoxPlane | Radius of the box plane. |
curvedDistToMaxSpeed | Curved distance to maximum speed. |
maxSpeed | Maximum speed. |
Definition at line 495 of file PluginHertzianPhysics.hpp.
|
inline |
Sets the maximum constraint.
max | Maximum constraint vector. |
Definition at line 447 of file PluginHertzianPhysics.hpp.
|
inline |
Sets the minimum constraint.
min | Minimum constraint vector. |
Definition at line 438 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Updates the connections between cells.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 165 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Updates the forces acting on the cells.
world_t | Type of the world. |
w | Pointer to the world. |
Definition at line 239 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Updates the interaction forces between cells.
c1 | Pointer to the first cell. |
Definition at line 265 of file PluginHertzianPhysics.hpp.
|
inlineprivate |
Updates the positions of the cells.
Updates positions and checks if the movements are too weak to be considered.
world_t | Type of the world. |
w | Pointer to the world. |
dt | Time step. |
Definition at line 305 of file PluginHertzianPhysics.hpp.
|
private |
Flag indicating if forces are negligible
Definition at line 46 of file PluginHertzianPhysics.hpp.
|
private |
Flag indicating if movements are negligible
Definition at line 47 of file PluginHertzianPhysics.hpp.
|
private |
Coefficient used to determine the spatial coherence of each cell
Definition at line 45 of file PluginHertzianPhysics.hpp.
|
private |
Object managing physical constraints
Definition at line 52 of file PluginHertzianPhysics.hpp.
|
private |
Maximum constraint vector
Definition at line 50 of file PluginHertzianPhysics.hpp.
|
private |
Minimum constraint vector
Definition at line 49 of file PluginHertzianPhysics.hpp.
|
private |
Contains and computes the Delaunay triangulation of the cells
Definition at line 44 of file PluginHertzianPhysics.hpp.