|
CellModules
|
Template class for a 2D grid physics-based body. More...
#include <Body2DGrid.hpp>
Public Member Functions | |
| Body2DGrid ()=default | |
| Default constructor. More... | |
| Body2DGrid (const MecaCell::Vector3D &pos) | |
| Constructor with position. More... | |
| int | getNbNeighbouringLocations () const |
| Gets the number of neighbouring locations. More... | |
| void | setNbNeighbouringLocations (int n) |
| Sets the number of neighbouring locations. More... | |
| int | getNbNeighbouringCells () const |
| Gets the number of neighbouring cells. More... | |
| void | setNbNeighbouringCells (int n) |
| Sets the number of neighbouring cells. More... | |
| double | getDensity () const |
| Gets the density of the cell. More... | |
| double | getBoundingBoxRadius () const |
| Gets the bounding box radius. More... | |
| void | setRadius (double _radius) |
| Sets the bounding box radius. More... | |
| Vec2D | get2DPosition () const |
| Gets the 2D position of the cell. More... | |
| MecaCell::Vector3D | getPosition () const |
| Gets the 3D position of the cell. More... | |
| void | set2DPosition (const Vec2D &p) |
| Sets the 2D position of the cell. More... | |
| void | set2DPosition (int i, int j) |
| Sets the 2D position of the cell. More... | |
| void | setPosition (const MecaCell::Vector3D &p) |
| Sets the 3D position of the cell. More... | |
| CellGrid< cell_t > * | getCellGrid () |
| Gets the cell grid. More... | |
| Vec2D | findLowestDensityPosition (int range) |
| Finds one of the lowest density positions within a range. if there are multiple positions with the same lowest density, one is chosen randomly. More... | |
| bool | isMovementEnabled () |
| void | disableMovement () |
| void | enableMovement () |
| Vec | getPrevposition () const |
| Vec | getVelocity () const |
| Vec | getForce () const |
| double | getMass () const |
| void | setPrevposition (const Vec &p) |
| void | setVelocity (const Vec &v) |
| void | setForce (const Vec &f) |
| void | setMass (const double m) |
| void | receiveForce (const double &intensity, const Vec &direction, const bool &compressive) |
| void | receiveForce (const Vec &f) |
| void | resetVelocity () |
| void | resetForce () |
| void | setCellPlugin (plugin_t *_cellPlugin) |
| void | onCellPluginLinking () |
Protected Attributes | |
| Vec | prevposition = Vec::zero() |
| Vec | velocity = Vec::zero() |
| Vec | force = Vec::zero() |
| bool | movementEnabled = true |
| double | mass = Config::DEFAULT_CELL_MASS |
| double | totalForce = 0 |
| plugin_t * | cellPlugin |
Private Attributes | |
| double | radius = MecaCell::Config::DEFAULT_CELL_RADIUS |
| Vec2D | position2D = Vec2D(0, 0) |
| int | nbNeighbouringLocations = 9 |
| int | nbNeighbouringCells = 1 |
| CellGrid< cell_t > * | cellGrid = nullptr |
| MecaCell::Vector3D | position |
Template class for a 2D grid physics-based body.
| cell_t | Type of the cell used in the grid. |
| plugin_t | Type of the plugin used with the body. |
Definition at line 31 of file Body2DGrid.hpp.
|
inlineexplicitdefault |
Default constructor.
|
inlineexplicit |
Constructor with position.
| pos | Initial position of the cell in 3D space |
Sets the position of the cell in the 3D space and in the 2D grid.
Definition at line 56 of file Body2DGrid.hpp.
|
inlineinherited |
|
inline |
Finds one of the lowest density positions within a range. if there are multiple positions with the same lowest density, one is chosen randomly.
| range | Range to search for the lowest density position |
Definition at line 168 of file Body2DGrid.hpp.
|
inline |
|
inline |
Gets the bounding box radius.
Definition at line 96 of file Body2DGrid.hpp.
|
inline |
|
inline |
Gets the density of the cell.
Counts the cell itself in the density.
Definition at line 90 of file Body2DGrid.hpp.
|
inlineinherited |
|
inline |
Gets the number of neighbouring cells.
Definition at line 76 of file Body2DGrid.hpp.
|
inline |
Gets the number of neighbouring locations.
Definition at line 64 of file Body2DGrid.hpp.
|
inline |
Gets the 3D position of the cell.
Returns the 3D position based on the 2D position with z = 0.
Definition at line 116 of file Body2DGrid.hpp.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 15 of file BaseBody.hpp.
|
inlineinherited |
|
inlineinherited |
|
inline |
Sets the 2D position of the cell.
| p | 2D position |
Definition at line 122 of file Body2DGrid.hpp.
|
inline |
Sets the 2D position of the cell.
| i | X-coordinate |
| j | Y-coordinate |
Definition at line 149 of file Body2DGrid.hpp.
|
inlineinherited |
Definition at line 14 of file BaseBody.hpp.
|
inlineinherited |
|
inlineinherited |
|
inline |
Sets the number of neighbouring cells.
| n | Number of neighbouring cells |
Definition at line 82 of file Body2DGrid.hpp.
|
inline |
Sets the number of neighbouring locations.
| n | Number of neighbouring locations |
Definition at line 70 of file Body2DGrid.hpp.
|
inline |
Sets the 3D position of the cell.
| p | 3D position |
Definition at line 155 of file Body2DGrid.hpp.
|
inlineinherited |
|
inline |
Sets the bounding box radius.
| _radius | Bounding box radius |
Definition at line 102 of file Body2DGrid.hpp.
|
inlineinherited |
|
private |
Pointer to the grid containing all the cells
Definition at line 39 of file Body2DGrid.hpp.
|
protectedinherited |
Definition at line 9 of file BaseBody.hpp.
|
protectedinherited |
|
protectedinherited |
|
private |
Number of neighbouring cells
Definition at line 37 of file Body2DGrid.hpp.
|
private |
Number of neighbouring locations, includes the cell location
Definition at line 36 of file Body2DGrid.hpp.
|
private |
Definition at line 41 of file Body2DGrid.hpp.
|
private |
Position in the grid
Definition at line 35 of file Body2DGrid.hpp.
|
private |
Definition at line 33 of file Body2DGrid.hpp.
|
protectedinherited |