net.java.dev.joode.geom
Class Rectangle

java.lang.Object
  extended by net.java.dev.joode.geom.Geom
      extended by net.java.dev.joode.geom.Rectangle
All Implemented Interfaces:
java.io.Serializable, SimState

public class Rectangle
extends Geom

A 2D geometry primative of a rectangle. The rectangle can be placed within the X-Y plane. The height of the shape in the Z dir is assumed to be infinite. The rectangle is compatible with 3D spaces. Currently incomplete, this does not handle anything to do with collisions or living in a space, jsut a placeholder currently

See Also:
Serialized Form

Field Summary
 float halfheight
           
 float halfwidth
           
static float[] u1
           
static float[] u2
           
 
Fields inherited from class net.java.dev.joode.geom.Geom
aabb, AABB_MAX_X, AABB_MAX_Y, AABB_MAX_Z, AABB_MIN_X, AABB_MIN_Y, AABB_MIN_Z, body, category_bits, collide_bits, dBoxClass, dCapsuleClass, dCircle, dConvex, dCylinderClass, dFirstSpaceClass, dFirstUserClass, dGeomNumClasses, dGeomTransformClass, dHashSpaceClass, dLastSpaceClass, dLastUserClass, dMaxUserClasses, dOctTreeSpaceClass, dPlaneClass, dQuadTreeSpaceClass, dRayClass, dRectangle, dSimpleSpaceClass, dSphereClass, dTriMeshClass, GEOM_AABB_BAD, GEOM_DIRTY, GEOM_ENABLED, GEOM_PLACEABLE, gflags, lpos, parent_space, pos, R, RAY_BACKFACECULL, RAY_CLOSEST_HIT, RAY_FIRSTCONTACT, tmpq, type
 
Constructor Summary
Rectangle(Space parent, float width, float height)
           
 
Method Summary
 Rectangle cloneState(ClonedReferences util)
           deep clones the state object, any references to other SimState objects should be cloned and assigned to the clone via the ClonedReferences util object.
 void computeAABB()
          compute the AABB for this object and put it in aabb.
 float getHeight()
           
 void getVetex(int vertex, float[] coordPassback)
          vertices numbered clockwise vertex 0 is the top left (posative height, negative width) vertex 1 is the top right (posative height, posative width) vertex 2 is the bottom right (negative height, posative width) vertex 3 is the bottom left (negative height, negative width) returns the absolute x, y coords of that vertex in the passback.
 void getVetex(int vertex, Vector2 coordPassback)
          vertices numbered clockwise vertex 0 is the top left (posative height, negative width) vertex 1 is the top right (posative height, posative width) vertex 2 is the bottom right (negative height, posative width) vertex 3 is the bottom left (negative height, negative width) returns the absolute x, y coords of that vertex in the passback.
 float getWidth()
           
 float pointDepth(float x, float y, float z)
          returns the penetration depth (smallest possible) can be negative, indicating the smallest distance to the point
 void setHeight(float height)
           
 void setWidth(float width)
           
 
Methods inherited from class net.java.dev.joode.geom.Geom
AABBTest, clonePartialGeom, destroy, getAABB, getUserData, isEnabled, recomputeAABB, setBody, setPosition, setQuaternion, setQuaternion, setRotation, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

halfwidth

public float halfwidth

halfheight

public float halfheight

u1

public static float[] u1

u2

public static float[] u2
Constructor Detail

Rectangle

public Rectangle(Space parent,
                 float width,
                 float height)
Method Detail

computeAABB

public void computeAABB()
Description copied from class: Geom
compute the AABB for this object and put it in aabb. this function always performs a fresh computation, it does not inspect the GEOM_AABB_BAD flag.

Specified by:
computeAABB in class Geom

getVetex

public void getVetex(int vertex,
                     float[] coordPassback)
vertices numbered clockwise vertex 0 is the top left (posative height, negative width) vertex 1 is the top right (posative height, posative width) vertex 2 is the bottom right (negative height, posative width) vertex 3 is the bottom left (negative height, negative width) returns the absolute x, y coords of that vertex in the passback.

Parameters:
vertex -
coordPassback -

getVetex

public void getVetex(int vertex,
                     Vector2 coordPassback)
vertices numbered clockwise vertex 0 is the top left (posative height, negative width) vertex 1 is the top right (posative height, posative width) vertex 2 is the bottom right (negative height, posative width) vertex 3 is the bottom left (negative height, negative width) returns the absolute x, y coords of that vertex in the passback.

Parameters:
vertex -
coordPassback -

getWidth

public float getWidth()

setWidth

public void setWidth(float width)

getHeight

public float getHeight()

setHeight

public void setHeight(float height)

pointDepth

public float pointDepth(float x,
                        float y,
                        float z)
returns the penetration depth (smallest possible) can be negative, indicating the smallest distance to the point

Parameters:
x -
y -
z -
Returns:

cloneState

public Rectangle cloneState(ClonedReferences util)
Description copied from interface: SimState

deep clones the state object, any references to other SimState objects should be cloned and assigned to the clone via the ClonedReferences util object. The util object ensures that multiple clones of the same object are not performed during a clone operation.

Parameters:
util - instanciate a new one if top level cloning