sims.dynamics

class World

[source: sims/dynamics/World.scala]

class World
extends AnyRef
A world contains and simulates a system of rigid bodies and joints.
Value Summary
val bodies : scala.collection.mutable.ArrayBuffer[Body]
Bodies contained in this world.
val detector : Detector
Collsion detector who manages collision detection in this world.
var enableCollisionDetection : Boolean
Flag to enable collision detection.
var enablePositionCorrection : Boolean
Flag to enable position correction for constraints.
var gravity : Vector2D
Gravity in this world.
var iterations : Int
Number of constraint corrections per time step.
val joints : scala.collection.mutable.ArrayBuffer[Joint]
Joints contained in this world.
var minAngularVelocity : Double
Minimal, non-zero angular velocity.
var minLinearVelocity : Double
Minimal, non-zero linear velocity.
val monitors : scala.collection.mutable.ArrayBuffer[(java.lang.String, (Body) => java.lang.String)]
Monitoring methods for bodies.
var overCWarning : Boolean
Warning if a body's velocity exceeds the speed of light.
var time : Double
Current time in this world.
var timeStep : Double
Time intervals in which this world simulates.
Method Summary
def ++= (bs : scala.Seq[Body]) : Unit
Adds the given sequence of bodies to this world.
def += (body : Body) : Unit
Adds the given body to this world.
def += (p : Prefab) : Unit
Adds the given prefabricated system of bodies and joints to this world.
def += (joint : Joint) : Unit
Adds the given joint to this world.
def --= (bs : scala.Seq[Body]) : Unit
Removes the given sequence of bodies from this world.
def -= (p : Prefab) : Unit
Removes the given prefabricated system of bodies and joints from this world.
def -= (body : Body) : Unit
Removes the given body from this world.
def -= (joint : Joint) : Unit
Removes the given joint from this world.
def clear : Unit
Removes all bodies, joints and monitoring methods from this world.
def info : java.lang.String
Returns information about this world.
def postStep : Unit
Initially empty method that is executed after each time step. This method may be overriden to create custom behaviour in a world.
def shapes : scala.Seq[Shape]
Returns all shapes of all bodies in this world.
def step : Unit
Simulates a time step of the duration timeStep.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
var timeStep : Double
Time intervals in which this world simulates.

var iterations : Int
Number of constraint corrections per time step.

var gravity : Vector2D
Gravity in this world.

val bodies : scala.collection.mutable.ArrayBuffer[Body]
Bodies contained in this world.

val joints : scala.collection.mutable.ArrayBuffer[Joint]
Joints contained in this world.

val monitors : scala.collection.mutable.ArrayBuffer[(java.lang.String, (Body) => java.lang.String)]
Monitoring methods for bodies.

The first element of the tuple is the method's title and the second the method. Example usage: monitors += ("Y-Position", _.pos.y.toString) This will calculate all bodies - whose monitor field is set to true - second position components.


val detector : Detector
Collsion detector who manages collision detection in this world.

var overCWarning : Boolean
Warning if a body's velocity exceeds the speed of light.

var enableCollisionDetection : Boolean
Flag to enable collision detection.

var enablePositionCorrection : Boolean
Flag to enable position correction for constraints.

var minLinearVelocity : Double
Minimal, non-zero linear velocity.

var minAngularVelocity : Double
Minimal, non-zero angular velocity.

var time : Double
Current time in this world.

Method Details
def shapes : scala.Seq[Shape]
Returns all shapes of all bodies in this world.

def +=(body : Body) : Unit
Adds the given body to this world.

def +=(joint : Joint) : Unit
Adds the given joint to this world.

def +=(p : Prefab) : Unit
Adds the given prefabricated system of bodies and joints to this world.

def ++=(bs : scala.Seq[Body]) : Unit
Adds the given sequence of bodies to this world.

def -=(body : Body) : Unit
Removes the given body from this world.

def -=(joint : Joint) : Unit
Removes the given joint from this world.

def -=(p : Prefab) : Unit
Removes the given prefabricated system of bodies and joints from this world.

def --=(bs : scala.Seq[Body]) : Unit
Removes the given sequence of bodies from this world.

def clear : Unit
Removes all bodies, joints and monitoring methods from this world.

def step : Unit
Simulates a time step of the duration timeStep.

The time step is simulated in the following phases:

  1. Forces are applied to bodies.
  2. Accelerations are integrated.
  3. Velocities are corrected.
  4. Velocities are integrated.
  5. Postions are corrected.
  6. The method postStep() is executed.

def postStep : Unit
Initially empty method that is executed after each time step. This method may be overriden to create custom behaviour in a world.

def info : java.lang.String
Returns information about this world.