Box2D  2.3.0
A 2D Physics Engine for Games
b2Settings.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 * 1. The origin of this software must not be misrepresented; you must not
11 * claim that you wrote the original software. If you use this software
12 * in a product, an acknowledgment in the product documentation would be
13 * appreciated but is not required.
14 * 2. Altered source versions must be plainly marked as such, and must not be
15 * misrepresented as being the original software.
16 * 3. This notice may not be removed or altered from any source distribution.
17 */
18 
19 #ifndef B2_SETTINGS_H
20 #define B2_SETTINGS_H
21 
22 #include <stddef.h>
23 #include <assert.h>
24 #include <float.h>
25 
26 #define B2_NOT_USED(x) ((void)(x))
27 #define b2Assert(A) assert(A)
28 
29 typedef signed char int8;
30 typedef signed short int16;
31 typedef signed int int32;
32 typedef unsigned char uint8;
33 typedef unsigned short uint16;
34 typedef unsigned int uint32;
35 typedef float float32;
36 typedef double float64;
37 
38 #define b2_maxFloat FLT_MAX
39 #define b2_epsilon FLT_EPSILON
40 #define b2_pi 3.14159265359f
41 
45 
46 // Collision
47 
50 #define b2_maxManifoldPoints 2
51 
54 #define b2_maxPolygonVertices 8
55 
59 #define b2_aabbExtension 0.1f
60 
64 #define b2_aabbMultiplier 2.0f
65 
68 #define b2_linearSlop 0.005f
69 
72 #define b2_angularSlop (2.0f / 180.0f * b2_pi)
73 
77 #define b2_polygonRadius (2.0f * b2_linearSlop)
78 
80 #define b2_maxSubSteps 8
81 
82 
83 // Dynamics
84 
86 #define b2_maxTOIContacts 32
87 
90 #define b2_velocityThreshold 1.0f
91 
94 #define b2_maxLinearCorrection 0.2f
95 
98 #define b2_maxAngularCorrection (8.0f / 180.0f * b2_pi)
99 
102 #define b2_maxTranslation 2.0f
103 #define b2_maxTranslationSquared (b2_maxTranslation * b2_maxTranslation)
104 
107 #define b2_maxRotation (0.5f * b2_pi)
108 #define b2_maxRotationSquared (b2_maxRotation * b2_maxRotation)
109 
113 #define b2_baumgarte 0.2f
114 #define b2_toiBaugarte 0.75f
115 
116 
117 // Sleep
118 
120 #define b2_timeToSleep 0.5f
121 
123 #define b2_linearSleepTolerance 0.01f
124 
126 #define b2_angularSleepTolerance (2.0f / 180.0f * b2_pi)
127 
128 // Memory Allocation
129 
131 void* b2Alloc(int32 size);
132 
134 void b2Free(void* mem);
135 
137 void b2Log(const char* string, ...);
138 
141 struct b2Version
142 {
143  int32 major;
144  int32 minor;
145  int32 revision;
146 };
147 
149 extern b2Version b2_version;
150 
151 #endif