Package org.jbox2d.common
Class Settings
- java.lang.Object
-
- org.jbox2d.common.Settings
-
public class Settings extends java.lang.ObjectGlobal tuning constants based on MKS units and various integer maximums (vertices per shape, pairs, etc.).
-
-
Field Summary
Fields Modifier and Type Field Description static floataabbExtensionThis is used to fatten AABBs in the dynamic tree.static floataabbMultiplierThis is used to fatten AABBs in the dynamic tree.static floatangularSleepToleranceA body cannot sleep if its angular velocity is above this tolerance.static floatangularSlopA small angle used as a collision and constraint tolerance.static floatbaumgarteThis scale factor controls how fast overlap is resolved.static intCONTACT_STACK_INIT_SIZEstatic floatEPSILONA "close to zero" float epsilon value for usestatic booleanFAST_ABSstatic booleanFAST_ATAN2static booleanFAST_CEILstatic booleanFAST_FLOORstatic booleanFAST_ROUNDstatic floatlinearSleepToleranceA body cannot sleep if its linear velocity is above this tolerance.static floatlinearSlopA small length used as a collision and constraint tolerance.static floatmaxAngularCorrectionThe maximum angular position correction used when solving constraints.static floatmaxLinearCorrectionThe maximum linear position correction used when solving constraints.static intmaxManifoldPointsThe maximum number of contact points between two convex shapes.static intmaxPolygonVerticesThe maximum number of vertices on a convex polygon.static floatmaxRotationThe maximum angular velocity of a body.static floatmaxRotationSquaredstatic intmaxSubStepsMaximum number of sub-steps per contact in continuous physics simulation.static intmaxTOIContactsMaximum number of contacts to be handled to solve a TOI island.static floatmaxTranslationThe maximum linear velocity of a body.static floatmaxTranslationSquaredstatic floatPIPi.static floatpolygonRadiusThe radius of the polygon/edge shape skin.static booleanSINCOS_LUT_ENABLEDstatic intSINCOS_LUT_LENGTHstatic booleanSINCOS_LUT_LERPUse if the table's precision is large (eg .006 or greater).static floatSINCOS_LUT_PRECISIONsmaller the precision, the larger the table.static floattimeToSleepThe time that a body must be still before it will go to sleep.static floattoiBaugartestatic floatvelocityThresholdA velocity threshold for elastic collisions.
-
Constructor Summary
Constructors Constructor Description Settings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static floatmixFriction(float friction1, float friction2)Friction mixing law.static floatmixRestitution(float restitution1, float restitution2)Restitution mixing law.
-
-
-
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_ABS
public static boolean FAST_ABS
-
FAST_FLOOR
public static boolean FAST_FLOOR
-
FAST_CEIL
public static boolean FAST_CEIL
-
FAST_ROUND
public static boolean FAST_ROUND
-
FAST_ATAN2
public static boolean FAST_ATAN2
-
CONTACT_STACK_INIT_SIZE
public static int CONTACT_STACK_INIT_SIZE
-
SINCOS_LUT_ENABLED
public static boolean SINCOS_LUT_ENABLED
-
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 inSinCosTest. Good lerp precision values:- .0092
- .008201
- .005904
- .005204
- .004305
- .002807
- .001508
- 9.32500E-4
- 7.48000E-4
- 8.47000E-4
- .0005095
- .0001098
- 9.50499E-5
- 6.08500E-5
- 3.07000E-5
- 1.53999E-5
- See Also:
- Constant Field Values
-
SINCOS_LUT_LENGTH
public static final int SINCOS_LUT_LENGTH
-
SINCOS_LUT_LERP
public static 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 inSinCosTest.
-
maxManifoldPoints
public static final int maxManifoldPoints
The maximum number of contact points between two convex shapes.- See Also:
- Constant Field Values
-
maxPolygonVertices
public static final int maxPolygonVertices
The maximum number of vertices on a convex polygon.- See Also:
- Constant Field Values
-
aabbExtension
public static final 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.- See Also:
- Constant Field Values
-
aabbMultiplier
public static final 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.- See Also:
- Constant Field Values
-
linearSlop
public static final float linearSlop
A small length used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.- See Also:
- Constant Field Values
-
angularSlop
public static final float angularSlop
A small angle used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.- See Also:
- Constant Field Values
-
polygonRadius
public static final 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.- See Also:
- Constant Field Values
-
maxSubSteps
public static final int maxSubSteps
Maximum number of sub-steps per contact in continuous physics simulation.- See Also:
- Constant Field Values
-
maxTOIContacts
public static final int maxTOIContacts
Maximum number of contacts to be handled to solve a TOI island.- See Also:
- Constant Field Values
-
velocityThreshold
public static final float velocityThreshold
A velocity threshold for elastic collisions. Any collision with a relative linear velocity below this threshold will be treated as inelastic.- See Also:
- Constant Field Values
-
maxLinearCorrection
public static final float maxLinearCorrection
The maximum linear position correction used when solving constraints. This helps to prevent overshoot.- See Also:
- Constant Field Values
-
maxAngularCorrection
public static final float maxAngularCorrection
The maximum angular position correction used when solving constraints. This helps to prevent overshoot.- See Also:
- Constant Field Values
-
maxTranslation
public static final 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.- See Also:
- Constant Field Values
-
maxTranslationSquared
public static final float maxTranslationSquared
- See Also:
- Constant Field Values
-
maxRotation
public static final 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.- See Also:
- Constant Field Values
-
maxRotationSquared
public static float maxRotationSquared
-
baumgarte
public static final float baumgarte
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.- See Also:
- Constant Field Values
-
toiBaugarte
public static final float toiBaugarte
- See Also:
- Constant Field Values
-
timeToSleep
public static final float timeToSleep
The time that a body must be still before it will go to sleep.- See Also:
- Constant Field Values
-
linearSleepTolerance
public static final float linearSleepTolerance
A body cannot sleep if its linear velocity is above this tolerance.- See Also:
- Constant Field Values
-
angularSleepTolerance
public static final float angularSleepTolerance
A body cannot sleep if its angular velocity is above this tolerance.- See Also:
- Constant Field Values
-
-
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:
-
-