com.brackeen.javagamebook.math3D
Class PolygonGroup

java.lang.Object
  extended bycom.brackeen.javagamebook.math3D.PolygonGroup
All Implemented Interfaces:
Transformable

public class PolygonGroup
extends java.lang.Object
implements Transformable

The PolygonGroup is a group of polygons with a MovingTransform3D. PolygonGroups can also contain other PolygonGroups.


Constructor Summary
PolygonGroup()
          Creates a new, empty PolygonGroup.
PolygonGroup(java.lang.String name)
          Creates a new, empty PolygonGroup with te specified name.
 
Method Summary
 void add(Transform3D xform)
           
 void add(Vector3D u)
           
 void addPolygon(Polygon3D o)
          Adds a polygon to this group.
 void addPolygonGroup(PolygonGroup p)
          Adds a PolygonGroup to this group.
 void addRotation(Transform3D xform)
           
 java.lang.Object clone()
          Clones this polygon group.
 java.lang.String getFilename()
          Gets the filename of this PolygonGroup.
 PolygonGroup getGroup(java.lang.String name)
          Gets the PolygonGroup in this group with the specified name, or null if none found.
 java.lang.String getName()
          Gets the name of this PolygonGroup.
 MovingTransform3D getTransform()
          Gets the MovingTransform3D for this PolygonGroup.
 boolean hasNext()
          Checks if there is another polygon in the current iteration.
 boolean isEmpty()
          Returns true if there are no polygons in this group.
 Polygon3D nextPolygon()
          Gets the next polygon in the current iteration.
 void nextPolygonTransformed(Polygon3D cache)
          Gets the next polygon in the current iteration, applying the MovingTransform3Ds to it, and storing it in 'cache'.
 void resetIterator()
          Resets the polygon iterator for this group.
 void setFilename(java.lang.String filename)
          Sets the filename of this PolygonGroup.
 void setName(java.lang.String name)
          Sets the name of this PolygonGroup.
 void subtract(Transform3D xform)
           
 void subtract(Vector3D u)
           
 void subtractRotation(Transform3D xform)
           
 void update(long elapsedTime)
          Updates the MovingTransform3Ds of this group and any subgroups.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonGroup

public PolygonGroup()
Creates a new, empty PolygonGroup.


PolygonGroup

public PolygonGroup(java.lang.String name)
Creates a new, empty PolygonGroup with te specified name.

Method Detail

getTransform

public MovingTransform3D getTransform()
Gets the MovingTransform3D for this PolygonGroup.


getName

public java.lang.String getName()
Gets the name of this PolygonGroup.


setName

public void setName(java.lang.String name)
Sets the name of this PolygonGroup.


getFilename

public java.lang.String getFilename()
Gets the filename of this PolygonGroup.


setFilename

public void setFilename(java.lang.String filename)
Sets the filename of this PolygonGroup.


addPolygon

public void addPolygon(Polygon3D o)
Adds a polygon to this group.


addPolygonGroup

public void addPolygonGroup(PolygonGroup p)
Adds a PolygonGroup to this group.


clone

public java.lang.Object clone()
Clones this polygon group. Polygon3Ds are shared between this group and the cloned group; Transform3Ds are copied.


getGroup

public PolygonGroup getGroup(java.lang.String name)
Gets the PolygonGroup in this group with the specified name, or null if none found.


resetIterator

public void resetIterator()
Resets the polygon iterator for this group.

See Also:
hasNext(), nextPolygon()

hasNext

public boolean hasNext()
Checks if there is another polygon in the current iteration.

See Also:
resetIterator(), nextPolygon()

isEmpty

public boolean isEmpty()
Returns true if there are no polygons in this group.


nextPolygon

public Polygon3D nextPolygon()
Gets the next polygon in the current iteration.

See Also:
resetIterator(), hasNext()

nextPolygonTransformed

public void nextPolygonTransformed(Polygon3D cache)
Gets the next polygon in the current iteration, applying the MovingTransform3Ds to it, and storing it in 'cache'.


update

public void update(long elapsedTime)
Updates the MovingTransform3Ds of this group and any subgroups.


add

public void add(Vector3D u)
Specified by:
add in interface Transformable

subtract

public void subtract(Vector3D u)
Specified by:
subtract in interface Transformable

add

public void add(Transform3D xform)
Specified by:
add in interface Transformable

subtract

public void subtract(Transform3D xform)
Specified by:
subtract in interface Transformable

addRotation

public void addRotation(Transform3D xform)
Specified by:
addRotation in interface Transformable

subtractRotation

public void subtractRotation(Transform3D xform)
Specified by:
subtractRotation in interface Transformable