sims.dynamics

Body

class Body extends AnyRef

A two dimensional rigid body is made out of shapes.

Inherits

  1. AnyRef
  2. Any

Value Members

  1. def I: Double

    Returns the moment of inertia for rotations about the COM of this body

    Returns the moment of inertia for rotations about the COM of this body. It is calculated using the moments of inertia of this body's shapes and the parallel axis theorem. If the body is fixed, its moment of inertia is infinite (Double.PositiveInfinity).

  2. var angularVelocity: Double

    Angular velocity of this body

    Angular velocity of this body.

  3. def applyForce(force: Vector2D, point: Vector2D): Unit

    Applies a force to a point on this body

    Applies a force to a point on this body. Warning: the point is considered to be contained within this body.

    force

    applied force

    point

    position vector of the point (in world coordinates)

  4. def applyForce(force: Vector2D): Unit

    Applies a force to the COM of this body

    Applies a force to the COM of this body.

    force

    applied force

  5. def applyImpulse(impulse: Vector2D, point: Vector2D): Unit

    Applies an impulse to a point on this body

    Applies an impulse to a point on this body. Warning: the point is considered to be contained within this body.

    impulse

    applied impulse

    point

    position vector of the point (in world coordinates)

  6. def applyImpulse(impulse: Vector2D): Unit

    Applies an impulse to the COM of this body

    Applies an impulse to the COM of this body.

    impulse

    applied impulse

  7. def contains(point: Vector2D): Boolean

    Checks if the point point is contained in this body

    Checks if the point point is contained in this body.

  8. 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
  9. def fixed: Boolean

    Returns whether this body is fixed or not

    Returns whether this body is fixed or not.

  10. def fixed_=(value: Boolean): Unit

    Fixes or frees this body

    Fixes or frees this body. By fixing, linear and angular velocities are set to zero.

  11. var force: Vector2D

    Resulting force on the COM of this body

    Resulting force on the COM of this body.

  12. 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
  13. var linearVelocity: Vector2D

    Linear velocity of this body

    Linear velocity of this body.

  14. def mass: Double

    Returns the mass of this body

    Returns the mass of this body. If the body is free, its mass is the sum of the masses of its shapes. If the body is fixed, its mass is infinite (Double.PositiveInfinity).

  15. var monitor: Boolean

    Flag for a world to monitor the properties of this body

    Flag for a world to monitor the properties of this body.

  16. def pos: Vector2D

    Returns the position of this body

    Returns the position of this body. The position is equivalent to the center of mass.

  17. def pos_=(newPos: Vector2D): Unit

    Sets the position of this body

    Sets the position of this body. By doing so all its shapes are translated.

    newPos

    new position

  18. def rotation: Double

    Returns the current rotation of this body

    Returns the current rotation of this body.

  19. def rotation_=(newRotation: Double): Unit

    Sets the rotation of this body

    Sets the rotation of this body. Position and rotation of shapes are modified accordingly.

  20. val shapes: List[Shape]

    Shapes that belong to this body

    Shapes that belong to this body.

  21. def toString(): String

    Returns a string representation of the object

    Returns a string representation of the object.

    The default representation is platform dependent.

  22. var torque: Double

    Resulting torque on this body

    Resulting torque on this body.

  23. val uid: Int

    Unique identification number

    Unique identification number.

  24. def velocityOfPoint(point: Vector2D): Vector2D

    Linear velocity of the given point on this body (in world coordinates)

    Linear velocity of the given point on this body (in world coordinates).

  25. def ~(b: Body): Body

    Creates a new body containing this body's shapes and the shapes of another body b

    Creates a new body containing this body's shapes and the shapes of another body b.

    b

    body with extra shapes

    returns

    new body

  26. def ~(s: Shape): Body

    Creates a new body containing this body's shapes and the shape s

    Creates a new body containing this body's shapes and the shape s.

    s

    new shape

    returns

    new body

Instance constructors

  1. new Body(shps: Shape*)

  2. new Body()