de.steeringbehaviors.simulation.behaviors
Class Wander

java.lang.Object
  extended by de.steeringbehaviors.simulation.behaviors.Behavior
      extended by de.steeringbehaviors.simulation.behaviors.Wander
All Implemented Interfaces:
ObjectAttributes

public class Wander
extends Behavior

The wander behaviour to steer a vehicle in a random way


Field Summary
protected  Point2d m_pos
          Position of the circle in local coordinates
protected  double m_r
          Radius of the inhibiting circle
protected  double m_rate
          Maximum rate of variation
protected  Point2d m_seekPoint
          Resulting seek direction
protected  java.util.Random rand
          Random number generator
 
Fields inherited from class de.steeringbehaviors.simulation.behaviors.Behavior
m_behaviorName, m_influence, m_needsNeighborhood, m_neighborhood
 
Constructor Summary
Wander()
          Constructor
Wander(double x, double y, double r, double influence)
          Constructor
Wander(Point2d p, double r, double influence)
          Constructor
 
Method Summary
 Vector2d calculate(Vehicle v)
          Calculates the resulting force vector for this frame
 void init()
          Initialization function
 void setAttribute(java.lang.String name, java.lang.String value, java.util.Hashtable objectList)
          Sets a attribute specified by the name
 void setRate(double rate)
           
 
Methods inherited from class de.steeringbehaviors.simulation.behaviors.Behavior
getBehaviorName, getInfluence, needsNeighborhood, setInfluence, setNeighborhood, setSpecialObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_pos

protected Point2d m_pos
Position of the circle in local coordinates


m_seekPoint

protected Point2d m_seekPoint
Resulting seek direction


m_r

protected double m_r
Radius of the inhibiting circle


m_rate

protected double m_rate
Maximum rate of variation


rand

protected java.util.Random rand
Random number generator

Constructor Detail

Wander

public Wander()
Constructor


Wander

public Wander(Point2d p,
              double r,
              double influence)
Constructor

Parameters:
p - Center point of circle (local coordinates)
r - Radius of circle
influence - The influence

Wander

public Wander(double x,
              double y,
              double r,
              double influence)
Constructor

Parameters:
x - X position of center point of circle
y - Y position of center point of circle
r - Radius of circle
influence - The influence
Method Detail

init

public void init()
Initialization function


setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value,
                         java.util.Hashtable objectList)
Sets a attribute specified by the name

Specified by:
setAttribute in interface ObjectAttributes
Overrides:
setAttribute in class Behavior
Parameters:
name - name of the attribute
value - value of the attribute
objectList - hashtable of all steeringobjects

setRate

public void setRate(double rate)

calculate

public Vector2d calculate(Vehicle v)
Calculates the resulting force vector for this frame

Overrides:
calculate in class Behavior
Parameters:
veh - The vehicle
Returns:
Returns the resulting force