ballWorlds
Interface Morphable

All Known Subinterfaces:
Ball

public interface Morphable

A Morphable is an object that can be "morphed" in various ways: for example, changing its position, velocity, mass, size, Shape or World.

Author:
David Mutchler, Salman Azhar, Curt Clifton and others, January 2005. Modified September 2008, September 2009.

Method Summary
 void applyForce(Point2D force)
          Applies the given force (in the x and y directions) to this Morphable.
 void moveTo(Point2D point)
          Moves this Morphable object to the given Point2D, by setting the Morphable's position (part of its Shape) to the given Point2D.
 void moveTo(Point2D point, World world)
          Moves this Morphable object to the given Point2D in the given World.
 void moveTo(World world)
          Moves this Morphable object from its current World to the given World, but maintaining the same position (point) at which the Morphable currently lives.
 void multiplySize(double multiplier)
          Multiplies this Morphable object's size by the given multiplier, thus either shrinking (multiplier < 1) or expanding (multiplier > 1) this Morphable object's size.
 void setMass(double mass)
          Sets this Morphable object's mass to the given mass.
 void setShape(Shape shape)
          Sets the Shape of this Morphable object to the given Shape.
 void setSize(double size)
          Sets this Morphable object's size to the given size.
 void setVelocity(Point2D velocity)
          Sets the velocity (i.e., speed in x-direction and speed in y-direction) of this Morphable object to the given velocity.
 

Method Detail

moveTo

void moveTo(Point2D point)
Moves this Morphable object to the given Point2D, by setting the Morphable's position (part of its Shape) to the given Point2D.

Parameters:
point - the Point2D to which this Morphable object should move.

moveTo

void moveTo(World world)
Moves this Morphable object from its current World to the given World, but maintaining the same position (point) at which the Morphable currently lives.

Parameters:
world - the World to which this Morphable object should move.

moveTo

void moveTo(Point2D point,
            World world)
Moves this Morphable object to the given Point2D in the given World.

Parameters:
point - the Point2D to which this Morphable object should move.
world - the World to which this Morphable object should move.

applyForce

void applyForce(Point2D force)
Applies the given force (in the x and y directions) to this Morphable.

Parameters:
force - force (in the x and y directions) to apply to this Morphable.

setVelocity

void setVelocity(Point2D velocity)
Sets the velocity (i.e., speed in x-direction and speed in y-direction) of this Morphable object to the given velocity.

Parameters:
velocity - the new velocity for this Morphable object.

multiplySize

void multiplySize(double multiplier)
Multiplies this Morphable object's size by the given multiplier, thus either shrinking (multiplier < 1) or expanding (multiplier > 1) this Morphable object's size. The size of an object should be incorporated into its Shape.

Parameters:
multiplier - number to multiply this Morphable object's size by.

setSize

void setSize(double size)
Sets this Morphable object's size to the given size. The size of an object should be incorporated in its Shape.

Parameters:
size - size to set this Morphable object's size to.

setMass

void setMass(double mass)
Sets this Morphable object's mass to the given mass.

Parameters:
mass - mass to set this Morphable object's mass to.

setShape

void setShape(Shape shape)
Sets the Shape of this Morphable object to the given Shape.

Parameters:
shape - the new Shape for this Morphable object.