fisica
Class Fisica

java.lang.Object
  extended by fisica.Fisica
All Implemented Interfaces:
processing.core.PConstants

public class Fisica
extends java.lang.Object
implements processing.core.PConstants

Represents the library Fisica. It is mainly used to initialize it with the PApplet:

 Fisica.init(this);
 
 
It also allows to modify global properties of the simulation such as the scale of meters to pixels:
 Fisica.setScale(40);
 
 
In the future it may contain helping methods to create the objects.


Nested Class Summary
static class Fisica.LibraryNotInitializedException
          Exception thrown when the library has not been initialized.
 
Field Summary
 
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_RETINA_PIXELS, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_RETINA_PIXELS, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
Fisica()
           
 
Method Summary
static void init(processing.core.PApplet applet)
          Initialize the library.
static processing.core.PApplet parent()
           
static float screenToWorld(float a)
           
static org.jbox2d.common.Vec2 screenToWorld(float x, float y)
           
static org.jbox2d.common.Vec2 screenToWorld(org.jbox2d.common.Vec2 m_in)
           
static void setScale(float scale)
          Set the scale from screen units to world units.
static float worldToScreen(float a)
           
static org.jbox2d.common.Vec2 worldToScreen(float x, float y)
           
static org.jbox2d.common.Vec2 worldToScreen(org.jbox2d.common.Vec2 m_in)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fisica

public Fisica()
Method Detail

screenToWorld

public static org.jbox2d.common.Vec2 screenToWorld(org.jbox2d.common.Vec2 m_in)

screenToWorld

public static org.jbox2d.common.Vec2 screenToWorld(float x,
                                                   float y)

screenToWorld

public static float screenToWorld(float a)

worldToScreen

public static org.jbox2d.common.Vec2 worldToScreen(org.jbox2d.common.Vec2 m_in)

worldToScreen

public static org.jbox2d.common.Vec2 worldToScreen(float x,
                                                   float y)

worldToScreen

public static float worldToScreen(float a)

parent

public static processing.core.PApplet parent()

init

public static void init(processing.core.PApplet applet)
Initialize the library. Must be called before any use of the library. Must be called by passing the PApplet. e.g. Fisica.init(this)

Parameters:
applet - The applet on which to use the library. This library can only be used with one applet

setScale

public static void setScale(float scale)
Set the scale from screen units to world units. By setting the scale to 20 we are stating that 20 pixels is equivalent to 1 meter in the simulated world.

Parameters:
scale - the number of pixels that are equivalent to 1 meter in the simulated world.


processing library fisica by Ricard Marxer. (c) 2009-2013