|
World of Rigid Bodies (WoRB)
|
00001 /** 00002 * @file WoRB.cpp 00003 * @brief Implementation of miscellaneous methods for some of WoRB classes. 00004 * @author Mikica Kocic 00005 * @version 0.1 00006 * @date 2012-05-03 00007 * @copyright GNU Public License. 00008 */ 00009 00010 #include "WoRB.h" 00011 00012 #include <cmath> // we use atan 00013 #include <limits> // we use std::numeric_limits 00014 00015 using namespace WoRB; 00016 00017 ///////////////////////////////////////////////////////////////////////////////////////// 00018 00019 void Quaternion::Dump ( const char* name ) const 00020 { 00021 Printf( "%10s : %12.4lf %12.4lf %12.4lf | %12.4lf\n", name, x, y, z, w ); 00022 } 00023 00024 void Collision::Dump( unsigned id, double currentTime ) const 00025 { 00026 Printf( "\nCollision %d: (COR = %g, mu = %g)\n", id, 00027 Restitution, Friction ); 00028 00029 Printf( "%10s : %12.4lf\n", "t", currentTime ); 00030 00031 Position.Dump( "X" ); 00032 Normal.Dump( "N" ); 00033 00034 Printf( "%10s : %12.4lf\n", "Pen", Penetration ); 00035 00036 Velocity.Dump( "V" ); 00037 RelativePosition[0].Dump( "X rel A" ); 00038 RelativePosition[1].Dump( "X rel B" ); 00039 00040 Printf( "%10s : %12.4lf\n", "B-Vel", BouncingVelocity ); 00041 } 00042 00043 void CollisionResolver::Dump( double currentTime ) const 00044 { 00045 for ( unsigned i = 0; i < CollisionCount; ++i ) 00046 { 00047 Collisions[i].Dump( i, currentTime ); 00048 } 00049 } 00050 00051