com.threerings.tudey.shape
Class ShapeElement

java.lang.Object
  extended by com.threerings.tudey.space.SimpleSpaceElement
      extended by com.threerings.tudey.shape.ShapeElement
All Implemented Interfaces:
SpaceElement, SpaceObject

public class ShapeElement
extends SimpleSpaceElement

A shape element.


Constructor Summary
ShapeElement(Shape localShape)
          Creates a new shape element.
ShapeElement(ShapeConfig config)
          Creates a new shape element.
 
Method Summary
 boolean getIntersection(Ray2D ray, Vector2f result)
          Finds the intersection of a ray with this element and places it in the supplied vector (if it exists).
 Shape getLocalShape()
          Returns a reference to the element's local shape.
 void getNearestPoint(Vector2f point, Vector2f result)
          Finds the nearest point of this element to the supplied point and places it in the supplied vector.
 Shape getWorldShape()
          Returns a reference to the element's transformed shape.
 boolean intersects(Capsule capsule)
          Determines whether this element intersects the supplied capsule.
 boolean intersects(Circle circle)
          Determines whether this element intersects the supplied circle.
 boolean intersects(Compound compound)
          Determines whether this element intersects the supplied compound.
 boolean intersects(Point point)
          Determines whether this element intersects the supplied point.
 boolean intersects(Polygon polygon)
          Determines whether this element intersects the supplied polygon.
 boolean intersects(Segment segment)
          Determines whether this element intersects the supplied segment.
 void setConfig(ShapeConfig config)
          Sets the configuration of the shape.
 void setLocalShape(Shape shape)
          Sets the local shape reference.
 void updateBounds()
          Updates the bounds of the element.
 
Methods inherited from class com.threerings.tudey.space.SimpleSpaceElement
getBounds, getSpace, getTransform, getUserObject, intersects, setTransform, setUserObject, updateLastVisit, wasAdded, willBeRemoved
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeElement

public ShapeElement(ShapeConfig config)
Creates a new shape element.


ShapeElement

public ShapeElement(Shape localShape)
Creates a new shape element.

Method Detail

setConfig

public void setConfig(ShapeConfig config)
Sets the configuration of the shape.


setLocalShape

public void setLocalShape(Shape shape)
Sets the local shape reference.


getLocalShape

public Shape getLocalShape()
Returns a reference to the element's local shape.


getWorldShape

public Shape getWorldShape()
Returns a reference to the element's transformed shape.


updateBounds

public void updateBounds()
Description copied from class: SimpleSpaceElement
Updates the bounds of the element.

Specified by:
updateBounds in class SimpleSpaceElement

getIntersection

public boolean getIntersection(Ray2D ray,
                               Vector2f result)
Description copied from interface: SpaceElement
Finds the intersection of a ray with this element and places it in the supplied vector (if it exists).

Specified by:
getIntersection in interface SpaceElement
Overrides:
getIntersection in class SimpleSpaceElement
Returns:
true if the ray intersected the element (in which case the result will contain the point of intersection), false otherwise.

getNearestPoint

public void getNearestPoint(Vector2f point,
                            Vector2f result)
Description copied from interface: SpaceElement
Finds the nearest point of this element to the supplied point and places it in the supplied vector.

Specified by:
getNearestPoint in interface SpaceElement
Overrides:
getNearestPoint in class SimpleSpaceElement

intersects

public boolean intersects(Point point)
Description copied from interface: SpaceElement
Determines whether this element intersects the supplied point.

Specified by:
intersects in interface SpaceElement
Overrides:
intersects in class SimpleSpaceElement

intersects

public boolean intersects(Segment segment)
Description copied from interface: SpaceElement
Determines whether this element intersects the supplied segment.

Specified by:
intersects in interface SpaceElement
Overrides:
intersects in class SimpleSpaceElement

intersects

public boolean intersects(Circle circle)
Description copied from interface: SpaceElement
Determines whether this element intersects the supplied circle.

Specified by:
intersects in interface SpaceElement
Overrides:
intersects in class SimpleSpaceElement

intersects

public boolean intersects(Capsule capsule)
Description copied from interface: SpaceElement
Determines whether this element intersects the supplied capsule.

Specified by:
intersects in interface SpaceElement
Overrides:
intersects in class SimpleSpaceElement

intersects

public boolean intersects(Polygon polygon)
Description copied from interface: SpaceElement
Determines whether this element intersects the supplied polygon.

Specified by:
intersects in interface SpaceElement
Overrides:
intersects in class SimpleSpaceElement

intersects

public boolean intersects(Compound compound)
Description copied from interface: SpaceElement
Determines whether this element intersects the supplied compound.

Specified by:
intersects in interface SpaceElement
Overrides:
intersects in class SimpleSpaceElement


Copyright © 2011. All Rights Reserved.