All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class primitives.machines.TwolegsMachine

java.lang.Object
   |
   +----primitives.machines.Machine
           |
           +----primitives.machines.TwolegsMachine

public class TwolegsMachine
extends Machine
A missleading name for this class. A class originaly used to draw a 2 legs machine was generelized to manipulate a machine with one anchor and a series of connected joints starting from the anchor.

See Also:
TwoLegDemo, TwoLegSpaceDemo

Variable Index

 o angles
A list of current angles between adjacent joints.
 o distances
A list of the machine's rigid bars' lenghts.
 o legs
Numner of legs in the machine.

Constructor Index

 o TwolegsMachine(Dimension, int)
Initializes a machine with a given number of legs.

Method Index

 o redraw(Graphics)
Draws the machine.
 o rotateJoint(int, double)
Rotates the machine by physically rotating the specified joint.

Variables

 o legs
 public int legs
Numner of legs in the machine. [should be private]

 o angles
 double angles[]
A list of current angles between adjacent joints. Used to preform rotations.

See Also:
rotateJoint
 o distances
 double distances[]
A list of the machine's rigid bars' lenghts.

Constructors

 o TwolegsMachine
 public TwolegsMachine(Dimension d,
                       int legs)
Initializes a machine with a given number of legs.

Parameters:
d - the size of the rectangle to draw the machine in.
legs - the number of legs of the machine.

Methods

 o redraw
 public void redraw(Graphics g)
Draws the machine.

Parameters:
g - the grapic context to draw to.
Overrides:
redraw in class Machine
See Also:
MachineListener
 o rotateJoint
 public void rotateJoint(int leg,
                         double dalpha)
Rotates the machine by physically rotating the specified joint.

Parameters:
leg - rotate the machine starting from this joint.
dalpha - the amount in radians to rotate the specified joint.
See Also:
rotateJoint

All Packages  Class Hierarchy  This Package  Previous  Next  Index