22 #ifndef CHIPMUNK_TYPES_H 23 #define CHIPMUNK_TYPES_H 31 #define inline __inline 35 #include "TargetConditionals.h" 41 #if (TARGET_OS_IPHONE || TARGET_OS_MAC) && (!defined CP_USE_CGTYPES) 42 #define CP_USE_CGTYPES 1 47 #import <CoreGraphics/CGGeometry.h> 48 #import <CoreGraphics/CGAffineTransform.h> 50 #include <ApplicationServices/ApplicationServices.h> 53 #if defined(__LP64__) && __LP64__ 54 #define CP_USE_DOUBLES 1 56 #define CP_USE_DOUBLES 0 60 #ifndef CP_USE_DOUBLES 62 #if defined(__ARM_NEON__) 63 #if defined(__arm64) || defined(__arm64__) 64 #define CP_USE_DOUBLES 1 66 #define CP_USE_DOUBLES 0 68 #elif defined(__arm__) || defined(__i386__) || defined(_M_IX86) 69 #define CP_USE_DOUBLES 0 72 #define CP_USE_DOUBLES 1 88 #define cpfatan2 atan2 92 #define cpffloor floor 94 #define CPFLOAT_MIN DBL_MIN 100 #define cpfacos acosf 101 #define cpfatan2 atan2f 105 #define cpffloor floorf 106 #define cpfceil ceilf 107 #define CPFLOAT_MIN FLT_MIN 112 union MSVC_EVIL_FLOAT_HACK
114 unsigned __int8 Bytes[4];
117 static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
118 #define INFINITY (INFINITY_HACK.Value) 122 #define INFINITY (__builtin_inf()) 126 #define INFINITY (1e1000) 131 #define M_PI 3.14159265358979323846264338327950288 135 #define M_E 2.71828182845904523536028747135266250 142 return (a > b) ? a : b;
148 return (a < b) ? a : b;
154 return (f < 0) ? -f : f;
174 return f1*(1.0f - t) + f2*t;
180 return f1 +
cpfclamp(f2 - f1, -d, d);
184 #ifdef CP_HASH_VALUE_TYPE 197 typedef CP_BOOL_TYPE
cpBool;
212 #ifdef CP_DATA_POINTER_TYPE 219 #ifdef CP_COLLISION_TYPE_TYPE 233 #ifdef CP_BITMASK_TYPE 240 #ifdef CP_TIMESTAMP_TYPE 248 #define CP_NO_GROUP ((cpGroup)0) 252 #ifndef CP_ALL_CATEGORIES 253 #define CP_ALL_CATEGORIES (~(cpBitmask)0) 257 #ifndef CP_WILDCARD_COLLISION_TYPE 258 #define CP_WILDCARD_COLLISION_TYPE (~(cpCollisionType)0) static cpFloat cpfclamp01(cpFloat f)
Clamp f to be between 0 and 1.
Definition: chipmunk_types.h:164
void * cpDataPointer
Type used for user data pointers.
Definition: chipmunk_types.h:216
static cpFloat cpfabs(cpFloat f)
Return the absolute value of a cpFloat.
Definition: chipmunk_types.h:152
unsigned char cpBool
Chipmunk's boolean type.
Definition: chipmunk_types.h:199
static cpFloat cpfmin(cpFloat a, cpFloat b)
Return the min of two cpFloats.
Definition: chipmunk_types.h:146
Definition: chipmunk_types.h:284
uintptr_t cpCollisionType
Type used for cpSpace.collision_type.
Definition: chipmunk_types.h:223
unsigned int cpTimestamp
Type used for various timestamps in Chipmunk.
Definition: chipmunk_types.h:244
static cpFloat cpfclamp(cpFloat f, cpFloat min, cpFloat max)
Clamp f to be between min and max.
Definition: chipmunk_types.h:158
double cpFloat
Chipmunk's floating point type.
Definition: chipmunk_types.h:83
unsigned int cpBitmask
Type used for cpShapeFilter category and mask.
Definition: chipmunk_types.h:237
Definition: chipmunk_types.h:271
uint32_t cpCollisionID
Type used internally to cache colliding object info for cpCollideShapes().
Definition: chipmunk_types.h:192
static cpFloat cpfmax(cpFloat a, cpFloat b)
Return the max of two cpFloats.
Definition: chipmunk_types.h:140
uintptr_t cpGroup
Type used for cpShape.group.
Definition: chipmunk_types.h:230
static cpFloat cpflerpconst(cpFloat f1, cpFloat f2, cpFloat d)
Linearly interpolate from f1 to f2 by no more than d.
Definition: chipmunk_types.h:178
uintptr_t cpHashValue
Hash value type.
Definition: chipmunk_types.h:187
static cpFloat cpflerp(cpFloat f1, cpFloat f2, cpFloat t)
Linearly interpolate (or extrapolate) between f1 and f2 by t percent.
Definition: chipmunk_types.h:172