com.threerings.tudey.space
Class SimpleSpace

java.lang.Object
  extended by com.threerings.tudey.space.Space
      extended by com.threerings.tudey.space.SimpleSpace

public class SimpleSpace
extends Space

A simple, "flat" space implementation.


Field Summary
protected  ArrayList<SpaceElement> _elements
          The list of all space elements.
 
Fields inherited from class com.threerings.tudey.space.Space
_disposed, _result
 
Constructor Summary
SimpleSpace()
           
 
Method Summary
protected  void addToSpatial(SpaceElement element)
          Adds an element to the space's spatial data structure.
 void getElements(Rect bounds, Collection<SpaceElement> results)
          Retrieves all space elements whose bounds intersect the provided region.
 void getIntersecting(Shape shape, com.google.common.base.Predicate<? super SpaceElement> filter, Collection<SpaceElement> results)
          Retrieves all space elements that intersect the provided shape.
 SpaceElement getIntersection(Ray2D ray, Vector2f location, com.google.common.base.Predicate<? super SpaceElement> filter)
          Checks for an intersection between the provided ray and the contents of the space.
protected  void removeFromSpatial(SpaceElement element)
          Removes an element from the space's spatial data structure.
 
Methods inherited from class com.threerings.tudey.space.Space
add, boundsDidChange, boundsWillChange, dispose, getIntersecting, getIntersecting, getIntersecting, getIntersection, getIntersection, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_elements

protected ArrayList<SpaceElement> _elements
The list of all space elements.

Constructor Detail

SimpleSpace

public SimpleSpace()
Method Detail

getIntersection

public SpaceElement getIntersection(Ray2D ray,
                                    Vector2f location,
                                    com.google.common.base.Predicate<? super SpaceElement> filter)
Description copied from class: Space
Checks for an intersection between the provided ray and the contents of the space.

Specified by:
getIntersection in class Space
location - a vector to populate with the location of the intersection, if any.
filter - a predicate to use in filtering the results of the test.
Returns:
a reference to the first element intersected by the ray, or null for none.

getIntersecting

public void getIntersecting(Shape shape,
                            com.google.common.base.Predicate<? super SpaceElement> filter,
                            Collection<SpaceElement> results)
Description copied from class: Space
Retrieves all space elements that intersect the provided shape.

Specified by:
getIntersecting in class Space
results - a collection to hold the results of the search.

getElements

public void getElements(Rect bounds,
                        Collection<SpaceElement> results)
Description copied from class: Space
Retrieves all space elements whose bounds intersect the provided region.

Specified by:
getElements in class Space
results - a list to hold the results of the search.

addToSpatial

protected void addToSpatial(SpaceElement element)
Description copied from class: Space
Adds an element to the space's spatial data structure.

Specified by:
addToSpatial in class Space

removeFromSpatial

protected void removeFromSpatial(SpaceElement element)
Description copied from class: Space
Removes an element from the space's spatial data structure.

Specified by:
removeFromSpatial in class Space