Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Using Chipmunk v6.0.3

  • Loading branch information...
commit 0429fc4a1b89c82d2d008714d35e541f41ebaa5c 1 parent 10ebd4b
@ricardoquesada ricardoquesada authored
Showing with 1,420 additions and 1,363 deletions.
  1. +3 −1 CHANGELOG
  2. +15 −11 external/Chipmunk/include/chipmunk/chipmunk.h
  3. +2 −1  external/Chipmunk/include/chipmunk/chipmunk_ffi.h
  4. +27 −20 external/Chipmunk/include/chipmunk/chipmunk_private.h
  5. +7 −6 external/Chipmunk/include/chipmunk/chipmunk_types.h
  6. +3 −3 external/Chipmunk/include/chipmunk/chipmunk_unsafe.h
  7. +18 −14 external/Chipmunk/include/chipmunk/constraints/cpConstraint.h
  8. +10 −9 external/Chipmunk/include/chipmunk/constraints/cpDampedRotarySpring.h
  9. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpDampedSpring.h
  10. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpGearJoint.h
  11. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpGrooveJoint.h
  12. +10 −10 external/Chipmunk/include/chipmunk/constraints/cpPinJoint.h
  13. +10 −10 external/Chipmunk/include/chipmunk/constraints/cpPivotJoint.h
  14. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpRatchetJoint.h
  15. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpRotaryLimitJoint.h
  16. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpSimpleMotor.h
  17. +9 −9 external/Chipmunk/include/chipmunk/constraints/cpSlideJoint.h
  18. +11 −11 external/Chipmunk/include/chipmunk/constraints/util.h
  19. +14 −10 external/Chipmunk/include/chipmunk/cpArbiter.h
  20. +36 −15 external/Chipmunk/include/chipmunk/cpBB.h
  21. +29 −23 external/Chipmunk/include/chipmunk/cpBody.h
  22. +11 −11 external/Chipmunk/include/chipmunk/cpPolyShape.h
  23. +19 −19 external/Chipmunk/include/chipmunk/cpShape.h
  24. +28 −25 external/Chipmunk/include/chipmunk/cpSpace.h
  25. +27 −27 external/Chipmunk/include/chipmunk/cpSpatialIndex.h
  26. +4 −4 external/Chipmunk/include/chipmunk/cpVect.h
  27. +1 −1  external/Chipmunk/src/CMakeLists.txt
  28. +18 −18 external/Chipmunk/src/chipmunk.c
  29. +8 −8 external/Chipmunk/src/constraints/cpConstraint.c
  30. +9 −9 external/Chipmunk/src/constraints/cpDampedRotarySpring.c
  31. +13 −13 external/Chipmunk/src/constraints/cpDampedSpring.c
  32. +14 −14 external/Chipmunk/src/constraints/cpGearJoint.c
  33. +21 −21 external/Chipmunk/src/constraints/cpGrooveJoint.c
  34. +16 −14 external/Chipmunk/src/constraints/cpPinJoint.c
  35. +15 −15 external/Chipmunk/src/constraints/cpPivotJoint.c
  36. +17 −17 external/Chipmunk/src/constraints/cpRatchetJoint.c
  37. +15 −15 external/Chipmunk/src/constraints/cpRotaryLimitJoint.c
  38. +13 −13 external/Chipmunk/src/constraints/cpSimpleMotor.c
  39. +22 −21 external/Chipmunk/src/constraints/cpSlideJoint.c
  40. +77 −69 external/Chipmunk/src/cpArbiter.c
  41. +16 −16 external/Chipmunk/src/cpArray.c
  42. +6 −6 external/Chipmunk/src/cpBB.c
  43. +119 −110 external/Chipmunk/src/cpBBTree.c
  44. +51 −29 external/Chipmunk/src/cpBody.c
  45. +64 −103 external/Chipmunk/src/cpCollision.c
  46. +47 −47 external/Chipmunk/src/cpHashSet.c
  47. +22 −22 external/Chipmunk/src/cpPolyShape.c
  48. +57 −66 external/Chipmunk/src/cpShape.c
  49. +90 −86 external/Chipmunk/src/cpSpace.c
  50. +54 −52 external/Chipmunk/src/cpSpaceComponent.c
  51. +83 −83 external/Chipmunk/src/cpSpaceHash.c
  52. +28 −28 external/Chipmunk/src/cpSpaceQuery.c
  53. +136 −133 external/Chipmunk/src/cpSpaceStep.c
  54. +2 −2 external/Chipmunk/src/cpSpatialIndex.c
  55. +29 −29 external/Chipmunk/src/cpSweep1D.c
  56. +5 −5 external/Chipmunk/src/cpVect.c
  57. +5 −5 external/Chipmunk/src/prime.h
