Package org.jbox2d.common
Class Settings
java.lang.Object
org.jbox2d.common.Settings
Global tuning constants based on MKS units and various integer maximums
(vertices per shape, pairs, etc.).
- Author:
- Daniel Murphy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic floatThis is used to fatten AABBs in the dynamic tree.static floatThis is used to fatten AABBs in the dynamic tree.static floatA body cannot sleep if its angular velocity is above this tolerance.static floatA small angle used as a collision and constraint tolerance.static floatThis scale factor controls how fast overlap is resolved.static intstatic final floatA "close to zero" float epsilon value for usestatic booleanstatic booleanstatic booleanstatic booleanstatic booleanstatic booleanstatic final intA symbolic constant that stands for particle allocation error.static floatA body cannot sleep if its linear velocity is above this tolerance.static floatA small length used as a collision and constraint tolerance.static floatThe maximum angular position correction used when solving constraints.static floatThe maximum linear position correction used when solving constraints.static intThe maximum number of contact points between two convex shapes.static final floatThe upper limit for particle weight used in pressure calculation.static intThe maximum number of vertices on a convex polygon.static floatThe maximum angular velocity of a body.static floatstatic intMaximum number of sub-steps per contact in continuous physics simulation.static intMaximum number of contacts to be handled to solve a TOI island.static floatThe maximum linear velocity of a body.static floatstatic final intThe maximum distance between particles in a triad, divided by the particle radius.static final intstatic final intThe initial size of particle data buffers.static final floatThe minimum particle weight that produces pressure.static final floatThe standard distance between particles, divided by the particle radius.static final floatPi.static floatThe radius of the polygon/edge shape skin.static booleanstatic final intstatic booleanUse if the table's precision is large (eg .006 or greater).static final floatsmaller the precision, the larger the table.static floatThe time that a body must be still before it will go to sleep.static floatstatic floatA velocity threshold for elastic collisions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatmixFriction(float friction1, float friction2) Friction mixing law.static floatmixRestitution(float restitution1, float restitution2) Restitution mixing law.
-
Field Details
-
EPSILON
public static final float EPSILONA "close to zero" float epsilon value for use- See Also:
-
PI
public static final float PIPi.- See Also:
-
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 -
FAST_POW
public static boolean FAST_POW -
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_PRECISIONsmaller 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:
-
SINCOS_LUT_LENGTH
public static final int SINCOS_LUT_LENGTH -
SINCOS_LUT_LERP
public static boolean SINCOS_LUT_LERPUse 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 int maxManifoldPointsThe maximum number of contact points between two convex shapes. -
maxPolygonVertices
public static int maxPolygonVerticesThe maximum number of vertices on a convex polygon. -
aabbExtension
public static float aabbExtensionThis 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 aabbMultiplierThis 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 linearSlopA small length used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant. -
angularSlop
public static float angularSlopA small angle used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant. -
polygonRadius
public static float polygonRadiusThe 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. -
maxSubSteps
public static int maxSubStepsMaximum number of sub-steps per contact in continuous physics simulation. -
maxTOIContacts
public static int maxTOIContactsMaximum number of contacts to be handled to solve a TOI island. -
velocityThreshold
public static float velocityThresholdA velocity threshold for elastic collisions. Any collision with a relative linear velocity below this threshold will be treated as inelastic. -
maxLinearCorrection
public static float maxLinearCorrectionThe maximum linear position correction used when solving constraints. This helps to prevent overshoot. -
maxAngularCorrection
public static float maxAngularCorrectionThe maximum angular position correction used when solving constraints. This helps to prevent overshoot. -
maxTranslation
public static float maxTranslationThe 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 maxRotationThe 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 -
baumgarte
public static float baumgarteThis 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. -
toiBaugarte
public static float toiBaugarte -
timeToSleep
public static float timeToSleepThe time that a body must be still before it will go to sleep. -
linearSleepTolerance
public static float linearSleepToleranceA body cannot sleep if its linear velocity is above this tolerance. -
angularSleepTolerance
public static float angularSleepToleranceA body cannot sleep if its angular velocity is above this tolerance. -
invalidParticleIndex
public static final int invalidParticleIndexA symbolic constant that stands for particle allocation error.- See Also:
-
particleStride
public static final float particleStrideThe standard distance between particles, divided by the particle radius.- See Also:
-
minParticleWeight
public static final float minParticleWeightThe minimum particle weight that produces pressure.- See Also:
-
maxParticleWeight
public static final float maxParticleWeightThe upper limit for particle weight used in pressure calculation.- See Also:
-
maxTriadDistance
public static final int maxTriadDistanceThe maximum distance between particles in a triad, divided by the particle radius.- See Also:
-
maxTriadDistanceSquared
public static final int maxTriadDistanceSquared- See Also:
-
minParticleBufferCapacity
public static final int minParticleBufferCapacityThe initial size of particle data buffers.- See Also:
-
-
Constructor Details
-
Settings
public Settings()
-
-
Method Details
-
mixFriction
public static float mixFriction(float friction1, float friction2) Friction mixing law. Feel free to customize this. TODO djm: add customization -
mixRestitution
public static float mixRestitution(float restitution1, float restitution2) Restitution mixing law. Feel free to customize this. TODO djm: add customization
-