org.jbox2d.common
Class Settings

java.lang.Object
  extended by org.jbox2d.common.Settings

public class Settings
extends Object

Global tuning constants based on MKS units and various integer maximums (vertices per shape, pairs, etc.).


Field Summary
static float aabbExtension
          This is used to fatten AABBs in the dynamic tree.
static float aabbMultiplier
          This is used to fatten AABBs in the dynamic tree.
static float angularSleepTolerance
          A body cannot sleep if its angular velocity is above this tolerance.
static float angularSlop
          A small angle used as a collision and constraint tolerance.
static int CONTACT_STACK_INIT_SIZE
           
static float contactBaumgarte
          This scale factor controls how fast overlap is resolved.
static float EPSILON
          A "close to zero" float epsilon value for use
static boolean FAST_MATH
          needs to be final, or will slow down math methods
static float linearSleepTolerance
          A body cannot sleep if its linear velocity is above this tolerance.
static float linearSlop
          A small length used as a collision and constraint tolerance.
static float maxAngularCorrection
          The maximum angular position correction used when solving constraints.
static float maxLinearCorrection
          The maximum linear position correction used when solving constraints.
static int maxManifoldPoints
          The maximum number of contact points between two convex shapes.
static int maxPolygonVertices
          The maximum number of vertices on a convex polygon.
static float maxRotation
          The maximum angular velocity of a body.
static float maxRotationSquared
           
static int maxTOIContacts
          Maximum number of contacts to be handled to solve a TOI island.
static float maxTranslation
          The maximum linear velocity of a body.
static float maxTranslationSquared
           
static float PI
          Pi.
static float polygonRadius
          The radius of the polygon/edge shape skin.
static boolean SINCOS_LUT_ENABLED
           
static int SINCOS_LUT_LENGTH
           
static boolean SINCOS_LUT_LERP
          Use if the table's precision is large (eg .006 or greater).
static float SINCOS_LUT_PRECISION
          smaller the precision, the larger the table.
static float timeToSleep
          The time that a body must be still before it will go to sleep.
static float velocityThreshold
          A velocity threshold for elastic collisions.
 
Constructor Summary
Settings()
           
 
Method Summary
static float mixFriction(float friction1, float friction2)
          Friction mixing law.
static float mixRestitution(float restitution1, float restitution2)
          Restitution mixing law.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPSILON

public static final float EPSILON
A "close to zero" float epsilon value for use

See Also:
Constant Field Values

PI

public static final float PI
Pi.

See Also:
Constant Field Values

FAST_MATH

public static final boolean FAST_MATH
needs to be final, or will slow down math methods

See Also:
Constant Field Values

CONTACT_STACK_INIT_SIZE

public static final int CONTACT_STACK_INIT_SIZE
See Also:
Constant Field Values

SINCOS_LUT_ENABLED

public static final boolean SINCOS_LUT_ENABLED
See Also:
Constant Field Values

SINCOS_LUT_PRECISION

public static final float SINCOS_LUT_PRECISION
smaller the precision, the larger the table. If a small table is used (eg, precision is .006 or greater), make sure you set the table to lerp it's results. Accuracy chart is in the MathUtils source. Or, run the tests yourself in SinCosTest.

Good lerp precision values:

See Also:
Constant Field Values

SINCOS_LUT_LENGTH

public static final int SINCOS_LUT_LENGTH

SINCOS_LUT_LERP

public static final boolean SINCOS_LUT_LERP
Use if the table's precision is large (eg .006 or greater). Although it is more expensive, it greatly increases accuracy. Look in the MathUtils source for some test results on the accuracy and speed of lerp vs non lerp. Or, run the tests yourself in SinCosTest.

See Also:
Constant Field Values

maxManifoldPoints

public static int maxManifoldPoints
The maximum number of contact points between two convex shapes.


maxPolygonVertices

public static int maxPolygonVertices
The maximum number of vertices on a convex polygon.


aabbExtension

public static float aabbExtension
This is used to fatten AABBs in the dynamic tree. This allows proxies to move by a small amount without triggering a tree adjustment. This is in meters.


aabbMultiplier

public static float aabbMultiplier
This is used to fatten AABBs in the dynamic tree. This is used to predict the future position based on the current displacement. This is a dimensionless multiplier.


linearSlop

public static float linearSlop
A small length used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.


angularSlop

public static float angularSlop
A small angle used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.


polygonRadius

public static float polygonRadius
The radius of the polygon/edge shape skin. This should not be modified. Making this smaller means polygons will have and insufficient for continuous collision. Making it larger may create artifacts for vertex collision.


maxTOIContacts

public static int maxTOIContacts
Maximum number of contacts to be handled to solve a TOI island.


velocityThreshold

public static float velocityThreshold
A velocity threshold for elastic collisions. Any collision with a relative linear velocity below this threshold will be treated as inelastic.


maxLinearCorrection

public static float maxLinearCorrection
The maximum linear position correction used when solving constraints. This helps to prevent overshoot.


maxAngularCorrection

public static float maxAngularCorrection
The maximum angular position correction used when solving constraints. This helps to prevent overshoot.


maxTranslation

public static float maxTranslation
The maximum linear velocity of a body. This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.


maxTranslationSquared

public static float maxTranslationSquared

maxRotation

public static float maxRotation
The maximum angular velocity of a body. This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.


maxRotationSquared

public static float maxRotationSquared

contactBaumgarte

public static float contactBaumgarte
This scale factor controls how fast overlap is resolved. Ideally this would be 1 so that overlap is removed in one time step. However using values close to 1 often lead to overshoot.


timeToSleep

public static float timeToSleep
The time that a body must be still before it will go to sleep.


linearSleepTolerance

public static float linearSleepTolerance
A body cannot sleep if its linear velocity is above this tolerance.


angularSleepTolerance

public static float angularSleepTolerance
A body cannot sleep if its angular velocity is above this tolerance.

Constructor Detail

Settings

public Settings()
Method Detail

mixFriction

public static final float mixFriction(float friction1,
                                      float friction2)
Friction mixing law. Feel free to customize this. TODO djm: add customization

Parameters:
friction1 -
friction2 -
Returns:

mixRestitution

public static final float mixRestitution(float restitution1,
                                         float restitution2)
Restitution mixing law. Feel free to customize this. TODO djm: add customization

Parameters:
restitution1 -
restitution2 -
Returns:


Copyright © 2012. All Rights Reserved.