com.brackeen.javagamebook.math3D
Class Rectangle3D

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

public class Rectangle3D
extends java.lang.Object
implements Transformable

A Rectangle3D is a rectangle in 3D space, defined as an origin and vectors pointing in the directions of the base (width) and side (height).


Constructor Summary
Rectangle3D()
          Creates a rectangle at the origin with a width and height of zero.
Rectangle3D(Vector3D origin, Vector3D directionU, Vector3D directionV, float width, float height)
          Creates a new Rectangle3D with the specified origin, direction of the base (directionU) and direction of the side (directionV).
 
Method Summary
 void add(Transform3D xform)
           
 void add(Vector3D u)
           
 void addRotation(Transform3D xform)
           
 Vector3D getDirectionU()
          Gets the direction of the base of this Rectangle3D.
 Vector3D getDirectionV()
          Gets the direction of the side of this Rectangle3D.
 float getHeight()
          Gets the height of this Rectangle3D.
 Vector3D getNormal()
          Gets the normal of this Rectangle3D.
 Vector3D getOrigin()
          Gets the origin of this Rectangle3D.
 float getWidth()
          Gets the width of this Rectangle3D.
 void setHeight(float height)
          Sets the height of this Rectangle3D.
 void setNormal(Vector3D n)
          Sets the normal of this Rectangle3D.
 void setTo(Rectangle3D rect)
          Sets the values of this Rectangle3D to the specified Rectangle3D.
 void setWidth(float width)
          Sets the width of this Rectangle3D.
 void subtract(Transform3D xform)
           
 void subtract(Vector3D u)
           
 void subtractRotation(Transform3D xform)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rectangle3D

public Rectangle3D()
Creates a rectangle at the origin with a width and height of zero.


Rectangle3D

public Rectangle3D(Vector3D origin,
                   Vector3D directionU,
                   Vector3D directionV,
                   float width,
                   float height)
Creates a new Rectangle3D with the specified origin, direction of the base (directionU) and direction of the side (directionV).

Method Detail

setTo

public void setTo(Rectangle3D rect)
Sets the values of this Rectangle3D to the specified Rectangle3D.


getOrigin

public Vector3D getOrigin()
Gets the origin of this Rectangle3D.


getDirectionU

public Vector3D getDirectionU()
Gets the direction of the base of this Rectangle3D.


getDirectionV

public Vector3D getDirectionV()
Gets the direction of the side of this Rectangle3D.


getWidth

public float getWidth()
Gets the width of this Rectangle3D.


setWidth

public void setWidth(float width)
Sets the width of this Rectangle3D.


getHeight

public float getHeight()
Gets the height of this Rectangle3D.


setHeight

public void setHeight(float height)
Sets the height of this Rectangle3D.


getNormal

public Vector3D getNormal()
Gets the normal of this Rectangle3D.


setNormal

public void setNormal(Vector3D n)
Sets the normal of this Rectangle3D.


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