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 #if !defined(NDEBUG)
27  #define b2DEBUG
28 #endif
29 
30 #define B2_NOT_USED(x) ((void)(x))
31 #define b2Assert(A) assert(A)
32 
33 typedef signed char int8;
34 typedef signed short int16;
35 typedef signed int int32;
36 typedef unsigned char uint8;
37 typedef unsigned short uint16;
38 typedef unsigned int uint32;
39 typedef float float32;
40 typedef double float64;
41 
42 #define b2_maxFloat FLT_MAX
43 #define b2_epsilon FLT_EPSILON
44 #define b2_pi 3.14159265359f
45 
49 
50 // Collision
51 
54 #define b2_maxManifoldPoints 2
55 
58 #define b2_maxPolygonVertices 8
59 
63 #define b2_aabbExtension 0.1f
64 
68 #define b2_aabbMultiplier 2.0f
69 
72 #define b2_linearSlop 0.005f
73 
76 #define b2_angularSlop (2.0f / 180.0f * b2_pi)
77 
81 #define b2_polygonRadius (2.0f * b2_linearSlop)
82 
84 #define b2_maxSubSteps 8
85 
86 
87 // Dynamics
88 
90 #define b2_maxTOIContacts 32
91 
94 #define b2_velocityThreshold 1.0f
95 
98 #define b2_maxLinearCorrection 0.2f
99 
102 #define b2_maxAngularCorrection (8.0f / 180.0f * b2_pi)
103 
106 #define b2_maxTranslation 2.0f
107 #define b2_maxTranslationSquared (b2_maxTranslation * b2_maxTranslation)
108 
111 #define b2_maxRotation (0.5f * b2_pi)
112 #define b2_maxRotationSquared (b2_maxRotation * b2_maxRotation)
113 
117 #define b2_baumgarte 0.2f
118 #define b2_toiBaugarte 0.75f
119 
120 
121 // Sleep
122 
124 #define b2_timeToSleep 0.5f
125 
127 #define b2_linearSleepTolerance 0.01f
128 
130 #define b2_angularSleepTolerance (2.0f / 180.0f * b2_pi)
131 
132 // Memory Allocation
133 
135 void* b2Alloc(int32 size);
136 
138 void b2Free(void* mem);
139 
141 void b2Log(const char* string, ...);
142 
145 struct b2Version
146 {
147  int32 major;
148  int32 minor;
149  int32 revision;
150 };
151 
153 extern b2Version b2_version;
154 
155 #endif
void b2Log(const char *string,...)
Logging function.
Definition: b2Settings.cpp:38
int32 minor
incremental changes
Definition: b2Settings.h:148
void b2Free(void *mem)
If you implement b2Alloc, you should also implement this function.
Definition: b2Settings.cpp:32
void * b2Alloc(int32 size)
Implement this function to use your own memory allocator.
Definition: b2Settings.cpp:27
b2Version b2_version
Current version.
Definition: b2Settings.cpp:24
Definition: b2Settings.h:145
int32 major
significant changes
Definition: b2Settings.h:147
int32 revision
bug fixes
Definition: b2Settings.h:149