|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectfisica.FDrawable
fisica.FJoint
fisica.FRevoluteJoint
public class FRevoluteJoint
Represents a revolute joint that restricts the movement of one body with respect to another to rotation around a given anchor. The rotation can be further limited given a lower and un upper angles. Additionally the user can enable a motor in order to apply a constant rotation force (torque) to the joint in order to reach the desired rotation speed.
| Constructor Summary | |
|---|---|
FRevoluteJoint(FBody body1,
FBody body2)
Construct a revolute joint between two bodies. |
|
FRevoluteJoint(FBody body1,
FBody body2,
float x,
float y)
Construct a revolute joint between two bodies given an anchor position. |
|
| Method Summary | |
|---|---|
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(). |
float |
getAnchorX()
Get the horizontal coordinate of the anchor of the joint around which the bodies can rotate. |
float |
getAnchorY()
Get the vertical coordinate of the anchor of the joint around which the bodies can rotate. |
void |
setAnchor(float x,
float y)
Sets the position of the anchor of the joint around which the bodies rotate. |
void |
setEnableLimit(boolean value)
Set limits to the allowed rotation of one body respect to the other. |
void |
setEnableMotor(boolean value)
Set the state of the motor in order to generate a rotation force (torque) on the joint. |
void |
setLowerAngle(float a)
Set the lowest angle allowed. |
void |
setMaxMotorTorque(float a)
Set the maximum torque that the joint's motor can apply in order to acheive the desired speed. |
void |
setMotorSpeed(float a)
Set the desired rotation speed of the joint. |
void |
setReferenceAngle(float ang)
|
void |
setUpperAngle(float a)
Set the highest angle allowed. |
| 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 |
|---|
public FRevoluteJoint(FBody body1,
FBody body2,
float x,
float y)
body1 - first body of the jointbody2 - second body of the jointx - horizontal coordinate of the anchor given in global coordinates, relative to the canvas' centery - vertical coordinate of the anchor given in global coordinates, relative to the canvas' center
public FRevoluteJoint(FBody body1,
FBody body2)
body1 - first body of the jointbody2 - second body of the joint| Method Detail |
|---|
public void setLowerAngle(float a)
enableLimit has been set to true using setEnableLimit(boolean).
a - lowest angle allowed in radianspublic void setUpperAngle(float a)
enableLimit has been set to true using setEnableLimit(boolean).
a - highest angle allowed in radianspublic void setEnableLimit(boolean value)
true the limits imposed using setLowerAngle and setLowerAngle are enforced.
value - if true the bodies will be able to rotate around the anchor only between certain limitspublic void setMotorSpeed(float a)
enableMotor has been set to true using setEnableMotor(boolean). The speed is given in radians per second.
a - the desired speed in radians per secondpublic void setMaxMotorTorque(float a)
enableMotor has been set to true using setEnableMotor(boolean).
a - the maximum torque of the joint's motorpublic void setEnableMotor(boolean value)
true the desired motor speed, set using setMotorSpeed, will try to be matched using a motor with a maximum rotation force (torque) set using setMaxMotorTorque.
value - if true the joint will receive the rotation force (torque) of a motor
public void setAnchor(float x,
float y)
x - the horizontal coordinate of the anchor in global coordinates, relative to the center of the canvasy - the vertical coordinate of the anchor in global coordinates, relative to the center of the canvaspublic float getAnchorX()
public float getAnchorY()
public void setReferenceAngle(float ang)
public void draw(processing.core.PGraphics applet)
FDrawableworld.draw().
This method may be overriden to allow custom drawing of the object.
draw in class FDrawableapplet - the graphics onto which the object must be drawn.public void drawDebug(processing.core.PGraphics applet)
FDrawableworld.drawDebug().
This method may be overriden to allow custom debug drawing of the object.
drawDebug in class FDrawableapplet - the graphics onto which the object must be drawn.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||