com.speckled.specksim.imp.shells
Class CollimatedShell

java.lang.Object
  extended by com.speckled.specksim.imp.shells.CollimatedShell
All Implemented Interfaces:
Configurable, MessageShell

@ConfigurableType(value="Collimated shell")
public class CollimatedShell
extends java.lang.Object
implements MessageShell

A simple shell that simulates a targetted, collimated beam of radiation. The energy levels are assumed to be uniform accross the beam, with perfectly crisp edges

Author:
ryanm

Field Summary
 float bitrate
          The bitrate of the radio, in kbps.
 int channelID
          The channel ID.
 float divergenceAngle
          The angle of divergence for the beam, 0 == perfect line pi=sphere
 float range
          The maximum range of the beam
 boolean relativeToSpeck
          Determines whether the target vector is relative to the speck orientation, rather than to the world
 Vector3d targetVector
          The target vector
 
Constructor Summary
CollimatedShell()
           
CollimatedShell(CollimatedShell shell)
          Constructs a new Shell, identical to the argument
 
Method Summary
 MessageShell clone()
          Override this method to return a copy of this MessageShell.
 float getBitRate()
          Gets the data transmission speed, in kilobits per second.
 Vector3d[] getBoundingBox(SpeckPosition orientation)
          Works out an axis-aligned bounding box for this message shell.
 int getChannelID()
          Gets an identifier for the channel used by this shell.
 Configurator getConfigurator()
          Gets a Configurator object that describes and can manipulate the variables of this Configurable.
 boolean hit(Speck sender, SpeckPosition senderOrientation, Speck target, SpeckPosition targetOrientation)
          Checks to see if the sender can reach the target.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

range

@ConfigurableVariable(value="Range")
@Description(value="The maximum range of the transmission")
@NumberRange(value={0.0f,1.7999999523162842f})
@Priority(value=1)
public float range
The maximum range of the beam


divergenceAngle

@ConfigurableVariable(value="Divergence")
@Description(value="The angle of divergence of the beam, in radians")
@NumberRange(value={0.0f,3.1415927410125732f})
@Priority(value=2)
public float divergenceAngle
The angle of divergence for the beam, 0 == perfect line pi=sphere


targetVector

public Vector3d targetVector
The target vector


relativeToSpeck

@ConfigurableVariable(value="Orient with speck")
@Description(value="Sets whether the target vector is taken wrt to the speck\'s orientation")
@Priority(value=3)
public boolean relativeToSpeck
Determines whether the target vector is relative to the speck orientation, rather than to the world


bitrate

@ConfigurableVariable(value="Bit rate")
@Description(value="The tranceiving speed, in kbps. Set to 0 for infinite speed")
@NumberRange(value={0.0f,1024.0f})
@Priority(value=4)
public float bitrate
The bitrate of the radio, in kbps. Set to 0 for infinite bandwidth


channelID

@ConfigurableVariable(value="Channel")
@Description(value="The channel ID. Transmissions on different channels cannot interfere with each other")
@Priority(value=5)
public int channelID
The channel ID. Transmissions on different channels cannot interfere with each other

Constructor Detail

CollimatedShell

public CollimatedShell()

CollimatedShell

public CollimatedShell(CollimatedShell shell)
Constructs a new Shell, identical to the argument

Parameters:
shell - The shell to copy
Method Detail

hit

public boolean hit(Speck sender,
                   SpeckPosition senderOrientation,
                   Speck target,
                   SpeckPosition targetOrientation)
Description copied from interface: MessageShell
Checks to see if the sender can reach the target.

Specified by:
hit in interface MessageShell
Parameters:
sender - The sending speck
senderOrientation - The position of the sending speck at the time of transmission
target - The prospective receiving speck
targetOrientation - The position of the target speck at the time of transmission
Returns:
true if the sender can succesfully transmit to the target, false otherwise.

getBoundingBox

public Vector3d[] getBoundingBox(SpeckPosition orientation)
Description copied from interface: MessageShell
Works out an axis-aligned bounding box for this message shell. This can be used as a quick rejection test when looking for broadcast recipients.

Specified by:
getBoundingBox in interface MessageShell
Parameters:
orientation - The orientation of the sending speck at the time of transmission
Returns:
A two-element array of Vector3Ds. The first element will be the position of the corner of the bounding box that is closest to the origin. The second element will be the corner furthest from the origin.

getBitRate

public float getBitRate()
Description copied from interface: MessageShell
Gets the data transmission speed, in kilobits per second. Return 0 for an effectively infinite bandwidth

Specified by:
getBitRate in interface MessageShell
Returns:
the bit rate of the transceiver, kbps, or 0 if you'd rather not bother will all of this messy low-level stuff

getChannelID

public int getChannelID()
Description copied from interface: MessageShell
Gets an identifier for the channel used by this shell. Shells operating on different channels will not interfer with each other. Radio devices should return a different value than laser devices, for example.

Specified by:
getChannelID in interface MessageShell
Returns:
An integer identifier for this channel.

clone

public MessageShell clone()
Description copied from interface: MessageShell
Override this method to return a copy of this MessageShell. This is so that changes can be made to the shell without affecting ongoing broadcasts.

Specified by:
clone in interface MessageShell
Overrides:
clone in class java.lang.Object
Returns:
A copy of this MessageShell, such that the clone will hit the same set of specks as the original

getConfigurator

public Configurator getConfigurator()
Description copied from interface: Configurable
Gets a Configurator object that describes and can manipulate the variables of this Configurable. This method must only return null if the Configurable object is Annotated such that an AnnotatedConfigurator can be built from it.

Specified by:
getConfigurator in interface Configurable
Returns:
A configurator object, or null if annotated