OverSim
traverseRoaming Class Reference

traverseRoaming class More...

#include <traverseRoaming.h>

Inheritance diagram for traverseRoaming:
MovementGenerator

Public Member Functions

 traverseRoaming (double areaDimension, double speed, NeighborMap *Neighbors, GlobalCoordinator *coordinator, CollisionList *CollisionRect)
virtual ~traverseRoaming ()
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

traverseRoaming class

Simulates nodes roaming the area traversely.

Definition at line 34 of file traverseRoaming.h.

Constructor & Destructor Documentation

traverseRoaming::traverseRoaming ( double  areaDimension,
double  speed,
NeighborMap Neighbors,
GlobalCoordinator coordinator,
CollisionList CollisionRect 
)
virtual traverseRoaming::~traverseRoaming ( )
inlinevirtual

Definition at line 38 of file traverseRoaming.h.

{}

Member Function Documentation

void traverseRoaming::move ( )
virtual

Defined in subclasses only.

Implements MovementGenerator.

Definition at line 38 of file traverseRoaming.cc.

{
if( GlobalStatisticsAccess().get()->isMeasuring() ){
flock();
if(testBounds()) {
position += direction * speed * 2;
}
if(target.distanceSqr(position) < speed * speed) {
coordinator->endSimulation();
}
}
}

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