OverSim
greatGathering Class Reference

greatGathering class More...

#include <greatGathering.h>

Inheritance diagram for greatGathering:
MovementGenerator

Public Member Functions

 greatGathering (double areaDimension, double speed, NeighborMap *Neighbors, GlobalCoordinator *coordinator, CollisionList *CollisionRect)
virtual ~greatGathering ()
virtual void move ()
 Defined in subclasses only.
- Public Member Functions inherited from MovementGenerator
 MovementGenerator (double areaDimension, double speed, NeighborMap *Neighbors, GlobalCoordinator *coordinator, CollisionList *CollisionRect)
 Initialize the generator with the movement area dimensions and node movement speed.
virtual ~MovementGenerator ()
Vector2D getPosition ()
 Get the nodes current position.

Additional Inherited Members

- Protected Member Functions inherited from MovementGenerator
bool testBounds ()
 Prevents the node from leaving the defined area and checks for obstacle hits.
void flock ()
 Simple flocking algorithm.
void generateScenery (unsigned int seed)
 Generates scenery objects.
- Protected Attributes inherited from MovementGenerator
double areaDimension
double speed
Vector2D direction
Vector2D position
Vector2D target
NeighborMapNeighbors
NeighborMap::iterator itNeighbors
GlobalCoordinatorcoordinator
CollisionListCollisionRect

Detailed Description

greatGathering class

Simulates many nodes gathering at one spot.

Definition at line 34 of file greatGathering.h.

Constructor & Destructor Documentation

greatGathering::greatGathering ( double  areaDimension,
double  speed,
NeighborMap Neighbors,
GlobalCoordinator coordinator,
CollisionList CollisionRect 
)

Definition at line 26 of file greatGathering.cc.

{
if(coordinator->getPeerCount() == 0) {
target.x = uniform(areaDimension / 3, 2 * areaDimension / 3);
target.y = uniform(areaDimension / 3, 2 * areaDimension / 3);
coordinator->increasePositionSize();
coordinator->setPosition(0, target);
coordinator->increasePeerCount();
}
else {
target = coordinator->getPosition(0);
}
}
virtual greatGathering::~greatGathering ( )
inlinevirtual

Definition at line 38 of file greatGathering.h.

{}

Member Function Documentation

void greatGathering::move ( )
virtual

Defined in subclasses only.

Implements MovementGenerator.

Definition at line 41 of file greatGathering.cc.

{
flock();
if(testBounds()) {
position += direction * speed * 2;
}
}

The documentation for this class was generated from the following files: