com.speckled.specksim
Class Wall

java.lang.Object
  extended by com.speckled.specksim.Wall

public class Wall
extends java.lang.Object

Represents a simple triangular wall that is opaque to all transmissions. Extend this class and override the blocksTransmission() method for different behaviour

Author:
ryanm

Constructor Summary
Wall(java.io.DataInputStream dis)
          Constructs a new wall from the stream
Wall(Point3d v1, Point3d v2, Point3d v3)
          Constructs a new Wall.
 
Method Summary
 boolean blocksTransmission(Point3d p1, Point3d p2, MessageShell shell)
          Determines if this wall blocks a transmission
 void encode(java.io.DataOutputStream dos)
          Encodes the vertices to the stream
 Point3d[] getBoundingBox()
          Gets an axis aligned bounding box for this wall
 Point3d v1()
          Get the first vertex
 Point3d v2()
          Get the second vertex
 Point3d v3()
          Get the third vertex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Wall

public Wall(Point3d v1,
            Point3d v2,
            Point3d v3)
Constructs a new Wall. The vertices cannot be altered after construction

Parameters:
v1 - The first vertex
v2 - The second vertex
v3 - The third vertex

Wall

public Wall(java.io.DataInputStream dis)
     throws java.io.IOException
Constructs a new wall from the stream

Parameters:
dis - The stream to read from
Throws:
java.io.IOException
Method Detail

encode

public void encode(java.io.DataOutputStream dos)
            throws java.io.IOException
Encodes the vertices to the stream

Parameters:
dos - The stream to write to
Throws:
java.io.IOException

blocksTransmission

public boolean blocksTransmission(Point3d p1,
                                  Point3d p2,
                                  MessageShell shell)
Determines if this wall blocks a transmission

Parameters:
p1 - The origin of the transmission
p2 - The target of the transmission
shell - The shell used in this transmission
Returns:
true if the wall blocks the transmission, false otherwise

getBoundingBox

public Point3d[] getBoundingBox()
Gets an axis aligned bounding box for this wall

Returns:
A two-element Point3d array. The first element is the vertex of the bounding box closest to (-∞, -∞, -∞ ), the second is the vertex closest to ( ∞, ∞, ∞ )

v1

public Point3d v1()
Get the first vertex

Returns:
the first vertex

v2

public Point3d v2()
Get the second vertex

Returns:
the second vertex

v3

public Point3d v3()
Get the third vertex

Returns:
the third vertex