| 101 | } |
| 102 | |
| 103 | void Sensors::draw() |
| 104 | { |
| 105 | auto rotation = MotionManager::getRotation( getOrientation() ); |
| 106 | |
| 107 | vec3 g = MotionManager::getGravity(); |
| 108 | float thetaRad = atan2( g.z, g.x );// - 3.141592f/2.0f; |
| 109 | float theta = thetaRad/3.141592f*180.0f; |
| 110 | |
| 111 | if( mPrint ) { |
| 112 | //vec3 ng = normalize( g ); |
| 113 | |
| 114 | //theta = dot( vec3( 0, ng.y, ng.z ), vec3( 0, 1, 0 ) ); |
| 115 | //theta = (acos(theta) - M_PI/2.0)/3.141592f*180.0f; |
| 116 | //console() << "ng=" << ng << ", theta=" << theta << std::endl; |
| 117 | |
| 118 | auto q = MotionManager::getRotation( getOrientation() ); |
| 119 | //console() << "-\n" << "quat:\n" << q << "\nmat4:" << toMat4( q ) << std::endl; |
| 120 | //console() << "AngleAxis: " << AngleAxis( q ) << std::endl; |
| 121 | |
| 122 | console() << "Euler=" << glm::eulerAngles( q ) << std::endl; |
| 123 | |
| 124 | //console() << "g=" << g << " : " << "theta=" << theta << std::endl; |
| 125 | //console() << "rv=" << MotionManager::getRotationVector() << std::endl; |
| 126 | //console() << "rotation: " << MotionManager::getRotation( getOrientation() ) << std::endl; |
| 127 | } |
| 128 | |
| 129 | gl::clear( Color( 0.0f, 0.0f, 0.0f ) ); |
| 130 | gl::enableDepthRead(); |
| 131 | gl::enableDepthWrite(); |
| 132 | |
| 133 | gl::setMatricesWindowPersp( getWindowSize(), 60.0f, 1.0f, 10000.0f ); |
| 134 | gl::pushModelMatrix(); |
| 135 | { |
| 136 | glCullFace( GL_BACK ); |
| 137 | gl::translate( getWindowSize() / 2 ); |
| 138 | #if defined( CINDER_ANDROID ) |
| 139 | gl::scale( vec3( 500.0f, 500.0f, 500.0f ) ); |
| 140 | #else |
| 141 | gl::scale( vec3( 200.0f, 200.0f, 200.0f ) ); |
| 142 | #endif |
| 143 | |
| 144 | gl::rotate( rotation ); |
| 145 | |
| 146 | //gl::rotate( -3.141592f/4.0f, 1, 1, 0 ); |
| 147 | gl::drawColorCube( vec3(0.0f), vec3(1.0f) ); |
| 148 | |
| 149 | |
| 150 | //gl::rotate( rotation ); |
| 151 | |
| 152 | gl::lineWidth( 50.0f ); |
| 153 | |
| 154 | gl::color( 1.0f, 0.0f, 0.0f ); |
| 155 | gl::drawLine( vec3( 0, 0, 0 ), vec3( 1.5f, 0, 0 ) ); |
| 156 | |
| 157 | gl::color( 0.0f, 1.0f, 0.0f ); |
| 158 | gl::drawLine( vec3( 0, 0, 0 ), vec3( 0, 1.5f, 0 ) ); |
| 159 | |
| 160 | gl::color( 0.0f, 0.0f, 1.0f ); |
nothing calls this directly
no test coverage detected