00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00024
00025 typedef struct cpDampedSpring cpDampedSpring;
00026
00027 typedef cpFloat (*cpDampedSpringForceFunc)(cpConstraint *spring, cpFloat dist);
00028
00029 const cpConstraintClass *cpDampedSpringGetClass(void);
00030
00032 struct cpDampedSpring {
00033 cpConstraint constraint;
00034 cpVect anchr1, anchr2;
00035 cpFloat restLength;
00036 cpFloat stiffness;
00037 cpFloat damping;
00038 cpDampedSpringForceFunc springForceFunc;
00039
00040 cpFloat target_vrn;
00041 cpFloat v_coef;
00042
00043 cpVect r1, r2;
00044 cpFloat nMass;
00045 cpVect n;
00046 };
00047
00049 cpDampedSpring* cpDampedSpringAlloc(void);
00051 cpDampedSpring* cpDampedSpringInit(cpDampedSpring *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping);
00053 cpConstraint* cpDampedSpringNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2, cpFloat restLength, cpFloat stiffness, cpFloat damping);
00054
00055 CP_DefineConstraintProperty(cpDampedSpring, cpVect, anchr1, Anchr1);
00056 CP_DefineConstraintProperty(cpDampedSpring, cpVect, anchr2, Anchr2);
00057 CP_DefineConstraintProperty(cpDampedSpring, cpFloat, restLength, RestLength);
00058 CP_DefineConstraintProperty(cpDampedSpring, cpFloat, stiffness, Stiffness);
00059 CP_DefineConstraintProperty(cpDampedSpring, cpFloat, damping, Damping);
00060 CP_DefineConstraintProperty(cpDampedSpring, cpDampedSpringForceFunc, springForceFunc, SpringForceFunc);
00061