hAPI Fisica  0.1
The hAPI Fisica physics engine expands Richard Marxer's fisica for Processing. The engine wraps the jbox2d physics engine for use with the Haply Development kit and the Hapkit.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FDistanceJoint Class Reference
Inheritance diagram for FDistanceJoint:
FJoint FDrawable

Public Member Functions

 FDistanceJoint (FBody body1, FBody body2)
 
void setDamping (float damping)
 
void setFrequency (float frequency)
 
void calculateLength ()
 
void setLength (float length)
 
void setAnchor2 (float x, float y)
 
void setAnchor1 (float x, float y)
 
float getAnchor1X ()
 
float getAnchor1Y ()
 
float getAnchor2X ()
 
float getAnchor2Y ()
 
void draw (PGraphics applet)
 
void drawDebug (PGraphics applet)
 
- Public Member Functions inherited from FJoint
Joint getBox2dJoint ()
 
void addToWorld (FWorld world)
 
void removeFromWorld ()
 
FBody getBody1 ()
 
FBody getBody2 ()
 
void setCollideConnected (boolean value)
 
float getReactionForceX ()
 
float getReactionForceY ()
 
float getReactionTorque ()
 
- Public Member Functions inherited from FDrawable
void draw (PGraphics graphics)
 
void draw (PApplet applet)
 
void drawDebug (PGraphics graphics)
 
void drawDebug (PApplet applet)
 
void attachImage (PImage img)
 
void dettachImage ()
 
float getImageAlpha ()
 
void setImageAlpha (float alpha)
 
void setDrawable (boolean drawable)
 
boolean isDrawable ()
 
int getFillColor ()
 
void setFillColor (int col)
 
void setNoFill ()
 
void setFill (float g)
 
void setFill (float g, float a)
 
void setFill (float r, float g, float b)
 
void setFill (float r, float g, float b, float a)
 
void setStrokeColor (int col)
 
void setNoStroke ()
 
void setStroke (float g)
 
void setStroke (float g, float a)
 
void setStroke (float r, float g, float b)
 
void setStroke (float r, float g, float b, float a)
 
void setStrokeWeight (float weight)
 

Protected Member Functions

JointDef getJointDef (FWorld world)
 
- Protected Member Functions inherited from FJoint
void processJoint (World world, JointDef jd)
 
JointDef getJointDef (FWorld world)
 
void preDraw (PGraphics applet)
 
void postDraw (PGraphics applet)
 
void preDrawDebug (PGraphics applet)
 
void postDrawDebug (PGraphics applet)
 
- Protected Member Functions inherited from FDrawable
void updateStyle (FDrawable other)
 
void appletStroke (PGraphics applet, int argb)
 
void appletFill (PGraphics applet, int argb)
 
void appletFillStroke (PGraphics applet)
 
void drawImage (PGraphics applet)
 

Protected Attributes

FBody m_body1
 
FBody m_body2
 
float m_damping = 0.3f
 
float m_frequency = 10.0f
 
float m_length
 
Vec2 m_anchor1
 
Vec2 m_anchor2
 
- Protected Attributes inherited from FJoint
Joint m_joint
 
FWorld m_world
 
boolean m_collideConnected = true
 
- Protected Attributes inherited from FDrawable
boolean m_drawable = true
 
boolean m_fill = true
 
int m_fillColor = 0xFFFFFFFF
 
boolean m_stroke = true
 
int m_strokeColor = 0xFF000000
 
float m_strokeWeight = 1.0f
 
PImage m_image = null
 
float m_imageAlpha = 255.0f
 
PImage m_mask = null
 

Detailed Description

Represents a distance joint that tries to keep two bodies at a constant distance. This joint is similar to connecting both bodies by a spring.

Constructor & Destructor Documentation

◆ FDistanceJoint()

FDistanceJoint.FDistanceJoint ( FBody  body1,
FBody  body2 
)

Construct a distance joint between two bodies. The constructor automatically sets the anchors of the joint to the centers of each body, and the length of the joint to the current distance between the bodies.

Parameters
body1first body of the joint
body2second body of the joint

Member Function Documentation

◆ calculateLength()

void FDistanceJoint.calculateLength ( )

Sets the length of the joint to the current distance between the bodies.

◆ getAnchor1X()

float FDistanceJoint.getAnchor1X ( )

Get the horizontal coordinate of the first anchor point on the first body. This position is given relative to the center of the first body.

Returns
the horizontal coordinate of the first anchor relative to the center of the first body

◆ getAnchor1Y()

float FDistanceJoint.getAnchor1Y ( )

Get the vertical coordinate of the first anchor point on the first body. This position is given relative to the center of the first body.

Returns
the vertical coordinate of the first anchor relative to the center of the first body

◆ getAnchor2X()

float FDistanceJoint.getAnchor2X ( )

Get the horizontal coordinate of the second anchor point on the second body. This position is given relative to the center of the second body.

Returns
the horizontal coordinate of the second anchor relative to the center of the second body

◆ getAnchor2Y()

float FDistanceJoint.getAnchor2Y ( )

Get the vertical coordinate of the second anchor point on the second body. This position is given relative to the center of the second body.

Returns
the vertical coordinate of the second anchor relative to the center of the second body

◆ setAnchor1()

void FDistanceJoint.setAnchor1 ( float  x,
float  y 
)

Sets the position of the anchor of the first end of the joint on the first body. This position must be given relative to the center of the first body. The anchor point is the point used to calculate the distance and to apply forces in order to move the body.

Parameters
xthe horizontal coordinate of the first anchor relative to the center of the first body
ythe vertical coordinate of the first anchor relative to the center of the first body

◆ setAnchor2()

void FDistanceJoint.setAnchor2 ( float  x,
float  y 
)

Sets the position of the anchor of the second end of the joint on the second body. This position must be given relative to the center of the second body. The anchor point is the point used to calculate the distance and to apply forces in order to move the body.

Parameters
xthe horizontal coordinate of the second anchor relative to the center of the second body
ythe vertical coordinate of the second anchor relative to the center of the second body

◆ setDamping()

void FDistanceJoint.setDamping ( float  damping)

Sets the damping of the spring used to maintain the distance between the bodies constant.

Parameters
dampingthe damping of the spring

◆ setFrequency()

void FDistanceJoint.setFrequency ( float  frequency)

Sets the frequency of the spring used to maintain the distance between the bodies constant.

Parameters
frequencythe frequency of the spring

◆ setLength()

void FDistanceJoint.setLength ( float  length)

Sets the target distance for the joint. This is the distance that the joint will try to maintain between the two bodies. If you want to use as length the current distance between the two bodies, use the method calculateLength.

Parameters
lengththe length of the joint

The documentation for this class was generated from the following file: