fisica
Class FConstantVolumeJoint

java.lang.Object
  extended by fisica.FDrawable
      extended by fisica.FJoint
          extended by fisica.FConstantVolumeJoint

public class FConstantVolumeJoint
extends FJoint

Represents constant volume joint that tries to keep the volume enclosed by a group of bodies constant. This joint is similar to connecting multiple springs between the bodies in order to maintain the volume inside their position constant. This is the joint used to create the FBlob body.


Constructor Summary
FConstantVolumeJoint()
          Constructs an constant volume joint.
 
Method Summary
 void addBody(FBody b)
          Adds a body to the joint.
 void draw(processing.core.PGraphics applet)
          This method is called when calling world.draw().
 void drawDebug(processing.core.PGraphics applet)
          This method is called when calling world.drawDebug().
 java.util.ArrayList getBodies()
          Return the group of bodies that are connected by this joint.
 processing.core.PVector getCentroid()
           
 void setDamping(float damping)
          Sets the damping of the springs used to maintain the volume defined by the vertices constant.
 void setFrequency(float frequency)
          Sets the frequency of the springs used to maintain the volume defined by the vertices constant.
 
Methods inherited from class fisica.FJoint
addToWorld, getBody1, getBody2, getBox2dJoint, getReactionForceX, getReactionForceY, getReactionTorque, removeFromWorld, setCollideConnected
 
Methods inherited from class fisica.FDrawable
attachImage, dettachImage, draw, drawDebug, getFillColor, getImageAlpha, isDrawable, setDrawable, setFill, setFill, setFill, setFill, setFillColor, setImageAlpha, setNoFill, setNoStroke, setStroke, setStroke, setStroke, setStroke, setStrokeColor, setStrokeWeight
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FConstantVolumeJoint

public FConstantVolumeJoint()
Constructs an constant volume joint. It creates an empty joint, before adding the joint to the world use addBody to add bodies to the joint and to define the initial and target volume of the joint.

Method Detail

addBody

public void addBody(FBody b)
Adds a body to the joint. This method must be called before adding the joint to the world.

Parameters:
b - body to be added

getBodies

public java.util.ArrayList getBodies()
Return the group of bodies that are connected by this joint.

Returns:
list of bodies (ArrayList of FBody) connected by the joint

setDamping

public void setDamping(float damping)
Sets the damping of the springs used to maintain the volume defined by the vertices constant. This method must be called before adding the joint to the world.

Parameters:
damping - the damping of the springs of the constant volume joint

setFrequency

public void setFrequency(float frequency)
Sets the frequency of the springs used to maintain the volume defined by the vertices constant. This method must be called before adding the joint to the world.

Parameters:
frequency - the frequency of the springs of the constant volume joint

getCentroid

public processing.core.PVector getCentroid()

draw

public void draw(processing.core.PGraphics applet)
Description copied from class: FDrawable
This method is called when calling world.draw(). This method may be overriden to allow custom drawing of the object.

Overrides:
draw in class FDrawable
Parameters:
applet - the graphics onto which the object must be drawn.

drawDebug

public void drawDebug(processing.core.PGraphics applet)
Description copied from class: FDrawable
This method is called when calling world.drawDebug(). This method may be overriden to allow custom debug drawing of the object.

Overrides:
drawDebug in class FDrawable
Parameters:
applet - the graphics onto which the object must be drawn.


processing library fisica by Ricard Marxer. (c) 2009-2013