// Runs several tests if enabled static void consoleRunTests(void) { // Only for development // List all registered codes if it is enabled in conditional compilation #ifdef TEST_REGISTER registerList(); #endif // TEST_REGISTER // Only for development // Test analog elements if it is enabled in conditional compilation #ifdef TEST_ANALOG analogTest(); #endif //TEST_ANALOG // Only for development // Test Gyroscope if it is enabled in conditional compilation #ifdef TEST_GYRO gyrTest(); #endif // TEST_GYRO // Only for development // Test Accelerometer if it is enabled in conditional compilation #ifdef TEST_ACCEL accelTest(); #endif // TEST_ACCEL // Only for development // Test Accelerometer if it is enabled in conditional compilation #ifdef TEST_MAGNET magnetTest(); #endif // TEST_MAGNET }
void dgWorldDynamicUpdate::CalculateNetAcceleration(dgBody* const body, const dgVector& invTimeStep, const dgVector& maxAccNorm2) const { dgAssert(body->IsRTTIType(dgBody::m_dynamicBodyRTTI) || body->IsRTTIType(dgBody::m_kinematicBodyRTTI)); // the initial velocity and angular velocity were stored in m_accel and body->m_alpha for memory saving dgVector accel (invTimeStep * (body->m_veloc - body->m_accel)); dgVector alpha (invTimeStep * (body->m_omega - body->m_alpha)); dgVector accelTest((accel.DotProduct4(accel) > maxAccNorm2) | (alpha.DotProduct4(alpha) > maxAccNorm2)); accel = accel & accelTest; alpha = alpha & accelTest; body->m_accel = accel; body->m_alpha = alpha; body->SetNetAccel(accel); body->SetNetAlpha(alpha); }