如何限制排名中的价值取向
values[0]: azimuth, rotation around the Z axis.
values[1]: pitch, rotation around the X axis. Default (-180to180)
values[2]: roll, rotation around the Y axis. Default (-90to90)
我想将值[1]从默认值限制为(-90to90)。怎么办?
public void onSensorChanged(SensorEvent event) {
// TODO Auto-generated method stub
synchronized (this) {
switch(event.sensor.getType()){
case Sensor.TYPE_ORIENTATION: {
com.app.labylinthii.Global.setXaxis(Float.toString(event.values[0]));
com.app.labylinthii.Global.setYaxis(Float.toString(event.values[1]));
com.app.labylinthii.Global.setZaxis(Float.toString(event.values[2]));
break;
}
case Sensor.TYPE_ACCELEROMETER: {
break;
}
}
}
谢谢。