Package repast.simphony.space.physics
Class DefaultPhysicsSpace<T>
- java.lang.Object
-
- repast.simphony.space.projection.DefaultProjection<T>
-
- repast.simphony.space.continuous.AbstractContinuousSpace<T,Map<NdPoint,Object>>
-
- repast.simphony.space.continuous.DefaultContinuousSpace<T>
-
- repast.simphony.space.physics.DefaultPhysicsSpace<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
ContinuousSpace<T>
,PhysicsSpace<T>
,Projection<T>
- Direct Known Subclasses:
ContextPhysics
public class DefaultPhysicsSpace<T> extends DefaultContinuousSpace<T> implements PhysicsSpace<T>
A special 3-dimensional subclass of continuous space that determines the positions of agents based on physics.- Author:
- Eric Tatara
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class repast.simphony.space.continuous.AbstractContinuousSpace
AbstractContinuousSpace.PointHolder
-
-
Field Summary
Fields Modifier and Type Field Description protected HashMap<com.bulletphysics.dynamics.RigidBody,T>
bodyToObjectMap
protected com.bulletphysics.collision.dispatch.CollisionConfiguration
collisionConfiguration
protected com.bulletphysics.collision.dispatch.CollisionDispatcher
dispatcher
protected com.bulletphysics.dynamics.DiscreteDynamicsWorld
dynamicsWorld
protected int
maxSubSteps
protected HashMap<T,com.bulletphysics.dynamics.RigidBody>
objectToBodyMap
protected com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver
solver
protected float
stepSize
-
Fields inherited from class repast.simphony.space.continuous.AbstractContinuousSpace
accessor, adder, agentLocationMap, dimensions, locationStorage, size, translator
-
Fields inherited from class repast.simphony.space.projection.DefaultProjection
listeners, name
-
-
Constructor Summary
Constructors Constructor Description DefaultPhysicsSpace(String name, ContinuousAdder<T> adder, PointTranslator translator, double[] size, double[] origin)
Constructs this space with the specified name, adder, translator, size and origin.DefaultPhysicsSpace(String name, ContinuousAdder<T> adder, PointTranslator translator, double xdim, double ydim, double zdim)
Constructs this space with the specified name, adder, translator, and size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addObject(T object, com.bulletphysics.dynamics.RigidBody body)
float[]
getGravity()
float[]
getLinearVelocity(T object)
int
getMaxSubSteps()
float
getStepSize()
com.bulletphysics.linearmath.Transform
getTransformForObject(T object)
protected void
initPhysics(boolean scheduleStep)
void
setGravity(float x, float y, float z)
void
setLinearVelocity(T object, float x, float y, float z)
void
setMaxSubSteps(int maxSubSteps)
void
setStepSize(float stepSize)
void
step()
Manually step the physics space dynamics-
Methods inherited from class repast.simphony.space.continuous.DefaultContinuousSpace
createLocationStorage
-
Methods inherited from class repast.simphony.space.continuous.AbstractContinuousSpace
doMove, evaluate, getAdder, getDimensions, getDisplacement, getDistance, getDistanceSq, getLocation, getLocation, getObjectAt, getObjects, getObjectsAt, getPointTranslator, getRandomObjectAt, isPeriodic, moveByDisplacement, moveByVector, moveTo, remove, removeAll, setAdder, setPointTranslator, size
-
Methods inherited from class repast.simphony.space.projection.DefaultProjection
addProjectionListener, fireProjectionEvent, getName, getProjectionListeners, removeProjectionListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface repast.simphony.space.projection.Projection
addProjectionListener, evaluate, getName, getProjectionListeners, removeProjectionListener
-
-
-
-
Field Detail
-
collisionConfiguration
protected com.bulletphysics.collision.dispatch.CollisionConfiguration collisionConfiguration
-
dispatcher
protected com.bulletphysics.collision.dispatch.CollisionDispatcher dispatcher
-
solver
protected com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver solver
-
dynamicsWorld
protected com.bulletphysics.dynamics.DiscreteDynamicsWorld dynamicsWorld
-
stepSize
protected float stepSize
-
maxSubSteps
protected int maxSubSteps
-
-
Constructor Detail
-
DefaultPhysicsSpace
public DefaultPhysicsSpace(String name, ContinuousAdder<T> adder, PointTranslator translator, double xdim, double ydim, double zdim)
Constructs this space with the specified name, adder, translator, and size.- Parameters:
name
- the name of the spaceadder
- the adder used by the spacetranslator
- the point translatorxdim
- the size of the x dimensionydim
- the size of the y dimensionzdim
- the size of the z dimension
-
DefaultPhysicsSpace
public DefaultPhysicsSpace(String name, ContinuousAdder<T> adder, PointTranslator translator, double[] size, double[] origin)
Constructs this space with the specified name, adder, translator, size and origin.- Parameters:
name
- the name of the spaceadder
- the adder used by the spacetranslator
- the point translatorsize
- the dimensions of the spaceorigin
- the origin of the space
-
-
Method Detail
-
initPhysics
protected void initPhysics(boolean scheduleStep)
-
addObject
public boolean addObject(T object, com.bulletphysics.dynamics.RigidBody body)
- Specified by:
addObject
in interfacePhysicsSpace<T>
-
getTransformForObject
public com.bulletphysics.linearmath.Transform getTransformForObject(T object)
- Specified by:
getTransformForObject
in interfacePhysicsSpace<T>
-
step
public void step()
Description copied from interface:PhysicsSpace
Manually step the physics space dynamics- Specified by:
step
in interfacePhysicsSpace<T>
-
setLinearVelocity
public void setLinearVelocity(T object, float x, float y, float z)
- Specified by:
setLinearVelocity
in interfacePhysicsSpace<T>
-
getLinearVelocity
public float[] getLinearVelocity(T object)
- Specified by:
getLinearVelocity
in interfacePhysicsSpace<T>
-
setGravity
public void setGravity(float x, float y, float z)
- Specified by:
setGravity
in interfacePhysicsSpace<T>
-
getGravity
public float[] getGravity()
- Specified by:
getGravity
in interfacePhysicsSpace<T>
-
getStepSize
public float getStepSize()
- Specified by:
getStepSize
in interfacePhysicsSpace<T>
-
setStepSize
public void setStepSize(float stepSize)
- Specified by:
setStepSize
in interfacePhysicsSpace<T>
-
getMaxSubSteps
public int getMaxSubSteps()
- Specified by:
getMaxSubSteps
in interfacePhysicsSpace<T>
-
setMaxSubSteps
public void setMaxSubSteps(int maxSubSteps)
- Specified by:
setMaxSubSteps
in interfacePhysicsSpace<T>
-
-