View
4 CHANGELOG
@@ -1,4 +1,4 @@
-version 2.0-beta2 8-Jan-2012
+version 2.0-beta2 9-Jan-2012
. [NEW] v1.1 Forward-ported changes:
LabelTTF: word wrap works on Mac (issue #1074)
Node: Added onExitTransitionDidStart (issue #792)
@@ -37,6 +37,8 @@ version 2.0-beta2 8-Jan-2012
. [FIX] Tests: ShaderTest centers shaders (Mac)
. [FIX] Texture2D: Uses CGImageRef instead of UIKit for iOS API
. [FIX] TileMaps: Re-added "cc_vertexz" property
+. [3RD] Chipmunk: Using Chipmunk v6.0.3
+
version 2.0-beta 27-Nov-2011
. [NEW] v1.1 Forward-ported changes:
View
26 external/Chipmunk/include/chipmunk/chipmunk.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -19,9 +19,6 @@
* SOFTWARE.
*/
-/// @defgroup misc Misc
-/// @{
-
#ifndef CHIPMUNK_HEADER
#define CHIPMUNK_HEADER
@@ -57,22 +54,27 @@ void cpMessage(const char *condition, const char *file, int line, int isError, i
#include "chipmunk_types.h"
+
+/// @defgroup misc Misc
+/// @{
-// Allocated size for various Chipmunk buffers
+/// Allocated size for various Chipmunk buffers
#ifndef CP_BUFFER_BYTES
#define CP_BUFFER_BYTES (32*1024)
#endif
-// Chipmunk memory function aliases.
#ifndef cpcalloc
+ /// Chipmunk calloc() alias.
#define cpcalloc calloc
#endif
#ifndef cprealloc
+ /// Chipmunk realloc() alias.
#define cprealloc realloc
#endif
#ifndef cpfree
+ /// Chipmunk free() alias.
#define cpfree free
#endif
@@ -96,14 +98,15 @@ typedef struct cpSpace cpSpace;
#include "cpShape.h"
#include "cpPolyShape.h"
-#include "cpArbiter.h"
+#include "cpArbiter.h"
#include "constraints/cpConstraint.h"
#include "cpSpace.h"
+// Chipmunk 6.0.3
#define CP_VERSION_MAJOR 6
#define CP_VERSION_MINOR 0
-#define CP_VERSION_RELEASE 2
+#define CP_VERSION_RELEASE 3
/// Version string.
extern const char *cpVersionString;
@@ -145,6 +148,8 @@ cpFloat cpMomentForBox(cpFloat m, cpFloat width, cpFloat height);
/// Calculate the moment of inertia for a solid box.
cpFloat cpMomentForBox2(cpFloat m, cpBB box);
+//@}
+
#ifdef __cplusplus
}
@@ -156,4 +161,3 @@ static inline cpVect operator -(const cpVect v){return cpvneg(v);}
#endif
#endif
-//@}
View
3  external/Chipmunk/include/chipmunk/chipmunk_ffi.h
@@ -47,6 +47,7 @@ MAKE_REF(cpflerp);
MAKE_REF(cpflerpconst);
MAKE_REF(cpBBNew);
+MAKE_REF(cpBBNewForCircle);
MAKE_REF(cpBBIntersects);
MAKE_REF(cpBBContainsBB);
MAKE_REF(cpBBContainsVect);
@@ -54,6 +55,7 @@ MAKE_REF(cpBBMerge);
MAKE_REF(cpBBExpand);
MAKE_REF(cpBBArea);
MAKE_REF(cpBBMergedArea);
+MAKE_REF(cpBBSegmentQuery);
MAKE_REF(cpBBIntersectsSegment);
MAKE_REF(cpBodyGetMass);
@@ -160,7 +162,6 @@ MAKE_PROPERTIES_REF(cpSpace, Gravity);
MAKE_PROPERTIES_REF(cpSpace, Damping);
MAKE_PROPERTIES_REF(cpSpace, IdleSpeedThreshold);
MAKE_PROPERTIES_REF(cpSpace, SleepTimeThreshold);
-MAKE_PROPERTIES_REF(cpSpace, SleepTimeThreshold);
MAKE_PROPERTIES_REF(cpSpace, CollisionSlop);
MAKE_PROPERTIES_REF(cpSpace, CollisionBias);
MAKE_PROPERTIES_REF(cpSpace, CollisionPersistence);
View
47 external/Chipmunk/include/chipmunk/chipmunk_private.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -25,7 +25,7 @@
#define CP_HASH_COEF (3344921057ul)
#define CP_HASH_PAIR(A, B) ((cpHashValue)(A)*CP_HASH_COEF ^ (cpHashValue)(B)*CP_HASH_COEF)
-#pragma mark cpArray
+//MARK: cpArray
struct cpArray {
int num, max;
@@ -43,7 +43,7 @@ cpBool cpArrayContains(cpArray *arr, void *ptr);
void cpArrayFreeEach(cpArray *arr, void (freeFunc)(void*));
-#pragma mark Foreach loops
+//MARK: Foreach loops
static inline cpConstraint *
cpConstraintNext(cpConstraint *node, cpBody *body)
@@ -69,7 +69,7 @@ cpArbiterNext(cpArbiter *node, cpBody *body)
#define CP_BODY_FOREACH_COMPONENT(root, var)\
for(cpBody *var = root; var; var = var->node.next)
-#pragma mark cpHashSet
+//MARK: cpHashSet
typedef cpBool (*cpHashSetEqlFunc)(void *ptr, void *elt);
typedef void *(*cpHashSetTransFunc)(void *ptr, void *data);
@@ -90,14 +90,14 @@ void cpHashSetEach(cpHashSet *set, cpHashSetIteratorFunc func, void *data);
typedef cpBool (*cpHashSetFilterFunc)(void *elt, void *data);
void cpHashSetFilter(cpHashSet *set, cpHashSetFilterFunc func, void *data);
-#pragma mark Body Functions
+//MARK: Body Functions
void cpBodyAddShape(cpBody *body, cpShape *shape);
void cpBodyRemoveShape(cpBody *body, cpShape *shape);
void cpBodyRemoveConstraint(cpBody *body, cpConstraint *constraint);
-#pragma mark Shape/Collision Functions
+//MARK: Shape/Collision Functions
cpShape* cpShapeInit(cpShape *shape, const cpShapeClass *klass, cpBody *body);
@@ -114,11 +114,11 @@ cpPolyShapeValueOnAxis(const cpPolyShape *poly, const cpVect n, const cpFloat d)
{
cpVect *verts = poly->tVerts;
cpFloat min = cpvdot(n, verts[0]);
-
+
for(int i=1; i<poly->numVerts; i++){
min = cpfmin(min, cpvdot(n, verts[i]));
}
-
+
return min - d;
}
@@ -126,12 +126,12 @@ static inline cpBool
cpPolyShapeContainsVert(const cpPolyShape *poly, const cpVect v)
{
cpPolyShapeAxis *axes = poly->tAxes;
-
+
for(int i=0; i<poly->numVerts; i++){
cpFloat dist = cpvdot(axes[i].n, v) - axes[i].d;
if(dist > 0.0f) return cpFalse;
}
-
+
return cpTrue;
}
@@ -139,30 +139,32 @@ static inline cpBool
cpPolyShapeContainsVertPartial(const cpPolyShape *poly, const cpVect v, const cpVect n)
{
cpPolyShapeAxis *axes = poly->tAxes;
-
+
for(int i=0; i<poly->numVerts; i++){
if(cpvdot(axes[i].n, n) < 0.0f) continue;
cpFloat dist = cpvdot(axes[i].n, v) - axes[i].d;
if(dist > 0.0f) return cpFalse;
}
-
+
return cpTrue;
}
-#pragma mark Spatial Index Functions
+//MARK: Spatial Index Functions
cpSpatialIndex *cpSpatialIndexInit(cpSpatialIndex *index, cpSpatialIndexClass *klass, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
-#pragma mark Space Functions
+//MARK: Space Functions
extern cpCollisionHandler cpDefaultCollisionHandler;
void cpSpaceProcessComponents(cpSpace *space, cpFloat dt);
+void cpSpacePushFreshContactBuffer(cpSpace *space);
cpContact *cpContactBufferGetArray(cpSpace *space);
void cpSpacePushContacts(cpSpace *space, int count);
void *cpSpaceGetPostStepData(cpSpace *space, void *obj);
+cpBool cpSpaceArbiterSetFilter(cpArbiter *arb, cpSpace *space);
void cpSpaceFilterArbiters(cpSpace *space, cpBody *body, cpShape *filter);
void cpSpaceActivateBody(cpSpace *space, cpBody *body);
@@ -181,23 +183,28 @@ cpSpaceUncacheArbiter(cpSpace *space, cpArbiter *arb)
{
cpShape *a = arb->a, *b = arb->b;
cpShape *shape_pair[] = {a, b};
- cpHashValue arbHashID = CP_HASH_PAIR((size_t)a, (size_t)b);
+ cpHashValue arbHashID = CP_HASH_PAIR((cpHashValue)a, (cpHashValue)b);
cpHashSetRemove(space->cachedArbiters, arbHashID, shape_pair);
cpArrayDeleteObj(space->arbiters, arb);
}
-#pragma mark Arbiters
+void cpShapeUpdateFunc(cpShape *shape, void *unused);
+void cpSpaceCollideShapes(cpShape *a, cpShape *b, cpSpace *space);
+
+
+
+//MARK: Arbiters
struct cpContact {
cpVect p, n;
cpFloat dist;
-
+
cpVect r1, r2;
cpFloat nMass, tMass, bounce;
cpFloat jnAcc, jtAcc, jBias;
cpFloat bias;
-
+
cpHashValue hash;
};
View
13 external/Chipmunk/include/chipmunk/chipmunk_types.h
@@ -1,11 +1,12 @@
+#include <math.h>
#include <stdint.h>
#ifdef __APPLE__
#import "TargetConditionals.h"
#endif
-#if (defined TARGET_OS_IPHONE) && (!defined CP_USE_CGPOINTS)
- #define CP_USE_CGPOINTS
+#if (TARGET_OS_IPHONE == 1) && (!defined CP_USE_CGPOINTS)
+ #define CP_USE_CGPOINTS 1
#endif
#ifdef CP_USE_CGPOINTS
@@ -14,7 +15,7 @@
#elif TARGET_OS_MAC
#import <ApplicationServices/ApplicationServices.h>
#endif
-
+
#if defined(__LP64__) && __LP64__
#define CP_USE_DOUBLES 1
#else
@@ -70,11 +71,11 @@
static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
#define INFINITY (INFINITY_HACK.Value)
#endif
-
+
#ifdef __GNUC__
#define INFINITY (__builtin_inf())
#endif
-
+
#ifndef INFINITY
#define INFINITY (1e1000)
#endif
@@ -136,8 +137,8 @@ static inline cpFloat cpflerpconst(cpFloat f1, cpFloat f2, cpFloat d)
/// Hash value type.
typedef uintptr_t cpHashValue;
+// Oh C, how we love to define our own boolean types to get compiler compatibility
/// Chipmunk's boolean type.
-/// Oh C, how we love to define our own boolean types to get compiler compatibility
#ifdef CP_BOOL_TYPE
typedef CP_BOOL_TYPE cpBool;
#else
View
6 external/Chipmunk/include/chipmunk/chipmunk_unsafe.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
View
32 external/Chipmunk/include/chipmunk/constraints/cpConstraint.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,25 +37,26 @@ struct cpConstraintClass {
cpConstraintGetImpulseImpl getImpulse;
};
-
+/// Callback function type that gets called before solving a joint.
typedef void (*cpConstraintPreSolveFunc)(cpConstraint *constraint, cpSpace *space);
+/// Callback function type that gets called after solving a joint.
typedef void (*cpConstraintPostSolveFunc)(cpConstraint *constraint, cpSpace *space);
/// Opaque cpConstraint struct.
struct cpConstraint {
CP_PRIVATE(const cpConstraintClass *klass);
-
+
/// The first body connected to this constraint.
cpBody *a;
/// The second body connected to this constraint.
cpBody *b;
-
+
CP_PRIVATE(cpSpace *space);
-
+
CP_PRIVATE(cpConstraint *next_a);
CP_PRIVATE(cpConstraint *next_b);
-
+
/// The maximum force that this constraint is allowed to use.
/// Defaults to infinity.
cpFloat maxForce;
@@ -66,15 +67,15 @@ struct cpConstraint {
/// The maximum rate at which joint error is corrected.
/// Defaults to infinity.
cpFloat maxBias;
-
+
/// Function called before the solver runs.
/// Animate your joint anchors, update your motor torque, etc.
cpConstraintPreSolveFunc preSolve;
-
+
/// Function called after the solver runs.
/// Use the applied impulse to perform effects like breakable joints.
cpConstraintPostSolveFunc postSolve;
-
+
/// User definable data pointer.
/// Generally this points to your the game object class so you can access it
/// when given a cpConstraint reference in a callback.
@@ -93,21 +94,24 @@ static inline void cpConstraintActivateBodies(cpConstraint *constraint)
cpBody *b = constraint->b; if(b) cpBodyActivate(b);
}
+/// @private
#define CP_DefineConstraintStructGetter(type, member, name) \
static inline type cpConstraint##Get##name(const cpConstraint *constraint){return constraint->member;}
+/// @private
#define CP_DefineConstraintStructSetter(type, member, name) \
static inline void cpConstraint##Set##name(cpConstraint *constraint, type value){ \
cpConstraintActivateBodies(constraint); \
constraint->member = value; \
}
+/// @private
#define CP_DefineConstraintStructProperty(type, member, name) \
CP_DefineConstraintStructGetter(type, member, name) \
CP_DefineConstraintStructSetter(type, member, name)
-CP_DefineConstraintStructGetter(cpBody *, a, A);
-CP_DefineConstraintStructGetter(cpBody *, b, B);
+CP_DefineConstraintStructGetter(cpBody*, a, A);
+CP_DefineConstraintStructGetter(cpBody*, b, B);
CP_DefineConstraintStructProperty(cpFloat, maxForce, MaxForce);
CP_DefineConstraintStructProperty(cpFloat, errorBias, ErrorBias);
CP_DefineConstraintStructProperty(cpFloat, maxBias, MaxBias);
@@ -115,7 +119,7 @@ CP_DefineConstraintStructProperty(cpConstraintPreSolveFunc, preSolve, PreSolveFu
CP_DefineConstraintStructProperty(cpConstraintPostSolveFunc, postSolve, PostSolveFunc);
CP_DefineConstraintStructProperty(cpDataPointer, data, UserData);
-/// Get the last impulse applied by this constraint.
+// Get the last impulse applied by this constraint.
static inline cpFloat cpConstraintGetImpulse(cpConstraint *constraint)
{
return constraint->CP_PRIVATE(klass)->getImpulse(constraint);
View
19 external/Chipmunk/include/chipmunk/constraints/cpDampedRotarySpring.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -24,27 +24,28 @@
typedef cpFloat (*cpDampedRotarySpringTorqueFunc)(struct cpConstraint *spring, cpFloat relativeAngle);
-const cpConstraintClass *cpDampedRotarySpringGetClass();
+const cpConstraintClass *cpDampedRotarySpringGetClass(void);
+/// @private
typedef struct cpDampedRotarySpring {
cpConstraint constraint;
cpFloat restAngle;
cpFloat stiffness;
cpFloat damping;
cpDampedRotarySpringTorqueFunc springTorqueFunc;
-
+
cpFloat target_wrn;
cpFloat w_coef;
-
+
cpFloat iSum;
} cpDampedRotarySpring;
/// Allocate a damped rotary spring.
-cpDampedRotarySpring *cpDampedRotarySpringAlloc(void);
+cpDampedRotarySpring* cpDampedRotarySpringAlloc(void);
/// Initialize a damped rotary spring.
-cpDampedRotarySpring *cpDampedRotarySpringInit(cpDampedRotarySpring *joint, cpBody *a, cpBody *b, cpFloat restAngle, cpFloat stiffness, cpFloat damping);
+cpDampedRotarySpring* cpDampedRotarySpringInit(cpDampedRotarySpring *joint, cpBody *a, cpBody *b, cpFloat restAngle, cpFloat stiffness, cpFloat damping);
/// Allocate and initialize a damped rotary spring.
-cpConstraint *cpDampedRotarySpringNew(cpBody *a, cpBody *b, cpFloat restAngle, cpFloat stiffness, cpFloat damping);
+cpConstraint* cpDampedRotarySpringNew(cpBody *a, cpBody *b, cpFloat restAngle, cpFloat stiffness, cpFloat damping);
CP_DefineConstraintProperty(cpDampedRotarySpring, cpFloat, restAngle, RestAngle);
CP_DefineConstraintProperty(cpDampedRotarySpring, cpFloat, stiffness, Stiffness);
View
18 external/Chipmunk/include/chipmunk/constraints/cpDampedSpring.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -26,7 +26,7 @@ typedef struct cpDampedSpring cpDampedSpring;
typedef cpFloat (*cpDampedSpringForceFunc)(cpConstraint *spring, cpFloat dist);
-const cpConstraintClass *cpDampedSpringGetClass();
+const cpConstraintClass *cpDampedSpringGetClass(void);
/// @private
struct cpDampedSpring {
@@ -36,21 +36,21 @@ struct cpDampedSpring {
cpFloat stiffness;
cpFloat damping;
cpDampedSpringForceFunc springForceFunc;
-
+
cpFloat target_vrn;
cpFloat v_coef;
-
+
cpVect r1, r2;
cpFloat nMass;
cpVect n;
};
/// Allocate a damped spring.
-cpDampedSpring *cpDampedSpringAlloc(void);
+cpDampedSpring* cpDampedSpringAlloc(void);
/// Initialize a damped spring.
-cpDampedSpring *cpDampedSpringInit(cpDampedSpring *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping);
+cpDampedSpring* cpDampedSpringInit(cpDampedSpring *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping);
/// Allocate and initialize a damped spring.
-cpConstraint *cpDampedSpringNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping);
+cpConstraint* cpDampedSpringNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping);
CP_DefineConstraintProperty(cpDampedSpring, cpVect, anchr1, Anchr1);
CP_DefineConstraintProperty(cpDampedSpring, cpVect, anchr2, Anchr2);
View
18 external/Chipmunk/include/chipmunk/constraints/cpGearJoint.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,26 +22,26 @@
/// @defgroup cpGearJoint cpGearJoint
/// @{
-const cpConstraintClass *cpGearJointGetClass();
+const cpConstraintClass *cpGearJointGetClass(void);
/// @private
typedef struct cpGearJoint {
cpConstraint constraint;
cpFloat phase, ratio;
cpFloat ratio_inv;
-
+
cpFloat iSum;
-
+
cpFloat bias;
cpFloat jAcc, jMax;
} cpGearJoint;
/// Allocate a gear joint.
-cpGearJoint *cpGearJointAlloc(void);
+cpGearJoint* cpGearJointAlloc(void);
/// Initialize a gear joint.
-cpGearJoint *cpGearJointInit(cpGearJoint *joint, cpBody *a, cpBody *b, cpFloat phase, cpFloat ratio);
+cpGearJoint* cpGearJointInit(cpGearJoint *joint, cpBody *a, cpBody *b, cpFloat phase, cpFloat ratio);
/// Allocate and initialize a gear joint.
-cpConstraint *cpGearJointNew(cpBody *a, cpBody *b, cpFloat phase, cpFloat ratio);
+cpConstraint* cpGearJointNew(cpBody *a, cpBody *b, cpFloat phase, cpFloat ratio);
CP_DefineConstraintProperty(cpGearJoint, cpFloat, phase, Phase);
CP_DefineConstraintGetter(cpGearJoint, cpFloat, ratio, Ratio);
View
18 external/Chipmunk/include/chipmunk/constraints/cpGrooveJoint.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,30 +22,30 @@
/// @defgroup cpGrooveJoint cpGrooveJoint
/// @{
-const cpConstraintClass *cpGrooveJointGetClass();
+const cpConstraintClass *cpGrooveJointGetClass(void);
/// @private
typedef struct cpGrooveJoint {
cpConstraint constraint;
cpVect grv_n, grv_a, grv_b;
cpVect anchr2;
-
+
cpVect grv_tn;
cpFloat clamp;
cpVect r1, r2;
cpVect k1, k2;
-
+
cpVect jAcc;
cpFloat jMaxLen;
cpVect bias;
} cpGrooveJoint;
/// Allocate a groove joint.
-cpGrooveJoint *cpGrooveJointAlloc(void);
+cpGrooveJoint* cpGrooveJointAlloc(void);
/// Initialize a groove joint.
-cpGrooveJoint *cpGrooveJointInit(cpGrooveJoint *joint, cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
+cpGrooveJoint* cpGrooveJointInit(cpGrooveJoint *joint, cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
/// Allocate and initialize a groove joint.
-cpConstraint *cpGrooveJointNew(cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
+cpConstraint* cpGrooveJointNew(cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_a, GrooveA);
/// Set endpoint a of a groove joint's groove
View
20 external/Chipmunk/include/chipmunk/constraints/cpPinJoint.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -18,32 +18,32 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-
+
/// @defgroup cpPinJoint cpPinJoint
/// @{
-const cpConstraintClass *cpPinJointGetClass();
+const cpConstraintClass *cpPinJointGetClass(void);
/// @private
typedef struct cpPinJoint {
cpConstraint constraint;
cpVect anchr1, anchr2;
cpFloat dist;
-
+
cpVect r1, r2;
cpVect n;
cpFloat nMass;
-
+
cpFloat jnAcc, jnMax;
cpFloat bias;
} cpPinJoint;
/// Allocate a pin joint.
-cpPinJoint *cpPinJointAlloc(void);
+cpPinJoint* cpPinJointAlloc(void);
/// Initialize a pin joint.
-cpPinJoint *cpPinJointInit(cpPinJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
+cpPinJoint* cpPinJointInit(cpPinJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
/// Allocate and initialize a pin joint.
-cpConstraint *cpPinJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
+cpConstraint* cpPinJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr1, Anchr1);
CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr2, Anchr2);
View
20 external/Chipmunk/include/chipmunk/constraints/cpPivotJoint.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,29 +22,29 @@
/// @defgroup cpPivotJoint cpPivotJoint
/// @{
-const cpConstraintClass *cpPivotJointGetClass();
+const cpConstraintClass *cpPivotJointGetClass(void);
/// @private
typedef struct cpPivotJoint {
cpConstraint constraint;
cpVect anchr1, anchr2;
-
+
cpVect r1, r2;
cpVect k1, k2;
-
+
cpVect jAcc;
cpFloat jMaxLen;
cpVect bias;
} cpPivotJoint;
/// Allocate a pivot joint
-cpPivotJoint *cpPivotJointAlloc(void);
+cpPivotJoint* cpPivotJointAlloc(void);
/// Initialize a pivot joint.
-cpPivotJoint *cpPivotJointInit(cpPivotJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
+cpPivotJoint* cpPivotJointInit(cpPivotJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
/// Allocate and initialize a pivot joint.
-cpConstraint *cpPivotJointNew(cpBody *a, cpBody *b, cpVect pivot);
+cpConstraint* cpPivotJointNew(cpBody *a, cpBody *b, cpVect pivot);
/// Allocate and initialize a pivot joint with specific anchors.
-cpConstraint *cpPivotJointNew2(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
+cpConstraint* cpPivotJointNew2(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2);
CP_DefineConstraintProperty(cpPivotJoint, cpVect, anchr1, Anchr1);
CP_DefineConstraintProperty(cpPivotJoint, cpVect, anchr2, Anchr2);
View
18 external/Chipmunk/include/chipmunk/constraints/cpRatchetJoint.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,25 +22,25 @@
/// @defgroup cpRatchetJoint cpRatchetJoint
/// @{
-const cpConstraintClass *cpRatchetJointGetClass();
+const cpConstraintClass *cpRatchetJointGetClass(void);
/// @private
typedef struct cpRatchetJoint {
cpConstraint constraint;
cpFloat angle, phase, ratchet;
-
+
cpFloat iSum;
-
+
cpFloat bias;
cpFloat jAcc, jMax;
} cpRatchetJoint;
/// Allocate a ratchet joint.
-cpRatchetJoint *cpRatchetJointAlloc(void);
+cpRatchetJoint* cpRatchetJointAlloc(void);
/// Initialize a ratched joint.
-cpRatchetJoint *cpRatchetJointInit(cpRatchetJoint *joint, cpBody *a, cpBody *b, cpFloat phase, cpFloat ratchet);
+cpRatchetJoint* cpRatchetJointInit(cpRatchetJoint *joint, cpBody *a, cpBody *b, cpFloat phase, cpFloat ratchet);
/// Allocate and initialize a ratchet joint.
-cpConstraint *cpRatchetJointNew(cpBody *a, cpBody *b, cpFloat phase, cpFloat ratchet);
+cpConstraint* cpRatchetJointNew(cpBody *a, cpBody *b, cpFloat phase, cpFloat ratchet);
CP_DefineConstraintProperty(cpRatchetJoint, cpFloat, angle, Angle);
CP_DefineConstraintProperty(cpRatchetJoint, cpFloat, phase, Phase);
View
18 external/Chipmunk/include/chipmunk/constraints/cpRotaryLimitJoint.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,25 +22,25 @@
/// @defgroup cpRotaryLimitJoint cpRotaryLimitJoint
/// @{
-const cpConstraintClass *cpRotaryLimitJointGetClass();
+const cpConstraintClass *cpRotaryLimitJointGetClass(void);
/// @private
typedef struct cpRotaryLimitJoint {
cpConstraint constraint;
cpFloat min, max;
-
+
cpFloat iSum;
-
+
cpFloat bias;
cpFloat jAcc, jMax;
} cpRotaryLimitJoint;
/// Allocate a damped rotary limit joint.
-cpRotaryLimitJoint *cpRotaryLimitJointAlloc(void);
+cpRotaryLimitJoint* cpRotaryLimitJointAlloc(void);
/// Initialize a damped rotary limit joint.
-cpRotaryLimitJoint *cpRotaryLimitJointInit(cpRotaryLimitJoint *joint, cpBody *a, cpBody *b, cpFloat min, cpFloat max);
+cpRotaryLimitJoint* cpRotaryLimitJointInit(cpRotaryLimitJoint *joint, cpBody *a, cpBody *b, cpFloat min, cpFloat max);
/// Allocate and initialize a damped rotary limit joint.
-cpConstraint *cpRotaryLimitJointNew(cpBody *a, cpBody *b, cpFloat min, cpFloat max);
+cpConstraint* cpRotaryLimitJointNew(cpBody *a, cpBody *b, cpFloat min, cpFloat max);
CP_DefineConstraintProperty(cpRotaryLimitJoint, cpFloat, min, Min);
CP_DefineConstraintProperty(cpRotaryLimitJoint, cpFloat, max, Max);
View
18 external/Chipmunk/include/chipmunk/constraints/cpSimpleMotor.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,24 +22,24 @@
/// @defgroup cpSimpleMotor cpSimpleMotor
/// @{
-const cpConstraintClass *cpSimpleMotorGetClass();
+const cpConstraintClass *cpSimpleMotorGetClass(void);
/// @private
typedef struct cpSimpleMotor {
cpConstraint constraint;
cpFloat rate;
-
+
cpFloat iSum;
-
+
cpFloat jAcc, jMax;
} cpSimpleMotor;
/// Allocate a simple motor.
-cpSimpleMotor *cpSimpleMotorAlloc(void);
+cpSimpleMotor* cpSimpleMotorAlloc(void);
/// initialize a simple motor.
-cpSimpleMotor *cpSimpleMotorInit(cpSimpleMotor *joint, cpBody *a, cpBody *b, cpFloat rate);
+cpSimpleMotor* cpSimpleMotorInit(cpSimpleMotor *joint, cpBody *a, cpBody *b, cpFloat rate);
/// Allocate and initialize a simple motor.
-cpConstraint *cpSimpleMotorNew(cpBody *a, cpBody *b, cpFloat rate);
+cpConstraint* cpSimpleMotorNew(cpBody *a, cpBody *b, cpFloat rate);
CP_DefineConstraintProperty(cpSimpleMotor, cpFloat, rate, Rate);
View
18 external/Chipmunk/include/chipmunk/constraints/cpSlideJoint.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,28 +22,28 @@
/// @defgroup cpSlideJoint cpSlideJoint
/// @{
-const cpConstraintClass *cpSlideJointGetClass();
+const cpConstraintClass *cpSlideJointGetClass(void);
/// @private
typedef struct cpSlideJoint {
cpConstraint constraint;
cpVect anchr1, anchr2;
cpFloat min, max;
-
+
cpVect r1, r2;
cpVect n;
cpFloat nMass;
-
+
cpFloat jnAcc, jnMax;
cpFloat bias;
} cpSlideJoint;
/// Allocate a slide joint.
-cpSlideJoint *cpSlideJointAlloc(void);
+cpSlideJoint* cpSlideJointAlloc(void);
/// Initialize a slide joint.
-cpSlideJoint *cpSlideJointInit(cpSlideJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max);
+cpSlideJoint* cpSlideJointInit(cpSlideJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max);
/// Allocate and initialize a slide joint.
-cpConstraint *cpSlideJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max);
+cpConstraint* cpSlideJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat min, cpFloat max);
CP_DefineConstraintProperty(cpSlideJoint, cpVect, anchr1, Anchr1);
CP_DefineConstraintProperty(cpSlideJoint, cpVect, anchr2, Anchr2);
View
22 external/Chipmunk/include/chipmunk/constraints/util.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -23,7 +23,7 @@
// I'm not sure if this should be part of the private API or not.
// I should probably clean up the naming conventions if it is...
-#define CP_DefineClassGetter(t) const cpConstraintClass * t##GetClass(){return (cpConstraintClass *)&klass;}
+#define CP_DefineClassGetter(t) const cpConstraintClass * t##GetClass(void){return (cpConstraintClass *)&klass;}
void cpConstraintInit(cpConstraint *constraint, const cpConstraintClass *klass, cpBody *a, cpBody *b);
@@ -33,7 +33,7 @@ static inline cpVect
relative_velocity(cpBody *a, cpBody *b, cpVect r1, cpVect r2){
cpVect v1_sum = cpvadd(a->v, cpvmult(cpvperp(r1), a->w));
cpVect v2_sum = cpvadd(b->v, cpvmult(cpvperp(r2), b->w));
-
+
return cpvsub(v2_sum, v1_sum);
}
@@ -81,7 +81,7 @@ k_scalar(cpBody *a, cpBody *b, cpVect r1, cpVect r2, cpVect n)
{
cpFloat value = k_scalar_body(a, r1, n) + k_scalar_body(b, r2, n);
cpAssertSoft(value != 0.0, "Unsolvable collision or constraint.");
-
+
return value;
}
@@ -92,11 +92,11 @@ k_tensor(cpBody *a, cpBody *b, cpVect r1, cpVect r2, cpVect *k1, cpVect *k2)
// If I wasn't lazy and wrote a proper matrix class, this wouldn't be so gross...
cpFloat k11, k12, k21, k22;
cpFloat m_sum = a->m_inv + b->m_inv;
-
+
// start with I*m_sum
k11 = m_sum; k12 = 0.0f;
k21 = 0.0f; k22 = m_sum;
-
+
// add the influence from r1
cpFloat a_i_inv = a->i_inv;
cpFloat r1xsq = r1.x * r1.x * a_i_inv;
@@ -104,7 +104,7 @@ k_tensor(cpBody *a, cpBody *b, cpVect r1, cpVect r2, cpVect *k1, cpVect *k2)
cpFloat r1nxy = -r1.x * r1.y * a_i_inv;
k11 += r1ysq; k12 += r1nxy;
k21 += r1nxy; k22 += r1xsq;
-
+
// add the influnce from r2
cpFloat b_i_inv = b->i_inv;
cpFloat r2xsq = r2.x * r2.x * b_i_inv;
@@ -112,11 +112,11 @@ k_tensor(cpBody *a, cpBody *b, cpVect r1, cpVect r2, cpVect *k1, cpVect *k2)
cpFloat r2nxy = -r2.x * r2.y * b_i_inv;
k11 += r2ysq; k12 += r2nxy;
k21 += r2nxy; k22 += r2xsq;
-
+
// invert
cpFloat determinant = k11*k22 - k12*k21;
cpAssertSoft(determinant != 0.0, "Unsolvable constraint.");
-
+
cpFloat det_inv = 1.0f/determinant;
*k1 = cpv( k22*det_inv, -k12*det_inv);
*k2 = cpv(-k21*det_inv, k11*det_inv);
View
24 external/Chipmunk/include/chipmunk/cpArbiter.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -82,18 +82,18 @@ struct cpArbiter {
/// Calculated value to use for applying surface velocities.
/// Override in a pre-solve collision handler for custom behavior.
cpVect surface_vr;
-
+
CP_PRIVATE(cpShape *a);
CP_PRIVATE(cpShape *b);
CP_PRIVATE(cpBody *body_a);
CP_PRIVATE(cpBody *body_b);
-
+
CP_PRIVATE(struct cpArbiterThread thread_a);
CP_PRIVATE(struct cpArbiterThread thread_b);
-
+
CP_PRIVATE(int numContacts);
CP_PRIVATE(cpContact *contacts);
-
+
CP_PRIVATE(cpTimestamp stamp);
CP_PRIVATE(cpCollisionHandler *handler);
CP_PRIVATE(cpBool swappedColl);
@@ -115,11 +115,15 @@ CP_DefineArbiterStructProperty(cpFloat, u, Friction);
CP_DefineArbiterStructProperty(cpVect, surface_vr, SurfaceVelocity);
/// Calculate the total impulse that was applied by this arbiter.
-/// Calling this function from a begin or pre-solve callback is undefined.
+/// This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.
cpVect cpArbiterTotalImpulse(const cpArbiter *arb);
/// Calculate the total impulse including the friction that was applied by this arbiter.
-/// Calling this function from a begin or pre-solve callback is undefined.
+/// This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.
cpVect cpArbiterTotalImpulseWithFriction(const cpArbiter *arb);
+/// Calculate the amount of energy lost in a collision including static, but not dynamic friction.
+/// This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.
+cpFloat cpArbiterTotalKE(const cpArbiter *arb);
+
/// Causes a collision pair to be ignored as if you returned false from a begin callback.
/// If called from a pre-step callback, you will still need to return false
@@ -168,7 +172,7 @@ static inline int cpArbiterGetCount(const cpArbiter *arb)
typedef struct cpContactPointSet {
/// The number of contact points in the set.
int count;
-
+
/// The array of contact points.
struct {
/// The position of the contact point.
View
51 external/Chipmunk/include/chipmunk/cpBB.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -29,13 +29,18 @@ typedef struct cpBB{
} cpBB;
/// Convenience constructor for cpBB structs.
-static inline cpBB cpBBNew(const cpFloat l, const cpFloat b,
- const cpFloat r, const cpFloat t)
+static inline cpBB cpBBNew(const cpFloat l, const cpFloat b, const cpFloat r, const cpFloat t)
{
cpBB bb = {l, b, r, t};
return bb;
}
+/// Constructs a cpBB for a circle with the given position and radius.
+static inline cpBB cpBBNewForCircle(const cpVect p, const cpFloat r)
+{
+ return cpBBNew(p.x - r, p.y - r, p.x + r, p.y + r);
+}
+
/// Returns true if @c a and @c b intersect.
static inline cpBool cpBBIntersects(const cpBB a, const cpBB b)
{
@@ -86,19 +91,35 @@ static inline cpFloat cpBBMergedArea(cpBB a, cpBB b)
return (cpfmax(a.r, b.r) - cpfmin(a.l, b.l))*(cpfmax(a.t, b.t) - cpfmin(a.b, b.b));
}
-/// Return true if the bounding box intersects the line segment with ends @c a and @c b.
-static inline cpBool cpBBIntersectsSegment(cpBB bb, cpVect a, cpVect b)
+/// Returns the fraction along the segment query the cpBB is hit. Returns INFINITY if it doesn't hit.
+static inline cpFloat cpBBSegmentQuery(cpBB bb, cpVect a, cpVect b)
{
- cpBB seg_bb = cpBBNew(cpfmin(a.x, b.x), cpfmin(a.y, b.y), cpfmax(a.x, b.x), cpfmax(a.y, b.y));
- if(cpBBIntersects(bb, seg_bb)){
- cpVect axis = cpv(b.y - a.y, a.x - b.x);
- cpVect offset = cpv((a.x + b.x - bb.r - bb.l), (a.y + b.y - bb.t - bb.b));
- cpVect extents = cpv(bb.r - bb.l, bb.t - bb.b);
-
- return (cpfabs(cpvdot(axis, offset)) < cpfabs(axis.x*extents.x) + cpfabs(axis.y*extents.y));
+ cpFloat idx = 1.0f/(b.x - a.x);
+ cpFloat tx1 = (bb.l == a.x ? -INFINITY : (bb.l - a.x)*idx);
+ cpFloat tx2 = (bb.r == a.x ? INFINITY : (bb.r - a.x)*idx);
+ cpFloat txmin = cpfmin(tx1, tx2);
+ cpFloat txmax = cpfmax(tx1, tx2);
+
+ cpFloat idy = 1.0f/(b.y - a.y);
+ cpFloat ty1 = (bb.b == a.y ? -INFINITY : (bb.b - a.y)*idy);
+ cpFloat ty2 = (bb.t == a.y ? INFINITY : (bb.t - a.y)*idy);
+ cpFloat tymin = cpfmin(ty1, ty2);
+ cpFloat tymax = cpfmax(ty1, ty2);
+
+ if(tymin <= txmax && txmin <= tymax){
+ cpFloat min = cpfmax(txmin, tymin);
+ cpFloat max = cpfmin(txmax, tymax);
+
+ if(0.0 <= max && min <= 1.0) return cpfmax(min, 0.0);
}
+
+ return INFINITY;
+}
- return cpFalse;
+/// Return true if the bounding box intersects the line segment with ends @c a and @c b.
+static inline cpBool cpBBIntersectsSegment(cpBB bb, cpVect a, cpVect b)
+{
+ return (cpBBSegmentQuery(bb, a, b) != INFINITY);
}
/// Clamp a vector to a bounding box.
View
52 external/Chipmunk/include/chipmunk/cpBody.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -42,29 +42,29 @@ typedef struct cpComponentNode {
struct cpBody {
/// Function that is called to integrate the body's velocity. (Defaults to cpBodyUpdateVelocity)
cpBodyVelocityFunc velocity_func;
-
+
/// Function that is called to integrate the body's position. (Defaults to cpBodyUpdatePosition)
cpBodyPositionFunc position_func;
-
+
/// Mass of the body.
/// Must agree with cpBody.m_inv! Use cpBodySetMass() when changing the mass for this reason.
cpFloat m;
/// Mass inverse.
cpFloat m_inv;
-
+
/// Moment of inertia of the body.
/// Must agree with cpBody.i_inv! Use cpBodySetMoment() when changing the moment for this reason.
cpFloat i;
/// Moment of inertia inverse.
cpFloat i_inv;
-
+
/// Position of the rigid body's center of gravity.
cpVect p;
/// Velocity of the rigid body's center of gravity.
cpVect v;
/// Force acting on the rigid body's center of gravity.
cpVect f;
-
+
/// Rotation of the body around it's center of gravity in radians.
/// Must agree with cpBody.rot! Use cpBodySetAngle() when changing the angle for this reason.
cpFloat a;
@@ -72,44 +72,44 @@ struct cpBody {
cpFloat w;
/// Torque applied to the body around it's center of gravity.
cpFloat t;
-
+
/// Cached unit length vector representing the angle of the body.
/// Used for fast rotations using cpvrotate().
cpVect rot;
-
+
/// User definable data pointer.
/// Generally this points to your the game object class so you can access it
/// when given a cpBody reference in a callback.
cpDataPointer data;
-
+
/// Maximum velocity allowed when updating the velocity.
cpFloat v_limit;
/// Maximum rotational rate (in radians/second) allowed when updating the angular velocity.
cpFloat w_limit;
-
+
CP_PRIVATE(cpVect v_bias);
CP_PRIVATE(cpFloat w_bias);
-
+
CP_PRIVATE(cpSpace *space);
-
+
CP_PRIVATE(cpShape *shapeList);
CP_PRIVATE(cpArbiter *arbiterList);
CP_PRIVATE(cpConstraint *constraintList);
-
+
CP_PRIVATE(cpComponentNode node);
};
/// Allocate a cpBody.
-cpBody *cpBodyAlloc(void);
+cpBody* cpBodyAlloc(void);
/// Initialize a cpBody.
-cpBody *cpBodyInit(cpBody *body, cpFloat m, cpFloat i);
+cpBody* cpBodyInit(cpBody *body, cpFloat m, cpFloat i);
/// Allocate and initialize a cpBody.
-cpBody *cpBodyNew(cpFloat m, cpFloat i);
+cpBody* cpBodyNew(cpFloat m, cpFloat i);
/// Initialize a static cpBody.
-cpBody *cpBodyInitStatic(cpBody *body);
+cpBody* cpBodyInitStatic(cpBody *body);
/// Allocate and initialize a static cpBody.
-cpBody *cpBodyNewStatic();
+cpBody* cpBodyNewStatic(void);
/// Destroy a cpBody.
void cpBodyDestroy(cpBody *body);
@@ -214,6 +214,12 @@ void cpBodyApplyForce(cpBody *body, const cpVect f, const cpVect r);
/// Apply an impulse (in world coordinates) to the body at a point relative to the center of gravity (also in world coordinates).
void cpBodyApplyImpulse(cpBody *body, const cpVect j, const cpVect r);
+/// Get the velocity on a body (in world units) at a point on the body in world coordinates.
+cpVect cpBodyGetVelAtWorldPoint(cpBody *body, cpVect point);
+/// Get the velocity on a body (in world units) at a point on the body in local coordinates.
+cpVect cpBodyGetVelAtLocalPoint(cpBody *body, cpVect point);
+
+
/// Get the kinetic energy of a body.
static inline cpFloat cpBodyKineticEnergy(const cpBody *body)
{
@@ -223,17 +229,17 @@ static inline cpFloat cpBodyKineticEnergy(const cpBody *body)
return (vsq ? vsq*body->m : 0.0f) + (wsq ? wsq*body->i : 0.0f);
}
-/// Body/shape iterator callback function type.
+/// Body/shape iterator callback function type.
typedef void (*cpBodyShapeIteratorFunc)(cpBody *body, cpShape *shape, void *data);
/// Call @c func once for each shape attached to @c body and added to the space.
void cpBodyEachShape(cpBody *body, cpBodyShapeIteratorFunc func, void *data);
-/// Body/constraint iterator callback function type.
+/// Body/constraint iterator callback function type.
typedef void (*cpBodyConstraintIteratorFunc)(cpBody *body, cpConstraint *constraint, void *data);
/// Call @c func once for each constraint attached to @c body and added to the space.
void cpBodyEachConstraint(cpBody *body, cpBodyConstraintIteratorFunc func, void *data);
-/// Body/arbiter iterator callback function type.
+/// Body/arbiter iterator callback function type.
typedef void (*cpBodyArbiterIteratorFunc)(cpBody *body, cpArbiter *arbiter, void *data);
/// Call @c func once for each arbiter that is currently active on the body.
void cpBodyEachArbiter(cpBody *body, cpBodyArbiterIteratorFunc func, void *data);
View
22 external/Chipmunk/include/chipmunk/cpPolyShape.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -31,29 +31,29 @@ typedef struct cpPolyShapeAxis {
/// @private
typedef struct cpPolyShape {
cpShape shape;
-
+
int numVerts;
cpVect *verts, *tVerts;
cpPolyShapeAxis *axes, *tAxes;
} cpPolyShape;
/// Allocate a polygon shape.
-cpPolyShape *cpPolyShapeAlloc(void);
+cpPolyShape* cpPolyShapeAlloc(void);
/// Initialize a polygon shape.
/// The vertexes must be convex and have a clockwise winding.
-cpPolyShape *cpPolyShapeInit(cpPolyShape *poly, cpBody *body, int numVerts, cpVect *verts, cpVect offset);
+cpPolyShape* cpPolyShapeInit(cpPolyShape *poly, cpBody *body, int numVerts, cpVect *verts, cpVect offset);
/// Allocate and initialize a polygon shape.
/// The vertexes must be convex and have a clockwise winding.
-cpShape *cpPolyShapeNew(cpBody *body, int numVerts, cpVect *verts, cpVect offset);
+cpShape* cpPolyShapeNew(cpBody *body, int numVerts, cpVect *verts, cpVect offset);
/// Initialize a box shaped polygon shape.
-cpPolyShape *cpBoxShapeInit(cpPolyShape *poly, cpBody *body, cpFloat width, cpFloat height);
+cpPolyShape* cpBoxShapeInit(cpPolyShape *poly, cpBody *body, cpFloat width, cpFloat height);
/// Initialize an offset box shaped polygon shape.
-cpPolyShape *cpBoxShapeInit2(cpPolyShape *poly, cpBody *body, cpBB box);
+cpPolyShape* cpBoxShapeInit2(cpPolyShape *poly, cpBody *body, cpBB box);
/// Allocate and initialize a box shaped polygon shape.
-cpShape *cpBoxShapeNew(cpBody *body, cpFloat width, cpFloat height);
+cpShape* cpBoxShapeNew(cpBody *body, cpFloat width, cpFloat height);
/// Allocate and initialize an offset box shaped polygon shape.
-cpShape *cpBoxShapeNew2(cpBody *body, cpBB box);
+cpShape* cpBoxShapeNew2(cpBody *body, cpBB box);
/// Check that a set of vertexes is convex and has a clockwise winding.
cpBool cpPolyValidate(const cpVect *verts, const int numVerts);
View
38 external/Chipmunk/include/chipmunk/cpShape.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -18,7 +18,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-
+
/// @defgroup cpShape cpShape
/// The cpShape struct defines the shape of a rigid body.
/// @{
@@ -51,7 +51,7 @@ typedef void (*cpShapeSegmentQueryImpl)(cpShape *shape, cpVect a, cpVect b, cpSe
/// @private
struct cpShapeClass {
cpShapeType type;
-
+
cpShapeCacheDataImpl cacheData;
cpShapeDestroyImpl destroy;
cpShapePointQueryImpl pointQuery;
@@ -61,17 +61,17 @@ struct cpShapeClass {
/// Opaque collision shape struct.
struct cpShape {
CP_PRIVATE(const cpShapeClass *klass);
-
+
/// The rigid body this collision shape is attached to.
cpBody *body;
/// The current bounding box of the shape.
cpBB bb;
-
+
/// Sensor flag.
/// Sensor shapes call collision callbacks but don't produce collisions.
cpBool sensor;
-
+
/// Coefficient of restitution. (elasticity)
cpFloat e;
/// Coefficient of friction.
@@ -83,19 +83,19 @@ struct cpShape {
/// Generally this points to your the game object class so you can access it
/// when given a cpShape reference in a callback.
cpDataPointer data;
-
+
/// Collision type of this shape used when picking collision handlers.
cpCollisionType collision_type;
/// Group of this shape. Shapes in the same group don't collide.
cpGroup group;
// Layer bitmask for this shape. Shapes only collide if the bitwise and of their layers is non-zero.
cpLayers layers;
-
+
CP_PRIVATE(cpSpace *space);
-
+
CP_PRIVATE(cpShape *next);
CP_PRIVATE(cpShape *prev);
-
+
CP_PRIVATE(cpHashValue hashid);
};
@@ -125,7 +125,7 @@ static inline void cpShapeSet##name(cpShape *shape, type value){ \
CP_DefineShapeStructGetter(type, member, name) \
CP_DefineShapeStructSetter(type, member, name, activates)
-CP_DefineShapeStructGetter(cpBody *, body, Body);
+CP_DefineShapeStructGetter(cpBody*, body, Body);
void cpShapeSetBody(cpShape *shape, cpBody *body);
CP_DefineShapeStructGetter(cpBB, bb, BB);
@@ -166,17 +166,17 @@ static inline cpFloat cpSegmentQueryHitDist(const cpVect start, const cpVect end
/// @private
typedef struct cpCircleShape {
cpShape shape;
-
+
cpVect c, tc;
cpFloat r;
} cpCircleShape;
/// Allocate a circle shape.
-cpCircleShape *cpCircleShapeAlloc(void);
+cpCircleShape* cpCircleShapeAlloc(void);
/// Initialize a circle shape.
-cpCircleShape *cpCircleShapeInit(cpCircleShape *circle, cpBody *body, cpFloat radius, cpVect offset);
+cpCircleShape* cpCircleShapeInit(cpCircleShape *circle, cpBody *body, cpFloat radius, cpVect offset);
/// Allocate and initialize a circle shape.
-cpShape *cpCircleShapeNew(cpBody *body, cpFloat radius, cpVect offset);
+cpShape* cpCircleShapeNew(cpBody *body, cpFloat radius, cpVect offset);
CP_DeclareShapeGetter(cpCircleShape, cpVect, Offset);
CP_DeclareShapeGetter(cpCircleShape, cpFloat, Radius);
@@ -187,11 +187,11 @@ CP_DeclareShapeGetter(cpCircleShape, cpFloat, Radius);
/// @private
typedef struct cpSegmentShape {
cpShape shape;
-
+
cpVect a, b, n;
cpVect ta, tb, tn;
cpFloat r;
-
+
cpVect a_tangent, b_tangent;
} cpSegmentShape;
View
53 external/Chipmunk/include/chipmunk/cpSpace.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -23,82 +23,85 @@
/// @{
typedef struct cpContactBufferHeader cpContactBufferHeader;
+typedef void (*cpSpaceArbiterApplyImpulseFunc)(cpArbiter *arb);
/// Basic Unit of Simulation in Chipmunk
struct cpSpace {
/// Number of iterations to use in the impulse solver to solve contacts.
int iterations;
-
+
/// Gravity to pass to rigid bodies when integrating velocity.
cpVect gravity;
-
+
/// Damping rate expressed as the fraction of velocity bodies retain each second.
/// A value of 0.9 would mean that each body's velocity will drop 10% per second.
/// The default value is 1.0, meaning no damping is applied.
/// @note This damping value is different than those of cpDampedSpring and cpDampedRotarySpring.
cpFloat damping;
-
+
/// Speed threshold for a body to be considered idle.
/// The default value of 0 means to let the space guess a good threshold based on gravity.
cpFloat idleSpeedThreshold;
-
+
/// Time a group of bodies must remain idle in order to fall asleep.
/// Enabling sleeping also implicitly enables the the contact graph.
/// The default value of INFINITY disables the sleeping algorithm.
cpFloat sleepTimeThreshold;
-
- /// Amount of encouraged penetration between colliding shapes..
+
+ /// Amount of encouraged penetration between colliding shapes.
/// Used to reduce oscillating contacts and keep the collision cache warm.
/// Defaults to 0.1. If you have poor simulation quality,
/// increase this number as much as possible without allowing visible amounts of overlap.
cpFloat collisionSlop;
-
+
/// Determines how fast overlapping shapes are pushed apart.
/// Expressed as a fraction of the error remaining after each second.
/// Defaults to pow(1.0 - 0.1, 60.0) meaning that Chipmunk fixes 10% of overlap each frame at 60Hz.
cpFloat collisionBias;
-
+
/// Number of frames that contact information should persist.
/// Defaults to 3. There is probably never a reason to change this value.
cpTimestamp collisionPersistence;
-
+
/// Rebuild the contact graph during each step. Must be enabled to use the cpBodyEachArbiter() function.
/// Disabled by default for a small performance boost. Enabled implicitly when the sleeping feature is enabled.
cpBool enableContactGraph;
-
+
/// User definable data pointer.
/// Generally this points to your game's controller or game state
/// class so you can access it when given a cpSpace reference in a callback.
cpDataPointer data;
-
+
/// The designated static body for this space.
/// You can modify this body, or replace it with your own static body.
/// By default it points to a statically allocated cpBody in the cpSpace struct.
cpBody *staticBody;
-
+
CP_PRIVATE(cpTimestamp stamp);
CP_PRIVATE(cpFloat curr_dt);
CP_PRIVATE(cpArray *bodies);
CP_PRIVATE(cpArray *rousedBodies);
CP_PRIVATE(cpArray *sleepingComponents);
-
+
CP_PRIVATE(cpSpatialIndex *staticShapes);
CP_PRIVATE(cpSpatialIndex *activeShapes);
-
+
CP_PRIVATE(cpArray *arbiters);
CP_PRIVATE(cpContactBufferHeader *contactBuffersHead);
CP_PRIVATE(cpHashSet *cachedArbiters);
CP_PRIVATE(cpArray *pooledArbiters);
CP_PRIVATE(cpArray *constraints);
-
+
CP_PRIVATE(cpArray *allocatedBuffers);
CP_PRIVATE(int locked);
-
+
CP_PRIVATE(cpHashSet *collisionHandlers);
CP_PRIVATE(cpCollisionHandler defaultHandler);
CP_PRIVATE(cpHashSet *postStepCallbacks);
-
+
+ CP_PRIVATE(cpSpaceArbiterApplyImpulseFunc arbiterApplyImpulse);
+
CP_PRIVATE(cpBody _staticBody);
};
@@ -134,7 +137,7 @@ CP_DefineSpaceStructProperty(cpFloat, collisionBias, CollisionBias);
CP_DefineSpaceStructProperty(cpTimestamp, collisionPersistence, CollisionPersistence);
CP_DefineSpaceStructProperty(cpBool, enableContactGraph, EnableContactGraph);
CP_DefineSpaceStructProperty(cpDataPointer, data, UserData);
-CP_DefineSpaceStructGetter(cpBody *, staticBody, StaticBody);
+CP_DefineSpaceStructGetter(cpBody*, staticBody, StaticBody);
CP_DefineSpaceStructGetter(cpFloat, CP_PRIVATE(curr_dt), CurrentTimeStep);
/// returns true from inside a callback and objects cannot be added/removed.
@@ -174,13 +177,13 @@ void cpSpaceRemoveCollisionHandler(cpSpace *space, cpCollisionType a, cpCollisio
/// Add a collision shape to the simulation.
/// If the shape is attached to a static body, it will be added as a static shape.
-cpShape *cpSpaceAddShape(cpSpace *space, cpShape *shape);
+cpShape* cpSpaceAddShape(cpSpace *space, cpShape *shape);
/// Explicity add a shape as a static shape to the simulation.
-cpShape *cpSpaceAddStaticShape(cpSpace *space, cpShape *shape);
+cpShape* cpSpaceAddStaticShape(cpSpace *space, cpShape *shape);
/// Add a rigid body to the simulation.
-cpBody *cpSpaceAddBody(cpSpace *space, cpBody *body);
+cpBody* cpSpaceAddBody(cpSpace *space, cpBody *body);
/// Add a constraint to the simulation.
-cpConstraint *cpSpaceAddConstraint(cpSpace *space, cpConstraint *constraint);
+cpConstraint* cpSpaceAddConstraint(cpSpace *space, cpConstraint *constraint);
/// Remove a collision shape from the simulation.
void cpSpaceRemoveShape(cpSpace *space, cpShape *shape);
View
54 external/Chipmunk/include/chipmunk/cpSpatialIndex.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2010 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -21,23 +21,23 @@
/**
@defgroup cpSpatialIndex cpSpatialIndex
-
+
Spatial indexes are data structures that are used to accelerate collision detection
and spatial queries. Chipmunk provides a number of spatial index algorithms to pick from
and they are programmed in a generic way so that you can use them for holding more than
just cpShape structs.
-
+
It works by using @c void pointers to the objects you add and using a callback to ask your code
for bounding boxes when it needs them. Several types of queries can be performed an index as well
as reindexing and full collision information. All communication to the spatial indexes is performed
through callback functions.
-
+
Spatial indexes should be treated as opaque structs.
This meanns you shouldn't be reading any of the struct fields.
@{
*/
-#pragma mark Spatial Index
+//MARK: Spatial Index
/// Spatial index bounding box callback function type.
/// The spatial index calls this function and passes you a pointer to an object you added
@@ -57,23 +57,23 @@ typedef struct cpSpatialIndex cpSpatialIndex;
/// @private
struct cpSpatialIndex {
cpSpatialIndexClass *klass;
-
+
cpSpatialIndexBBFunc bbfunc;
-
+
cpSpatialIndex *staticIndex, *dynamicIndex;
};
-#pragma mark Spatial Hash
+//MARK: Spatial Hash
typedef struct cpSpaceHash cpSpaceHash;
/// Allocate a spatial hash.
-cpSpaceHash *cpSpaceHashAlloc(void);
-/// Initialize a spatial hash.
-cpSpatialIndex *cpSpaceHashInit(cpSpaceHash *hash, cpFloat celldim, int numcells, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
+cpSpaceHash* cpSpaceHashAlloc(void);
+/// Initialize a spatial hash.
+cpSpatialIndex* cpSpaceHashInit(cpSpaceHash *hash, cpFloat celldim, int numcells, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
/// Allocate and initialize a spatial hash.
-cpSpatialIndex *cpSpaceHashNew(cpFloat celldim, int cells, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
+cpSpatialIndex* cpSpaceHashNew(cpFloat celldim, int cells, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
/// Change the cell dimensions and table size of the spatial hash to tune it.
/// The cell dimensions should roughly match the average size of your objects
@@ -81,16 +81,16 @@ cpSpatialIndex *cpSpaceHashNew(cpFloat celldim, int cells, cpSpatialIndexBBFunc
/// Some trial and error is required to find the optimum numbers for efficiency.
void cpSpaceHashResize(cpSpaceHash *hash, cpFloat celldim, int numcells);
-#pragma mark AABB Tree
+//MARK: AABB Tree
typedef struct cpBBTree cpBBTree;
/// Allocate a bounding box tree.
-cpBBTree *cpBBTreeAlloc(void);
+cpBBTree* cpBBTreeAlloc(void);
/// Initialize a bounding box tree.
-cpSpatialIndex *cpBBTreeInit(cpBBTree *tree, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
+cpSpatialIndex* cpBBTreeInit(cpBBTree *tree, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
/// Allocate and initialize a bounding box tree.
-cpSpatialIndex *cpBBTreeNew(cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
+cpSpatialIndex* cpBBTreeNew(cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
/// Perform a static top down optimization of the tree.
void cpBBTreeOptimize(cpSpatialIndex *index);
@@ -101,18 +101,18 @@ typedef cpVect (*cpBBTreeVelocityFunc)(void *obj);
/// Set the velocity function for the bounding box tree to enable temporal coherence.
void cpBBTreeSetVelocityFunc(cpSpatialIndex *index, cpBBTreeVelocityFunc func);
-#pragma mark Single Axis Sweep
+//MARK: Single Axis Sweep
typedef struct cpSweep1D cpSweep1D;
/// Allocate a 1D sort and sweep broadphase.
-cpSweep1D *cpSweep1DAlloc(void);
+cpSweep1D* cpSweep1DAlloc(void);
/// Initialize a 1D sort and sweep broadphase.
-cpSpatialIndex *cpSweep1DInit(cpSweep1D *sweep, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
+cpSpatialIndex* cpSweep1DInit(cpSweep1D *sweep, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
/// Allocate and initialize a 1D sort and sweep broadphase.
-cpSpatialIndex *cpSweep1DNew(cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
+cpSpatialIndex* cpSweep1DNew(cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex);
-#pragma mark Spatial Index Implementation
+//MARK: Spatial Index Implementation
typedef void (*cpSpatialIndexDestroyImpl)(cpSpatialIndex *index);
@@ -133,18 +133,18 @@ typedef void (*cpSpatialIndexQueryImpl)(cpSpatialIndex *index, void *obj, cpBB b
struct cpSpatialIndexClass {
cpSpatialIndexDestroyImpl destroy;
-
+
cpSpatialIndexCountImpl count;
cpSpatialIndexEachImpl each;
-
+
cpSpatialIndexContainsImpl contains;
cpSpatialIndexInsertImpl insert;
cpSpatialIndexRemoveImpl remove;
-
+
cpSpatialIndexReindexImpl reindex;
cpSpatialIndexReindexObjectImpl reindexObject;
cpSpatialIndexReindexQueryImpl reindexQuery;
-
+
cpSpatialIndexPointQueryImpl pointQuery;
cpSpatialIndexSegmentQueryImpl segmentQuery;
cpSpatialIndexQueryImpl query;
View
8 external/Chipmunk/include/chipmunk/cpVect.h
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -51,7 +51,7 @@ cpFloat cpvtoangle(const cpVect v);
/// Returns a string representation of v. Intended mostly for debugging purposes and not production use.
/// @attention The string points to a static local and is reset every time the function is called.
/// If you want to print more than one vector you will have to split up your printing onto separate lines.
-char *cpvstr(const cpVect v);
+char* cpvstr(const cpVect v);
/// Check if two vectors are equal. (Be careful when comparing floating point numbers!)
static inline cpBool cpveql(const cpVect v1, const cpVect v2)
View
2  external/Chipmunk/src/CMakeLists.txt
@@ -9,7 +9,7 @@ if(BUILD_SHARED)
${chipmunk_source_files}
)
# set the lib's version number
- set_target_properties(chipmunk PROPERTIES VERSION 6.0.1)
+ set_target_properties(chipmunk PROPERTIES VERSION 6.0.3)
install(TARGETS chipmunk RUNTIME DESTINATION lib LIBRARY DESTINATION lib)
endif(BUILD_SHARED)
View
36 external/Chipmunk/src/chipmunk.c
@@ -1,15 +1,15 @@
/* Copyright (c) 2007 Scott Lembcke
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -18,7 +18,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-
+
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
@@ -38,16 +38,16 @@ void
cpMessage(const char *condition, const char *file, int line, cpBool isError, cpBool isHardError, const char *message, ...)
{
fprintf(stderr, (isError ? "Aborting due to Chipmunk error: " : "Chipmunk warning: "));
-
+
va_list vargs;
va_start(vargs, message); {
vfprintf(stderr, message, vargs);
fprintf(stderr, "\n");
} va_end(vargs);
-
+
fprintf(stderr, "\tFailed condition: %s\n", condition);
fprintf(stderr, "\tSource:%s:%d\n", file, line);
-
+
if(isHardError) abort();
}
@@ -63,7 +63,7 @@ cpInitChipmunk(void)
// printf("Initializing Chipmunk v%s (Debug Enabled)\n", cpVersionString);
// printf("Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks\n");
//#endif
-//
+//
// cpInitCollisionFuncs();
}
@@ -84,7 +84,7 @@ cpMomentForSegment(cpFloat m, cpVect a, cpVect b)
{
cpFloat length = cpvlength(cpvsub(b, a));
cpVect offset = cpvmult(cpvadd(a, b), 1.0f/2.0f);
-
+
return m*(length*length/12.0f + cpvlengthsq(offset));
}
@@ -102,14 +102,14 @@ cpMomentForPoly(cpFloat m, const int numVerts, const cpVect *verts, cpVect offse
for(int i=0; i<numVerts; i++){
cpVect v1 = cpvadd(verts[i], offset);
cpVect v2 = cpvadd(verts[(i+1)%numVerts], offset);