com.speckled.specksim.imp.shells
Class EllipsoidShell

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

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

This shell type simulates an ellipsoid shell

Author:
ryanm

Field Summary
 float bitrate
          The bit rate of the shell
 int channel
          The channel id
 boolean preserveProportions
          When true, setting the min or max range will preserve the relative proportions of the ellipsoid.
 Vector3f radius
          The radius of the ellipse
 
Constructor Summary
EllipsoidShell()
           
EllipsoidShell(EllipsoidShell shell)
          Constructs a new shell, identical to the argument
 
Method Summary
 EllipsoidShell 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.
 float getMaxRange()
          Gets the length of the largest radii in the ellipse.
 float getMinRange()
          Gets the length of the smallest radii in the ellipse.
 SpeckPosition getOrientationOffset()
          Gets the offset that this shell has from the position and orientation of the owning speck
 Vector3f getRadius()
          Gets the current emission radii of this shell
 float getVolume()
          Gets the volume encompassed by the ellipsoid
 float getXRadius()
          Gets the x-radius
 boolean hit(Speck sender, SpeckPosition senderOrientation, Speck target, SpeckPosition targetOrientation)
          Checks to see if the sender can reach the target.
 void setMaxRange(float range)
          Sets the length of the largest radii in the ellipse.
 void setMinRange(float range)
          Sets the length of the smallest radii in the ellipse
 void setOrientationOffset(SpeckPosition offset)
          Sets the offset that this shell will have with respect to the position and orientation of the owning speck
 void setVolume(float volume)
          Sets the volume of the ellipsoid.
 void setXRadius(float xRadius)
          Sets the x-radius of the shell.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

radius

@ConfigurableVariable(value="Radius")
@Description(value="The radii of the ellipsoid")
@NumberRange(value={0.0f,0.0f,0.0f,1.0f,1.0f,1.0f})
@Priority(value=1)
public Vector3f radius
The radius of the ellipse


preserveProportions

@ConfigurableVariable(value="Preserve proportions")
@Description(value="Preserve the ellipsoid proportions when setting the min and max ranges")
@Priority(value=3)
public boolean preserveProportions
When true, setting the min or max range will preserve the relative proportions of the ellipsoid. When false, the proportions are not preserved.


bitrate

@ConfigurableVariable(value="Bit rate")
@Description(value="The bit rate of the shell, in kbps")
@NumberRange(value={0.0f,1024.0f})
@Priority(value=6)
public float bitrate
The bit rate of the shell


channel

@ConfigurableVariable(value="Channel")
@Description(value="Transmissions on different channels do not interfere with each other")
@Priority(value=7)
public int channel
The channel id

Constructor Detail

EllipsoidShell

public EllipsoidShell()

EllipsoidShell

public EllipsoidShell(EllipsoidShell 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.

getRadius

public Vector3f getRadius()
Gets the current emission radii of this shell

Returns:
The emission radii

setMaxRange

@ConfigurableVariable(value="Maximum range")
@Description(value="The size of the largest radii")
@NumberRange(value={0.0f,1.0f})
@Priority(value=4)
public void setMaxRange(float range)
Sets the length of the largest radii in the ellipse.

Parameters:
range - The desired length of the largest radii in the ellipse

getMaxRange

@ConfigurableVariable(value="Maximum range")
public float getMaxRange()
Gets the length of the largest radii in the ellipse. i.e.: The maximum range at which communication can occur

Returns:
The length of the largest radii

setMinRange

@ConfigurableVariable(value="Minimum range")
@Description(value="The size of the smallest radii")
@NumberRange(value={0.0f,1.0f})
@Priority(value=5)
public void setMinRange(float range)
Sets the length of the smallest radii in the ellipse

Parameters:
range - The desired length of the smallest radii

getMinRange

@ConfigurableVariable(value="Minimum range")
public float getMinRange()
Gets the length of the smallest radii in the ellipse. i.e.: The minimum range at which communication can occur

Returns:
The length of the smallest radii

setVolume

@ConfigurableVariable(value="Volume")
@Description(value="The volume of the ellipsoid")
@NumberRange(value={0.0f,4.188790321350098f})
@Priority(value=2)
public void setVolume(float volume)
Sets the volume of the ellipsoid. The lengths of the ellipsoid's axes are scaled uniformly, ie: they will retain the same proportions to each other

Parameters:
volume - The desired volume

getVolume

@ConfigurableVariable(value="Volume")
public float getVolume()
Gets the volume encompassed by the ellipsoid

Returns:
The ellipsoid's volume

getOrientationOffset

public SpeckPosition getOrientationOffset()
Gets the offset that this shell has from the position and orientation of the owning speck

Returns:
The offset from the owning speck and the origin of the shell

setOrientationOffset

public void setOrientationOffset(SpeckPosition offset)
Sets the offset that this shell will have with respect to the position and orientation of the owning speck

Parameters:
offset - The new offset

setXRadius

@ConfigurableVariable(value="X radius")
@Description(value="The radius of the ellipsoid on the x-axis")
@NumberRange(value={0.0f,1.0f})
@Priority(value=8)
public void setXRadius(float xRadius)
Sets the x-radius of the shell. Helpful when plotting against ellipticality

Parameters:
xRadius - The new x radius

getXRadius

@ConfigurableVariable(value="X radius")
public float getXRadius()
Gets the x-radius

Returns:
the x-radius

clone

public EllipsoidShell 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