FastMath reorganization
This commit is contained in:
@@ -32,6 +32,7 @@ import org.oscim.event.Event;
|
||||
import org.oscim.layers.Layer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.LocationRenderer;
|
||||
import org.oscim.utils.FastMath;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Compass extends Layer implements SensorEventListener, Map.UpdateListener,
|
||||
@@ -230,20 +231,13 @@ public class Compass extends Layer implements SensorEventListener, Map.UpdateLis
|
||||
// float rotation = (float) Math.toDegrees(mAzimuthRadians);
|
||||
|
||||
float change = rotation - mCurRotation;
|
||||
if (change > 180)
|
||||
change -= 360;
|
||||
else if (change < -180)
|
||||
change += 360;
|
||||
change = (float) FastMath.clampDegree(change);
|
||||
|
||||
// low-pass
|
||||
change *= 0.05;
|
||||
|
||||
rotation = mCurRotation + change;
|
||||
|
||||
if (rotation > 180)
|
||||
rotation -= 360;
|
||||
else if (rotation < -180)
|
||||
rotation += 360;
|
||||
rotation = (float) FastMath.clampDegree(rotation);
|
||||
|
||||
// float tilt = (float) Math.toDegrees(mRotationV[1]);
|
||||
// float tilt = (float) Math.toDegrees(mPitchAxisRadians);
|
||||
|
||||
Reference in New Issue
Block a user