fisica
Class FPoly

java.lang.Object
  extended by fisica.FDrawable
      extended by fisica.FBody
          extended by fisica.FPoly

public class FPoly
extends FBody

Represents a polygonal body that can be added to a world. Polygons can be created by adding vertices using the vertex method in a similar way to FPoly:

 FPoly myPoly = new FPoly();
 myBlob.vertex(40, 10);
 myBlob.vertex(50, 20);
 myBlob.vertex(60, 30);
 myBlob.vertex(60, 40);
 myBlob.vertex(50, 50);
 myBlob.vertex(40, 60);
 myBlob.vertex(30, 70);
 myBlob.vertex(20, 60);
 myBlob.vertex(10, 50);
 myBlob.vertex(10, 40);
 myBlob.vertex(20, 30);
 myBlob.vertex(30, 20);
 myBlob.vertex(40, 10);
 world.add(myPoly);
 
 

See Also:
FBox, FCircle, FBlob, FLine

Constructor Summary
FPoly()
          Constructs a polygonal body that can be added to a world.
 
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().
 void vertex(float x, float y)
          Adds vertices to the shape of the poly.
 
Methods inherited from class fisica.FBody
addForce, addForce, addImpulse, addImpulse, addTorque, addToWorld, adjustAngularVelocity, adjustPosition, adjustRotation, adjustVelocity, getAngularVelocity, getBox2dBody, getCategoryBits, getContacts, getDensity, getFilterBits, getForceX, getForceY, getGroupIndex, getJoints, getMass, getName, getParent, getRotation, getTouching, getVelocityX, getVelocityY, getX, getY, isConnected, isResting, isSensor, isSleeping, isStatic, isTouchingBody, recreateInWorld, removeFromWorld, resetForces, setAllowSleeping, setAngularDamping, setAngularVelocity, setBullet, setCategoryBits, setDamping, setDensity, setFilterBits, setForce, setFriction, setGrabbable, setGroupIndex, setName, setParent, setPosition, setRestitution, setRotatable, setRotation, setSensor, setState, setStateFromWorld, setStatic, setStaticBody, setVelocity, wakeUp
 
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

FPoly

public FPoly()
Constructs a polygonal body that can be added to a world. It creates an empty polygon, before adding the blob to the world use vertex to define the shape of the polygon.

Method Detail

vertex

public void vertex(float x,
                   float y)
Adds vertices to the shape of the poly. This method must called before adding the body to the world.

Parameters:
x - x coordinate of the vertex to be added
y - y coordinate of the vertex to be added

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