|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfisica.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,
float x,
float y)
Construct a revolute joint between two bodies given an anchor position. |
Method Summary | |
---|---|
void |
attachImage(processing.core.PImage img)
Attach an image to the object. |
void |
dettachImage()
Dettach any image that has been attached to the object. |
void |
draw(processing.core.PApplet applet)
|
void |
draw(processing.core.PGraphics applet)
This method is called when calling world.draw() . |
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. |
float |
getImageAlpha()
Get the opacity with which to draw the attached image. |
boolean |
isDrawable()
Get whether the object must be drawn or not. |
void |
setAnchor(float x,
float y)
Sets the position of the anchor of the joint around which the bodies rotate. |
void |
setDrawable(boolean drawable)
Set whether the object must be drawn or not. |
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 |
setFill(float g)
Set the fill color of the object. |
void |
setFill(float g,
float a)
Set the fill color of the object. |
void |
setFill(float r,
float g,
float b)
Set the fill color of the object. |
void |
setFill(float r,
float g,
float b,
float a)
Set the fill color of the object. |
void |
setFillColor(int col)
Set the fill color of the object. |
void |
setImageAlpha(float alpha)
Set the opacity with which to draw the attached image. |
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 |
setNoFill()
Set that the object must be drawn without fill. |
void |
setNoStroke()
Set that the object must be drawn without stroke. |
void |
setReferenceAngle(float ang)
|
void |
setStroke(float g)
Set the stroke color of the object. |
void |
setStroke(float g,
float a)
Set the stroke color of the object. |
void |
setStroke(float r,
float g,
float b)
Set the stroke color of the object. |
void |
setStroke(float r,
float g,
float b,
float a)
Set the stroke color of the object. |
void |
setStrokeColor(int col)
Set the stroke color of the object. |
void |
setStrokeWeight(float weight)
Set the stroke weight of the object. |
void |
setUpperAngle(float a)
Set the highest angle allowed. |
Methods inherited from class fisica.FJoint |
---|
getBody1, getBody2, getReactionForceX, getReactionForceY, getReactionTorque, setCollideConnected |
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' centerMethod 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 motorpublic 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)
world.draw()
.
This method may be overriden to allow custom drawing of the object.
applet
- the applet onto which the object must be drawn.public void draw(processing.core.PApplet applet)
public void attachImage(processing.core.PImage img)
draw(PApplet)
method.
img
- the PImage to attach to the object.public void dettachImage()
attachImage(PImage)
public float getImageAlpha()
attachImage(PImage)
,
setImageAlpha(float)
public void setImageAlpha(float alpha)
alpha
- the opacity, a value from 0.0 to 1.0 with which to draw the attached imageattachImage(PImage)
,
getImageAlpha()
public void setDrawable(boolean drawable)
drawable
- if true
the object will be drawn, else it will notisDrawable()
public boolean isDrawable()
true
the object will be drawn, else it will notsetDrawable(boolean)
public void setFillColor(int col)
setFill(float)
, setFill(float,float)
, setFill(float,float,float)
or setFill(float,float,float,float)
col
- a Processing color type. e.g. myBody.setFillColor(color(20,100,30,90));
setNoFill()
,
setFill(float)
,
setFill(float,float)
,
setFill(float,float,float)
,
setFill(float,float,float,float)
public void setNoFill()
setFill(float)
,
setFill(float,float)
,
setFill(float,float,float)
,
setFill(float,float,float,float)
public void setFill(float g)
g
- gray valuesetFill(float)
,
setFill(float,float)
,
setFill(float,float,float)
,
setFill(float,float,float,float)
public void setFill(float g, float a)
g
- gray valuea
- alpha (opacity) valuesetFill(float)
,
setFill(float,float)
,
setFill(float,float,float)
,
setFill(float,float,float,float)
public void setFill(float r, float g, float b)
r
- red valueg
- green valueb
- blue valuesetFill(float)
,
setFill(float,float)
,
setFill(float,float,float)
,
setFill(float,float,float,float)
public void setFill(float r, float g, float b, float a)
r
- red valueg
- green valueb
- blue valuea
- alpha (opacity) valuesetFill(float)
,
setFill(float,float)
,
setFill(float,float,float)
,
setFill(float,float,float,float)
public void setStrokeColor(int col)
setStroke(float)
, setStroke(float,float)
, setStroke(float,float,float)
or setStroke(float,float,float,float)
col
- a Processing color type. e.g. myBody.setStrokeColor(color(20,100,30,90));
setNoStroke()
,
setStroke(float)
,
setStroke(float,float)
,
setStroke(float,float,float)
,
setStroke(float,float,float,float)
public void setNoStroke()
setStroke(float)
,
setStroke(float,float)
,
setStroke(float,float,float)
,
setStroke(float,float,float,float)
public void setStroke(float g)
g
- gray valuesetStroke(float)
,
setStroke(float,float)
,
setStroke(float,float,float)
,
setStroke(float,float,float,float)
public void setStroke(float g, float a)
g
- gray valuea
- alpha (opacity) valuesetStroke(float)
,
setStroke(float,float)
,
setStroke(float,float,float)
,
setStroke(float,float,float,float)
public void setStroke(float r, float g, float b)
r
- red valueg
- green valueb
- blue valuesetStroke(float)
,
setStroke(float,float)
,
setStroke(float,float,float)
,
setStroke(float,float,float,float)
public void setStroke(float r, float g, float b, float a)
r
- red valueg
- green valueb
- blue valuea
- alpha (opacity) valuesetStroke(float)
,
setStroke(float,float)
,
setStroke(float,float,float)
,
setStroke(float,float,float,float)
public void setStrokeWeight(float weight)
weight
- weight value in pixelssetStroke(float)
,
setStroke(float,float)
,
setStroke(float,float,float)
,
setStroke(float,float,float,float)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |