Box2D: /build/box2d/src/box2d-2.4.1/include/box2d/b2_common.h File Reference

| Box2D 2.4.1 A 2D physics engine for games

Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
b2_common.h File Reference
`#include "b2_settings.h"`
`#include <stddef.h>`
`#include <assert.h>`
`#include <float.h>`

Go to the source code of this file.

## Classes
struct | b2Version

## Macros
#define | b2DEBUG
#define | B2_NOT_USED(x) ((void)(x))
#define | b2Assert(A) assert(A)
#define | b2_maxFloat FLT_MAX
#define | b2_epsilon FLT_EPSILON
#define | b2_pi 3.14159265359f
#define | b2_maxManifoldPoints 2
#define | b2_aabbExtension (0.1f * b2_lengthUnitsPerMeter)
#define | b2_aabbMultiplier 4.0f
#define | b2_linearSlop (0.005f * b2_lengthUnitsPerMeter)
#define | b2_angularSlop (2.0f / 180.0f * b2_pi)
#define | b2_polygonRadius (2.0f * b2_linearSlop)
#define | b2_maxSubSteps 8
| Maximum number of sub-steps per contact in continuous physics simulation.
#define | b2_maxTOIContacts 32
| Maximum number of contacts to be handled to solve a TOI impact.
#define | b2_maxLinearCorrection (0.2f * b2_lengthUnitsPerMeter)
#define | b2_maxAngularCorrection (8.0f / 180.0f * b2_pi)
#define | b2_maxTranslation (2.0f * b2_lengthUnitsPerMeter)
#define | b2_maxTranslationSquared (b2_maxTranslation * b2_maxTranslation)
#define | b2_maxRotation (0.5f * b2_pi)
#define | b2_maxRotationSquared (b2_maxRotation * b2_maxRotation)
#define | b2_baumgarte 0.2f
#define | b2_toiBaumgarte 0.75f
#define | b2_timeToSleep 0.5f
| The time that a body must be still before it will go to sleep.
#define | b2_linearSleepTolerance (0.01f * b2_lengthUnitsPerMeter)
| A body cannot sleep if its linear velocity is above this tolerance.
#define | b2_angularSleepTolerance (2.0f / 180.0f * b2_pi)
| A body cannot sleep if its angular velocity is above this tolerance.

## Functions
void | b2OpenDump (const char *fileName)
| Dump to a file. Only one dump file allowed at a time.
void | b2Dump (const char *string,...)
void | b2CloseDump ()

## Variables
B2_API b2Version | b2_version
| Current version.

## Detailed Description

Global tuning constants based on meters-kilograms-seconds (MKS) units.

## Macro Definition Documentation

## ◆ b2_aabbExtension

#define b2_aabbExtension (0.1f * b2_lengthUnitsPerMeter)

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.

## ◆ b2_aabbMultiplier

#define b2_aabbMultiplier 4.0f

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.

## ◆ b2_angularSlop

#define b2_angularSlop (2.0f / 180.0f * b2_pi)

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

## ◆ b2_baumgarte

#define b2_baumgarte 0.2f

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.

## ◆ b2_linearSlop

#define b2_linearSlop (0.005f * b2_lengthUnitsPerMeter)

A small length used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant. In meters.

## ◆ b2_maxAngularCorrection

#define b2_maxAngularCorrection (8.0f / 180.0f * b2_pi)

The maximum angular position correction used when solving constraints. This helps to prevent overshoot.

## ◆ b2_maxLinearCorrection

#define b2_maxLinearCorrection (0.2f * b2_lengthUnitsPerMeter)

The maximum linear position correction used when solving constraints. This helps to prevent overshoot. Meters.

## ◆ b2_maxManifoldPoints

#define b2_maxManifoldPoints 2

The maximum number of contact points between two convex shapes. Do not change this value.

## ◆ b2_maxRotation

#define b2_maxRotation (0.5f * b2_pi)

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.

## ◆ b2_maxTranslation

#define b2_maxTranslation (2.0f * b2_lengthUnitsPerMeter)

The maximum linear translation of a body per step. This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this. Meters.

## ◆ b2_polygonRadius

#define b2_polygonRadius (2.0f * b2_linearSlop)

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