All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----gerken.vehicles.NetworkNode
|
+----gerken.vehicles.Receptor
A Receptor is like a NetworkNode in that it sums its inputs, it fires and it can therefore affect other nodes in a VehicleNetwork. It differs, though, in the way that it gathers inputs. While a NetworkNode sums inputs from connections with other nodes, a Receptor gets its input from the light given off by other simulation participants. In order for a participant to be seen by a Receptor, the participant must have the exact color that the Receptor is programmed to see. In addition, the participant must lie in the Receptor's field of vision.
This software is provided on an as-is basis and is copyright Chris Gerken. The only rights granted to you are to enjoy and learn from this software.
Return a receptor whose field of vision lies between angle l to the left and angle r to the right.
All of the receiver's inputs have been summed.
Return the light input to the receptor as an integer value.
Get the counterclockwise-most boundary angle of the receptor's field of vision.
Return the amount of light received by the receptor.
Get the clockwise-most boundary angle of the receptor's field of vision.
Return whether this receptor has total light inputs that exceed its threshhold.
Return the color seen by the receptor.
Determine whether angle lies between the receiver's leftAngle and rightAngle.
Set the counterclockwise-most boundary angle of the receptor's field of vision.
Set the clockwise-most boundary angle of the receptor's field of vision.
public Receptor(double l,
double r,
Color c,
int t,
String n)
Return a receptor whose field of vision lies between angle l to the left and angle r to the right. The receptor will see other participants of color c and will fire whenever the sum of its light inputs exceeds threshhold t. Once registered to a scenario, the receptor can be retrieved using name n.
Although angles are represented internally in radians, the values in this constructor are assumed to be double values in degrees. An angle of 0.0 represents the direction in which he vehicle is moving. The angle value increases (to 180.0 directly behind the vehicle) to the left or counterclockwise. Angle values decrease to the right or clockwise.
public void addToLightInput(double value)
public void compute()
All of the receiver's inputs have been summed. If the sum of the inputs is greater than the threshhold then the receiver will fire.
public int getInput()
Return the light input to the receptor as an integer value.
public double getLeftAngle()
Get the counterclockwise-most boundary angle of the receptor's field of vision.
public double getLightInput()
Return the amount of light received by the receptor.
public double getRightAngle()
Get the clockwise-most boundary angle of the receptor's field of vision.
public boolean getSaturated()
Return whether this receptor has total light inputs that exceed its threshhold.
public Color getSeesColor()
Return the color seen by the receptor.
public boolean seesAngle(double angle)
Determine whether angle lies between the receiver's leftAngle and rightAngle. It is assumed that angle has already been normalized.
public void setLeftAngle(double value)
Set the counterclockwise-most boundary angle of the receptor's field of vision.
public void setRightAngle(double value)
Set the clockwise-most boundary angle of the receptor's field of vision.
All Packages Class Hierarchy This Package Previous Next Index