Class World

java.lang.Object
  extended by World

public class World
extends java.lang.Object

Represents the static objects in the world. Essentially, this is simply a set of surfaces.


Constructor Summary
World(java.util.Collection<Surface> surfaces)
          Constructs a world containing the given surfaces.
 
Method Summary
 Bounds getBounds()
          Returns the bounding box including all surfaces in this world.
 Intersection getClosestIntersection(Ray query)
          Returns information about the intersection of the given ray with the closest surface that it intersects, or null if there is no intersection.
 java.util.Collection<Surface> getSurfaces()
          Returns a collection including all the surfaces of this world.
static World read(java.io.InputStream in)
          Returns a newly created world based on the data found in the given stream.
static World read(java.io.Reader reader)
          Returns a newly created world based on the data found in the given input source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

World

public World(java.util.Collection<Surface> surfaces)
Constructs a world containing the given surfaces.

Parameters:
surfaces - contains the surfaces to be added into this world.
Method Detail

getClosestIntersection

public Intersection getClosestIntersection(Ray query)
Returns information about the intersection of the given ray with the closest surface that it intersects, or null if there is no intersection.

Parameters:
query - the ray that should be traced to determine which surface it intersects first.
Returns:
an Intersection describing information about the first intersection, or null if there is no intersection.

getSurfaces

public java.util.Collection<Surface> getSurfaces()
Returns a collection including all the surfaces of this world. The returned collection should be unmodifiable.

Returns:
the unmodifiable collection including all surfaces in this world.

getBounds

public Bounds getBounds()
Returns the bounding box including all surfaces in this world.

Returns:
the bounding box of the surfaces' union.

read

public static World read(java.io.InputStream in)
                  throws java.io.IOException
Returns a newly created world based on the data found in the given stream.

Throws:
java.io.IOException

read

public static World read(java.io.Reader reader)
                  throws java.io.IOException
Returns a newly created world based on the data found in the given input source.

Throws:
java.io.IOException