All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class primitives.machines.NarmsMachine
java.lang.Object
   |
   +----primitives.machines.Machine
           |
           +----primitives.machines.NarmsMachine
  -  public class NarmsMachine
  
-  extends Machine
  
A spider machnine with varying number of arms.
  
  -  
	arms
   -  Number of arms of the machine.
  
 -  
	center
   -   The integral representation of the central joint.
  
 -  
	dCenter
   -  The central joint.
  
 -  
	in
   -  
  
 -  
	origin
   -   The location of equal distances from all anchors.
  
 -  
	tempCenter
   -  A backup for the central joint.
 
  
  -  
	NarmsMachine(Dimension, int, double)
   -  
 
  
  -  
	armStreched(int)
   -  
  
 -  
	finalize()
   -  Sets object fields to null.
  
 -  
	findConstraintAngles()
   -  
  
 -  
	findConstraints()
   -  Return a Polyogn objects which locations are the locations of the central joint
in which 2 adjacent arms are streched out.
  
 -  
	findConstraintsEx()
   -  Returns the locations of the central joint in which adjacent arms are streched.
  
 -  
	getCurrentAngle()
   -  
  
 -  
	getJoint(int)
   -  Returns the integral location of an indexed joint.
  
 -  
	getJointEx(int)
   -  Returns the  location of an indexed joint.
  
 -  
	getMaxDistance(double)
   -  
  
 -  
	getMaxPoint(double)
   -  Returns the extremum location of the central joint from the origin in direction
specified by the angle.
  
 -  
	getRatioDistance(double)
   -  
  
 -  
	moveCenter(double, double)
   -  Conditionaly moves the machine by setting a new location for the central joint.
  
 -  
	moveCenterEx(double, double)
   -  moves the machine by setting a new location for the central joint
The method will always change the position of the machine.
  
 -  
	moveJointsA()
   -  calculates the location of the periferial joints by the current location
of the central joint.
  
 -  
	moveJointsEx()
   -  calculates the locations of the periferial joint 
has the same effect as moveJointsA.
  
 -  
	moveToMaxCoordinate(Coordinate)
   -  Moves the central joint to an extermum location in the direction of a given location.
  
 -  
	redraw(Graphics)
   -  Draws this machine.
  
 -  
	restorePoints()
   -  
  
 -  
	rotateCenter(int, double)
   -  conditionaly rotates the central joint.
  
 -  
	rotateCenterA(int, double)
   -  rotates the central joint with respect to the i,i>th
joint.
  
 -  
	rotateCenterEx(int, double)
   -  rotates the central joint with respect to the i,i>th
joint.
  
 -  
	savePoints()
   -  
  
 -  
	strechArm(int)
   -  strech the given arm
  
 -  
	switchBend(int)
   -  Switch the bending of a given periferial joint with respect to the central joint
and its anchor.
 
  
dCenter
 protected Coordinate dCenter
  -  The central joint.
 
center
 public ExtPoint center
  -  The integral representation of the central joint.
 
tempCenter
 public Coordinate tempCenter
  -  A backup for the central joint.
 
arms
 public int arms
  -  Number of arms of the machine.
 
origin
 public Coordinate origin
  -  The location of equal distances from all anchors.
 
in
 private Coordinate in
  
NarmsMachine
 public NarmsMachine(Dimension d,
                     int arms,
                     double ratio)
  
    -  Parameters:
    
 -  the - size of the rectangle the machine should be drawn in.
    
-  arms - number of arms of the machine.
    
-  ration - the ratio between the distance between the anchors and the origin and the length
of the bars. should me greater then 1.
  
   
 
  
getCurrentAngle
 public double getCurrentAngle()
getRatioDistance
 public double getRatioDistance(double angle)
  
    -  Returns:
    
 -  the ratio between the distance between the 
origin and
the location of the current location of the central joint and the maximum distance
between these locations.
param angle the angle with which to calculate the ratio.
     -  See Also:
    
 -  getMaxDistance
  
 
 
getMaxDistance
 public double getMaxDistance(double angle)
  
    -  Parameters:
    
 -  angle - the angle to calculate for which to calculate the distance.
    
 -  Returns:
    
 -  the maximum possible distance between the 
origin
and the location of the central joint for a given angle.
   
 
getMaxPoint
 public Coordinate getMaxPoint(double angle)
  -  Returns the extremum location of the central joint from the origin in direction
specified by the angle.
An approximation algorithm is used.
  
    -  Parameters:
    
 -  angle - the angle to use.
    
 -  Returns:
    
 -  the extremum location
  
 
 
 
moveToMaxCoordinate
 public int moveToMaxCoordinate(Coordinate newP)
  -  Moves the central joint to an extermum location in the direction of a given location.
  
    -  Parameters:
    
 -  newP - the given location.
    
 -  Returns:
    
 -  0
  
 
 
 
