Dependencies:   SimpleMapSerialization serial_communication

Revision:
6:3b9c479c28d4
Parent:
5:b1573848235e
--- a/communication.cpp	Mon Apr 04 09:24:51 2016 +0000
+++ b/communication.cpp	Tue Apr 05 09:13:13 2016 +0000
@@ -8,6 +8,7 @@
 communication* communication::instance_ = NULL;
 const int communication::velocity_offset_ = 32767;
 const float communication::analog_stick_lower_limit_ = 0.2f;
+//const size_t communication::direction_div_num_ = 8;
 
 communication::communication() {}
 
@@ -33,11 +34,20 @@
         v[i] -= velocity_offset_;
         v[i] /= velocity_offset_;
     }
-    
+    /*
+    float p = 2.0f * PI / direction_div_num_;
+    float rad = atan2f(v.y(), v.x());
+    rad += p * 0.5f;
+    rad /= p;
+    rad *= p;
+    */
     if (v.length() > 1.0f) {
+        //v = v.unit();
         return v.unit();
     }
     
+    //return v.length() * vector2f(cos(rad), sin(rad));
+    
     /*
     if (v.length() < analog_stick_lower_limit_) {
         return vector2f();  // しきい値以下なら移動操作無しとみなす
@@ -45,11 +55,6 @@
     */
     
     return v;
-    
-    /*
-    vector2f velocity = v.unit();
-    return velocity;
-    */
 }
 float communication::get_angular_velocity_rad_per_sec() const {
     return 0.0f;