# Class: dspace

Spaces are grouping geoms and are doing the collisiondetection on the geoms inside of them. You can insert space into spaces, which should be done for performance reasons. For example, you may want to create a space that does not test it's geoms inside with each other, while it should create with the rest of the environment.

## Hierarchy

    o-+ ode
      o-+ dcollider
        o-+ dspace
          o-- dspacehash
          o-- dspacequad
          o-- dspacesimple

## Methods:

### Method overview:

- add
- collidetest
- delete
- geomcount
- get
- query
- remove

add (dspace space, dcollider geom)
  returns: ()
  adds a geom to the space
collidetest (dspace space,[int])
  returns: ([int])
  if collidetest is true, the space's objects are tested against each other. It is usefull to create a 'static' space without collidetest that contains no bodies and inserting this space into a 'dynamic' space that contains bodies. That way, a lot of collisiontesting can be avoided and the simulation runs faster.
delete (dspace space,[boolean cleanup])
  returns: ()
  destroys a space. If cleanup is true it will delete the geoms that are in the space.
geomcount (dspace space)
  returns: (int count)
  Return the number of geoms contained within a space.
get (dspace space, int i)
  returns: ([dcollider])
  Return the i'th geom contained within the space. i must range from 0 to dSpaceGetNumGeoms()-1. If any change is made to the space (including adding and deleting geoms) then no guarantee can be made about how the index number of any particular geom will change. Thus no space changes should be made while enumerating the geoms. This function is guaranteed to be fastest when the geoms are accessed in the order 0,1,2,etc.Other non-sequential orders may result in slower access, depending on the internal implementation.
query (pscape space, dcollider geom)
  returns: (boolean isin)
  returns true if the geom is in the space
remove (dspace space, dcollider geom)
  returns: ()
  removes the geom from the space

## Inherited Methods:

### From dcollider

delete