|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.java.dev.joode.geom.Geom
net.java.dev.joode.space.Space
public abstract class Space
Spaces are fundamental to collision detection, as they handle the collidable Geoms.
Because Spaces are themselves Geoms, a Space can be added to another Space. This can
improve collision detection significantly, especially if the different spaces are on great
parts disjoint.
There are several different types of Spaces:
-SimpleSpace
-OctTreeSpace
-HashSpace (this space is not yet implemented)
| Field Summary |
|---|
| 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 | |
|---|---|
protected |
Space()
used for cloning |
|
Space(Space parent,
int type)
Creates a new Space and adds it to parent. |
| Method Summary | |
|---|---|
abstract void |
add(Geom g)
adds a Geom to this Space. |
void |
addBodyGeoms(Body b)
Adds all Geoms associated with the Body |
void |
addGeomListener(GeomListener l)
|
static boolean |
canCollide(Geom g1,
Geom g2,
boolean ignoreStatic)
|
abstract void |
cleanGeoms()
turn all dirty geoms into clean geoms by computing their AABBs and any other space data structures that are required. |
void |
clonePartialSpace(Space partialClone,
ClonedReferences util)
|
abstract void |
collide(java.lang.Object data,
NearCallback callback)
tests for collisions of the Geoms in this Space with each other. |
abstract void |
collide2(java.lang.Object data,
Geom geom,
NearCallback callback)
tests for collisions of a Geom with the Geoms in this Space |
static boolean |
collideAABBs(Geom g1,
Geom g2,
java.lang.Object data,
NearCallback callback)
collides two Geoms, but it first performs some simple AABB-tests |
void |
computeAABB()
computes the AABB of this Space. |
static void |
dGeomMoved(Geom g)
from the bottom of the space hierarchy up, process all clean geoms turning them into dirty geoms. |
static void |
dSpaceCollide2(Geom g1,
Geom g2,
java.lang.Object data,
NearCallback callback)
collides two Spaces or Geoms with eachother and themselves |
protected abstract java.util.Iterator<Geom> |
getGeoms()
returns an Iterator through all GeomS in this Space |
abstract void |
getGeoms(java.util.List<Geom> geoms)
adds all the geoms in this space to the passed in list |
abstract int |
getNumGeoms()
returns the Number of Geoms in this Space |
protected abstract boolean |
isEmpty()
tests, if this is Space is empty |
protected void |
notifyGeomAdded(Geom geom)
|
protected void |
notifyGeomRemoved(Geom geom)
|
boolean |
query(Geom g)
tests, if the parent space of a Geom is this Space |
abstract void |
remove(Geom g)
removes the Geom from this Space. |
void |
removeBodyGeoms(Body b)
|
void |
removeGeomListener(GeomListener l)
|
static boolean |
testAABBs(float[] bounds1,
float[] bounds2)
tests, if bounds1 does not intersect bounds2 |
| 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 |
| Methods inherited from interface net.java.dev.joode.SimState |
|---|
cloneState |
| Constructor Detail |
|---|
public Space(Space parent,
int type)
parent - the space, that is going to be the parent of this space - null is legaltype - the type of the Space.protected Space()
| Method Detail |
|---|
public void computeAABB()
computeAABB in class Geompublic boolean query(Geom g)
g - the Geom to testprotected abstract boolean isEmpty()
protected abstract java.util.Iterator<Geom> getGeoms()
public abstract int getNumGeoms()
public abstract void getGeoms(java.util.List<Geom> geoms)
geoms -
public static boolean canCollide(Geom g1,
Geom g2,
boolean ignoreStatic)
public abstract void cleanGeoms()
public abstract void collide(java.lang.Object data,
NearCallback callback)
data - the World of collisioncallback - the callback for the collision
public abstract void collide2(java.lang.Object data,
Geom geom,
NearCallback callback)
data - the World of collisiongeom - the Geom to collide with this Space.callback - the callback for the collisionpublic abstract void add(Geom g)
g - the Geom to addpublic void addBodyGeoms(Body b)
b - public abstract void remove(Geom g)
g - the Geom to removepublic void removeBodyGeoms(Body b)
public static void dGeomMoved(Geom g)
g - the moved Geom
public static boolean testAABBs(float[] bounds1,
float[] bounds2)
bounds1 - the first bounds with typical aabb formatbounds2 - the second bounds with typical aabb format
public static boolean collideAABBs(Geom g1,
Geom g2,
java.lang.Object data,
NearCallback callback)
g1 - the first Geom to collideg2 - the second Geom to collidedata - some datacallback - the callback for the collision
public static void dSpaceCollide2(Geom g1,
Geom g2,
java.lang.Object data,
NearCallback callback)
g1 - the first Geom (Space) to collideg2 - the second Geom (Space) to collidedata - some datacallback - the callback for the collisionpublic void addGeomListener(GeomListener l)
public void removeGeomListener(GeomListener l)
protected void notifyGeomAdded(Geom geom)
protected void notifyGeomRemoved(Geom geom)
public void clonePartialSpace(Space partialClone,
ClonedReferences util)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||