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
FPrismaticJoint Class Reference
Inheritance diagram for FPrismaticJoint:
FJoint FDrawable

Public Member Functions

 FPrismaticJoint (FBody body1, FBody body2)
 
void setAxis (float x, float y)
 
void setAnchor (float x, float y)
 
float getAnchorX ()
 
float getAnchorY ()
 
void setLowerTranslation (float translation)
 
void setUpperTranslation (float translation)
 
void setEnableLimit (boolean value)
 
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

void updateLocalAnchors ()
 
void updateLocalAxis ()
 
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
 
Vec2 m_anchor
 
Vec2 m_axis
 
Vec2 m_localAxis1 = new Vec2(0, 1)
 
float m_force
 
float m_torque
 
float m_motorForce
 
float m_limitForce
 
float m_limitPositionImpulse
 
float m_maxMotorForce
 
Vec2 m_localAnchor1 = new Vec2(0.0f, 0.0f)
 
Vec2 m_localAnchor2 = new Vec2(0.0f, 0.0f)
 
float m_referenceAngle = 0.0f
 
boolean m_enableLimit = false
 
float m_lowerTranslation = 0.0f
 
float m_upperTranslation = 0.0f
 
boolean m_enableMotor = false
 
float m_motorSpeed = 0.0f
 
float m_maxMotorTorque = 0.0f
 
- 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 prismatic joint that restricts the movement of one body with respect to another to a translation along a given axis. Often this joint is used with one of the bodies being static in order to only allow translation of the other body along a given axis. This translation can also be bounded given lower and upper translation limits.

Constructor & Destructor Documentation

◆ FPrismaticJoint()

FPrismaticJoint.FPrismaticJoint ( FBody  body1,
FBody  body2 
)

Construct a prismatic joint between two bodies. The constructor automatically sets the anchor of the joint to the center of the second body.

Parameters
body1first body of the joint
body2second body of the joint

Member Function Documentation

◆ getAnchorX()

float FPrismaticJoint.getAnchorX ( )

Get the horizontal coordinate of the anchor of the joint. This position is given global coordinates, relative to the center of the canvas.

Returns
the horizontal coordinate of the anchor in global coordinates, relative to the center of the canvas

◆ getAnchorY()

float FPrismaticJoint.getAnchorY ( )

Get the vertical coordinate of the anchor of the joint. This position is given global coordinates, relative to the center of the canvas.

Returns
the vertical coordinate of the anchor in global coordinates, relative to the center of the canvas

◆ setAnchor()

void FPrismaticJoint.setAnchor ( float  x,
float  y 
)

Sets the position of the anchor of the joint. This position is given global coordinates, relative to the center of the canvas.

Parameters
xthe horizontal coordinate of the anchor in global coordinates, relative to the center of the canvas
ythe vertical coordinate of the anchor in global coordinates, relative to the center of the canvas

◆ setAxis()

void FPrismaticJoint.setAxis ( float  x,
float  y 
)

Sets the axis of movement of the joint. This is only axis alog which the bodies can translate with relation to each other. The axis is given global coordinates, relative to the center of the canvas. This property must be set before adding the joint to the world.

Parameters
xthe horizontal component of the axis in global coordinates, relative to the center of the canvas
ythe vertical coordinate of the axis in global coordinates, relative to the center of the canvas

◆ setEnableLimit()

void FPrismaticJoint.setEnableLimit ( boolean  value)

Set limits to the allowed translation of one body respect to the other. If set to

true

the limits imposed using setLowerTranslation and setLowerTranslation are enforced.

Parameters
valueif
true
the bodies will be able to translate along the axis only between certain limits

◆ setLowerTranslation()

void FPrismaticJoint.setLowerTranslation ( float  translation)

Set the lowest translation allowed. This property only has effect if the

enableLimit

has been set to

true

using setEnableLimit(boolean).

Parameters
translationlowest translation position in simulation world units

◆ setUpperTranslation()

void FPrismaticJoint.setUpperTranslation ( float  translation)

Set the highest translation allowed. This property only has effect if the

enableLimit

has been set to

true

using setEnableLimit(boolean).

Parameters
translationhighest translation position in simulation world units

Member Data Documentation

◆ m_enableLimit

boolean FPrismaticJoint.m_enableLimit = false
protected

A flag to enable joint limits.

◆ m_enableMotor

boolean FPrismaticJoint.m_enableMotor = false
protected

A flag to enable the joint motor.

◆ m_localAnchor1

Vec2 FPrismaticJoint.m_localAnchor1 = new Vec2(0.0f, 0.0f)
protected

The local anchor point relative to body1's origin.

◆ m_localAnchor2

Vec2 FPrismaticJoint.m_localAnchor2 = new Vec2(0.0f, 0.0f)
protected

The local anchor point relative to body2's origin.

◆ m_lowerTranslation

float FPrismaticJoint.m_lowerTranslation = 0.0f
protected

The lower translation for the joint limit (world coords).

◆ m_maxMotorTorque

float FPrismaticJoint.m_maxMotorTorque = 0.0f
protected

The maximum motor torque used to achieve the desired motor speed. Usually in N-m.

◆ m_motorSpeed

float FPrismaticJoint.m_motorSpeed = 0.0f
protected

The desired motor speed. Usually in radians per second.

◆ m_referenceAngle

float FPrismaticJoint.m_referenceAngle = 0.0f
protected

The body2 angle minus body1 angle in the reference state (radians).

◆ m_upperTranslation

float FPrismaticJoint.m_upperTranslation = 0.0f
protected

The upper translation for the joint limit (world coords).


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