00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef B2_SETTINGS_H
00020 #define B2_SETTINGS_H
00021
00022 #include <cassert>
00023 #include <cmath>
00024
00025 #define B2_NOT_USED(x) ((void)(x))
00026 #define b2Assert(A) assert(A)
00027
00028 typedef signed char int8;
00029 typedef signed short int16;
00030 typedef signed int int32;
00031 typedef unsigned char uint8;
00032 typedef unsigned short uint16;
00033 typedef unsigned int uint32;
00034 typedef float float32;
00035
00036 #define b2_maxFloat FLT_MAX
00037 #define b2_epsilon FLT_EPSILON
00038 #define b2_pi 3.14159265359f
00039
00043
00044
00045
00047 #define b2_maxManifoldPoints 2
00048
00050 #define b2_maxPolygonVertices 8
00051
00055 #define b2_aabbExtension 0.1f
00056
00060 #define b2_aabbMultiplier 2.0f
00061
00064 #define b2_linearSlop 0.005f
00065
00068 #define b2_angularSlop (2.0f / 180.0f * b2_pi)
00069
00073 #define b2_polygonRadius (2.0f * b2_linearSlop)
00074
00075
00076
00077
00079 #define b2_maxTOIContacts 32
00080
00083 #define b2_velocityThreshold 1.0f
00084
00087 #define b2_maxLinearCorrection 0.2f
00088
00091 #define b2_maxAngularCorrection (8.0f / 180.0f * b2_pi)
00092
00095 #define b2_maxTranslation 2.0f
00096 #define b2_maxTranslationSquared (b2_maxTranslation * b2_maxTranslation)
00097
00100 #define b2_maxRotation (0.5f * b2_pi)
00101 #define b2_maxRotationSquared (b2_maxRotation * b2_maxRotation)
00102
00106 #define b2_contactBaumgarte 0.2f
00107
00108
00109
00111 #define b2_timeToSleep 0.5f
00112
00114 #define b2_linearSleepTolerance 0.01f
00115
00117 #define b2_angularSleepTolerance (2.0f / 180.0f * b2_pi)
00118
00119
00120
00122 void* b2Alloc(int32 size);
00123
00125 void b2Free(void* mem);
00126
00129 struct b2Version
00130 {
00131 int32 major;
00132 int32 minor;
00133 int32 revision;
00134 };
00135
00137 extern b2Version b2_version;
00138
00140 inline float32 b2MixFriction(float32 friction1, float32 friction2)
00141 {
00142 return sqrtf(friction1 * friction2);
00143 }
00144
00146 inline float32 b2MixRestitution(float32 restitution1, float32 restitution2)
00147 {
00148 return restitution1 > restitution2 ? restitution1 : restitution2;
00149 }
00150
00151 #endif