sims.dynamics

World

class World extends AnyRef

A world contains and simulates a system of rigid bodies and joints.

Inherits

  1. AnyRef
  2. Any

Value Members

  1. def ++=(bs: Seq[Body]): Unit

    Adds the given sequence of bodies to this world

    Adds the given sequence of bodies to this world.

  2. def +=(p: Prefab): Unit

    Adds the given prefabricated system of bodies and joints to this world

    Adds the given prefabricated system of bodies and joints to this world.

  3. def +=(joint: Joint): Unit

    Adds the given joint to this world

    Adds the given joint to this world.

  4. def +=(body: Body): ArrayBuffer[Body]

    Adds the given body to this world

    Adds the given body to this world.

  5. def --=(bs: Seq[Body]): Unit

    Removes the given sequence of bodies from this world

    Removes the given sequence of bodies from this world.

  6. def -=(p: Prefab): Unit

    Removes the given prefabricated system of bodies and joints from this world

    Removes the given prefabricated system of bodies and joints from this world.

  7. def -=(joint: Joint): Unit

    Removes the given joint from this world

    Removes the given joint from this world.

  8. def -=(body: Body): Unit

    Removes the given body from this world

    Removes the given body from this world.

  9. val bodies: ArrayBuffer[Body]

    Bodies contained in this world

    Bodies contained in this world.

  10. def clear(): Unit

    Removes all bodies, joints and monitoring methods from this world

    Removes all bodies, joints and monitoring methods from this world.

  11. val detector: Detector

    Collsion detector who manages collision detection in this world

    Collsion detector who manages collision detection in this world.

  12. var enableCollisionDetection: Boolean

    Flag to enable collision detection

    Flag to enable collision detection.

  13. var enablePositionCorrection: Boolean

    Flag to enable position correction for constraints

    Flag to enable position correction for constraints.

  14. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an equivalence relation:

    • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
    • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
    • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef ⇐ Any
  15. var gravity: Vector2D

    Gravity in this world

    Gravity in this world.

  16. def hashCode(): Int

    Returns a hash code value for the object

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    definition classes: AnyRef ⇐ Any
  17. def info: String

    Returns information about this world

    Returns information about this world.

  18. var iterations: Int

    Number of constraint corrections per time step

    Number of constraint corrections per time step.

  19. val joints: ArrayBuffer[Joint]

    Joints contained in this world

    Joints contained in this world.

  20. var minAngularVelocity: Double

    Minimal, non-zero angular velocity

    Minimal, non-zero angular velocity.

  21. var minLinearVelocity: Double

    Minimal, non-zero linear velocity

    Minimal, non-zero linear velocity.

  22. val monitors: ArrayBuffer[(String, (Body) ⇒ Any)]

    Monitoring methods for bodies

    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.

  23. var overCWarning: Boolean

    Warning if a body's velocity exceeds the speed of light

    Warning if a body's velocity exceeds the speed of light.

  24. def postStep(): Unit

    Initially empty method that is executed after each time step

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

  25. def shapes: ArrayBuffer[Shape]

    Returns all shapes of all bodies in this world

    Returns all shapes of all bodies in this world.

  26. def step(): Unit

    Simulates a time step of the duration timeStep

    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.

  27. var time: Double

    Current time in this world

    Current time in this world.

  28. var timeStep: Double

    Time intervals in which this world simulates

    Time intervals in which this world simulates.

  29. def toString(): String

    Returns a string representation of the object

    Returns a string representation of the object.

    The default representation is platform dependent.

    definition classes: AnyRef ⇐ Any

Instance constructors

  1. new World()