![]() |
Menge
Modular Pedestrian Simulation Framework for Research and Development
|
Definition of an agent generator class which produces agents based on the positions of intersections on a hexagonal lattice bounded by a rectangle. More...
#include <HexLatticeGenerator.h>
Public Types | |
enum | AnchorAlignEnum { CENTER, LEFT_CORNER, RIGHT_CORNER } |
Enumeration specifying arrangement relative to the anchor point. More... | |
enum | LatticeRowEnum { ROW_X, ROW_Y } |
Enumeration indicating which axis the regular rows occur. More... | |
Public Member Functions | |
HexLatticeGenerator () | |
Constructor. | |
virtual size_t | agentCount () |
Reports the number of agents created. More... | |
virtual Vector2 | agentPos (size_t i) |
Get the position of the ith agent. More... | |
void | set (const Vector2 &anchor, AnchorAlignEnum align, LatticeRowEnum dir, float width, float density, size_t tgtPopulation, float angle) |
Sets the properties of the generator. More... | |
void | setRotationDeg (float angle) |
Sets the lattice rotation. | |
![]() | |
AgentGenerator () | |
Constructor. | |
void | setNoiseGenerator (Math::FloatGenerator *gen) |
Sets the Generators noise generation. More... | |
Vector2 | addNoise (const Vector2 &pos) |
Perturbs the given point according to the given noise generator. More... | |
![]() | |
void | destroy () |
This supplants the destructor. More... | |
virtual BFSM::Task * | getTask () |
Return an optional task associated with this element. More... | |
virtual SceneGraph::GLNode * | getSGNode () |
Returns an optional visualization element associated with the element. More... | |
Protected Attributes | |
Vector2 | _anchor |
The anchor point of the lattice. One agent will be positioned at this world coordainte. | |
LatticeRowEnum | _rowDir |
The direction of the row layout. | |
float | _cosRot |
The cosine of the amount the lattice is rotated around its anchor point. positive rotation values are counter-clockwise rotation. | |
float | _sinRot |
The sine of the amount the lattice is rotated around its anchor point. positive rotation values are counter-clockwise rotation. | |
size_t | _totalPop |
The actual number of agents to create based on run-time parameters. This value is only valid AFTER finalize has been called. | |
float | _rowDist |
The distance between rows for the given target density. | |
float | _nbrDist |
The distance between neighbors in a single row for the given target density. | |
size_t | _rowPop |
The population of the major row (interpreted differently depending on lattice row direction. | |
size_t | _rowCount |
The number of rows to create. | |
![]() | |
Math::FloatGenerator * | _disp |
The generator for displacement amount (defaults to zero). | |
Math::FloatGenerator * | _dir |
The generator for angular displacement. | |
Additional Inherited Members | |
![]() | |
virtual | ~AgentGenerator () |
Virtual destructor. | |
Definition of an agent generator class which produces agents based on the positions of intersections on a hexagonal lattice bounded by a rectangle.
Circles can be maximally packed into a hexagonal lattice. In this case, an open rectangular region is defined (relative to an anchor point) and agents are placed in a hexagonal lattice, bounded by the rectangular region on three sides.
The rectangular region is defined in "local" space. In its own local space, the rectangular region lies on the x-axis and extends into the positive y-direction. The "front" of the region lies on the x-axis and the left and right sides extend into the positive y-direction. The alignment of the rectangular region relative to the anchor point depends on the AnchorAlignEnum value.
The hexagonal grid lattice size is based on the target average density. The lattice points are placed to achieve that average density. The lattice will either be aligned with the x-axis or the y-axis, depending on the LatticeRowEnum value.
|
inlinevirtual |
Reports the number of agents created.
Implements Menge::Agents::AgentGenerator.
|
virtual |
Get the position of the ith agent.
i | The index of the requested agent. |
AgentGeneratorException | if the index, i, is invalid. |
Implements Menge::Agents::AgentGenerator.
void Menge::Agents::HexLatticeGenerator::set | ( | const Vector2 & | anchor, |
AnchorAlignEnum | align, | ||
LatticeRowEnum | dir, | ||
float | width, | ||
float | density, | ||
size_t | tgtPopulation, | ||
float | angle | ||
) |
Sets the properties of the generator.
anchor | The anchor position of the lattice. |
align | The target alignment. |
dir | The desired row direction. |
width | The width of the bounding region |
density | The target density (agent /m^2). |
tgtPopulation | The target population (agents). |
angle | The rotation angle (in degrees). |