org.jrabbit.standard.game.objects.base
Class Spatial

java.lang.Object
  extended by org.jrabbit.standard.game.objects.base.Spatial
All Implemented Interfaces:
Dimensioned, Located, Rotated, Scaled
Direct Known Subclasses:
BaseSprite

public abstract class Spatial
extends java.lang.Object
implements Dimensioned, Located, Rotated, Scaled

A Spatial is a generic game object. It has no rendering capability, but represents an entity in a 2-dimensional space. To this end, it has a width and a height, a location, rotation, and an x-y scale. Spatial is abstract; it simply provides this base functionality to whatever object may need it. It should be noted that the methods to detect width and height are undefined; these are dependent upon implementation. A Spatial by itself is by no means Renderable, and has no interface with any graphics settings or functionality.

Author:
Chris Molini

Field Summary
protected  Vector2f location
          The location of the Spatial.
protected  Rotation rotation
          The rotation of the Spatial.
protected  Scalar scalar
          The scaling of the Spatial.
 
Constructor Summary
Spatial()
          Creates an unrotated, unscaled Spatial at location [0, 0].
 
Method Summary
 Vector2f location()
          Accesses the Spatial's location.
 Rotation rotation()
          Accesses the Spatial's rotation.
 Scalar scalar()
          Accesses the Spatial's scaling.
 float scaledDiameter()
          Accesses the object's (scaled) dimensions.
 float scaledHeight()
          Accesses the object's (scaled) dimensions.
 float scaledWidth()
          Accesses the object's (scaled) dimensions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jrabbit.base.graphics.types.Dimensioned
height, width
 

Field Detail

location

protected Vector2f location
The location of the Spatial.


rotation

protected Rotation rotation
The rotation of the Spatial.


scalar

protected Scalar scalar
The scaling of the Spatial.

Constructor Detail

Spatial

public Spatial()
Creates an unrotated, unscaled Spatial at location [0, 0].

Method Detail

location

public Vector2f location()
Accesses the Spatial's location.

Specified by:
location in interface Located
Returns:
The Vector2f that controls the location of the Spatial.

rotation

public Rotation rotation()
Accesses the Spatial's rotation.

Specified by:
rotation in interface Rotated
Returns:
The Rotation object that controls the rotation of the Spatial.

scalar

public Scalar scalar()
Accesses the Spatial's scaling.

Specified by:
scalar in interface Scaled
Returns:
The Scalar object that controls the scaling of the Spatial.

scaledWidth

public float scaledWidth()
Accesses the object's (scaled) dimensions.

Returns:
The scaled width of the object.

scaledHeight

public float scaledHeight()
Accesses the object's (scaled) dimensions.

Returns:
The scaled height of the object.

scaledDiameter

public float scaledDiameter()
Accesses the object's (scaled) dimensions.

Returns:
The scaled diameter of the object. This value assumes that the Spatial can be considered a rectangle of the width and height found by getScaledWidth() and getScaledHeight().