Пример #1
0
/* Simple test of cpDampedRotarySpringGetStiffness().
*/
void test_cpDampedRotarySpringGetStiffness(void)
{
	cpConstraint *spring1 = cpDampedRotarySpringNew(body1, body2, 7, 13.7, 1);
	CU_ASSERT(cpDampedRotarySpringGetStiffness(spring1) == 13.7);

	cpConstraint *spring2 = cpDampedRotarySpringNew(body1, body2, -11.7, 8, 1);
	CU_ASSERT(cpDampedRotarySpringGetStiffness(spring2) == 8);

	cpConstraint *spring3 = cpDampedRotarySpringNew(body1, body2, 0, -1.21, 1);
	CU_ASSERT(cpDampedRotarySpringGetStiffness(spring3) == -1.21);

	cpConstraint *spring4 = cpDampedRotarySpringNew(body1, body2, 16.38, 0, 1);
	CU_ASSERT(cpDampedRotarySpringGetStiffness(spring4) == 0);
}
Пример #2
0
float PhysicsJointRotarySpring::getStiffness() const
{
    return PhysicsHelper::cpfloat2float(cpDampedRotarySpringGetStiffness(_cpConstraints.front()));
}