Revision 167ba2d6
Added by Leszek Koltunski over 5 years ago
| src/main/java/org/distorted/magic/RubikSurfaceView.java | ||
|---|---|---|
| 187 | 187 |
mAxisX /= len; |
| 188 | 188 |
mAxisY /= len; |
| 189 | 189 |
|
| 190 |
android.util.Log.e("axis", "axis 2D: "+mAxisX+" , "+mAxisY);
|
|
| 190 |
// android.util.Log.e("axis", "axis 2D: "+mAxisX+" , "+mAxisY);
|
|
| 191 | 191 |
} |
| 192 | 192 |
|
| 193 | 193 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 200 | 200 |
|
| 201 | 201 |
float len = (float)Math.sqrt(x*x + y*y); |
| 202 | 202 |
|
| 203 |
// we have the length of 1D vector 'angle', now the direction: |
|
| 204 |
float tmp = mAxisY==0 ? -mAxisX*y : mAxisY*x; |
|
| 203 | 205 |
|
| 204 |
|
|
| 205 |
return len; |
|
| 206 |
return (tmp>0 ? 1:-1)*len; |
|
| 206 | 207 |
} |
| 207 | 208 |
|
| 208 | 209 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Movement finished!