findConstraints
 public Polygon findConstraints()
  -  Return a Polyogn objects which locations are the locations of the central joint
in which 2 adjacent arms are streched out.
 
findConstraintsEx
 public Coordinate[] findConstraintsEx()
  -  Returns the locations of the central joint in which adjacent arms are streched.
  
    -  Returns:
    
 -  an array of the locations.
    
 -  See Also:
    
 -  findConstraints
  
 
 
 
findConstraintAngles
 public Coordinate[] findConstraintAngles()
  
    -  See Also:
    
 -  findConstraintsEx
  
 
 
redraw
 public void redraw(Graphics g)
  -  Draws this machine.
  
    -  Parameters:
    
 -  g - the graphic context to draw on.
    
 -  Overrides:
    
 -  redraw in class Machine
  
 
 
 
savePoints
 protected void savePoints()
  
    -  Overrides:
    
 -  savePoints in class Machine
    
 -  See Also:
    
 -  savePoints
  
 
 
restorePoints
 protected void restorePoints()
  
    -  Overrides:
    
 -  restorePoints in class Machine
    
 -  See Also:
    
 -  restorePoints
  
 
 
moveJointsA
 private int[] moveJointsA()
  -  calculates the location of the periferial joints by the current location
of the central joint.
  
    -  Returns:
    
 -  an array of integers if arm i  is streched the i location in the array is 1 else
is 0.
  
 
 
 
getJoint
 public Point getJoint(int i)
  -  Returns the integral location of an indexed joint.
  
    -  Parameters:
    
 -  i - the index of the joint to return
    
 -  Returns:
    
 -  the integral representation of the joint
  
 
 
 
getJointEx
 public Coordinate getJointEx(int i)
  -  Returns the  location of an indexed joint.
  
    -  Parameters:
    
 -  i - the index of the joint to return
    
 -  Returns:
    
 -  the location of the joint.
  
 
 
 
rotateCenterA
 public int[] rotateCenterA(int i,
                            double dalpha)
  -  rotates the central joint with respect to the i,i>th
joint.
  
    -  Parameters:
    
 -  i - the index of the joint.
    
-  dalpha - the rotation angle.
    
  -  Returns:
    
 -  an array of 0 or 1, for each arm 1 if the rotation caused the arm to strech,
0 if not.
  
 
 
 
moveJointsEx
 private int moveJointsEx()
  -  calculates the locations of the periferial joint 
has the same effect as moveJointsA.
  
    -  Returns:
    
 -  the index of the last arm which had been streched due its new location.
  
 
 
 
moveCenterEx
 public int moveCenterEx(double dx,
                         double dy)
  -  moves the machine by setting a new location for the central joint
The method will always change the position of the machine. use 
moveCenter
to conditionaly move the machine.
  
    -  Parameters:
    
 -  dx - the amount to move the center in the horizontal direction.
    
-  dy - the amount to move the center in the vertical direction.
    
  -  Returns:
    
 -  the index of the last joint which was streched by activating this method.
    
 -  See Also:
    
 -  moveCenter
  
 
 
 
moveCenter
 public void moveCenter(double dx,
                        double dy) throws MachineException
  -  Conditionaly moves the machine by setting a new location for the central joint.
  
    -  Parameters:
    
 -  dx - the amount to move the center in the horizontal direction.
    
-  dy - the amount to move the center in the vertical direction.
    
  -  Throws: MachineException
    
 -  if the new state is not physicaly allowed.
see #moveCenterEx
  
 
 
 
rotateCenterEx
 public int rotateCenterEx(int i,
                           double dalpha)
  -  rotates the central joint with respect to the i,i>th
joint.
  
    -  Parameters:
    
 -  i - the index of the joint.
    
-  dalpha - the rotation angle.
    
  -  Returns:
    
 -  the index of the last joint to strech.
  
 
 
 
rotateCenter
 public void rotateCenter(int i,
                          double dalpha) throws MachineException
  -  conditionaly rotates the central joint.
  
    -  Throws: MachineException
    
 -  if the rotation is not physicaly possible.
    
 -  See Also:
    
 -  rotateCenterEx
  
 
 
 
switchBend
 public void switchBend(int i)
  -  Switch the bending of a given periferial joint with respect to the central joint
and its anchor.
  
    -  Parameters:
    
 -  i - the index of the joint to strech.
  
 
 
 
strechArm
 public void strechArm(int arm)
  -  strech the given arm
 
armStreched
 public boolean armStreched(int i)
  
    -  Parameters:
    
 -  i - the index of the arm.
    
 -  Returns:
    
 -  true if arm 
i is streched.
   
 
finalize
 public void finalize() throws Throwable
  -  Sets object fields to null.
  
    -  Throws: Throwable
    
 -  .
    
 -  Overrides:
    
 -  finalize in class Machine
  
 
 
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index