本文整理汇总了Java中com.google.vrtoolkit.cardboard.sensors.internal.OrientationEKF类的典型用法代码示例。如果您正苦于以下问题:Java OrientationEKF类的具体用法?Java OrientationEKF怎么用?Java OrientationEKF使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrientationEKF类属于com.google.vrtoolkit.cardboard.sensors.internal包,在下文中一共展示了OrientationEKF类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HeadTracker
import com.google.vrtoolkit.cardboard.sensors.internal.OrientationEKF; //导入依赖的package包/类
public HeadTracker(SensorEventProvider sensorEventProvider, Clock clock, Display display) {
this.clock = clock;
this.sensorEventProvider = sensorEventProvider;
this.tracker = new OrientationEKF();
this.display = display;
this.setGyroBiasEstimationEnabled(true);
Matrix.setIdentityM(this.neckModelTranslation, 0);
}
示例2: getLastHeadView
import com.google.vrtoolkit.cardboard.sensors.internal.OrientationEKF; //导入依赖的package包/类
public void getLastHeadView(float[] headView, int offset) {
if(offset + 16 > headView.length) {
throw new IllegalArgumentException("Not enough space to write the result");
} else {
float rotation = 0.0F;
switch(this.display.getRotation()) {
case 0:
rotation = 0.0F;
break;
case 1:
rotation = 90.0F;
break;
case 2:
rotation = 180.0F;
break;
case 3:
rotation = 270.0F;
}
if(rotation != this.displayRotation) {
this.displayRotation = rotation;
Matrix.setRotateEulerM(this.sensorToDisplay, 0, 0.0F, 0.0F, -rotation);
Matrix.setRotateEulerM(this.ekfToHeadTracker, 0, -90.0F, 0.0F, rotation);
}
OrientationEKF var4 = this.tracker;
synchronized(this.tracker) {
if(!this.tracker.isReady()) {
return;
}
double secondsSinceLastGyroEvent = (double)TimeUnit.NANOSECONDS.toSeconds(this.clock.nanoTime() - this.latestGyroEventClockTimeNs);
double secondsToPredictForward = secondsSinceLastGyroEvent + 0.057999998331069946D;
double[] mat = this.tracker.getPredictedGLMatrix(secondsToPredictForward);
for(int i = 0; i < headView.length; ++i) {
this.tmpHeadView[i] = (float)mat[i];
}
}
Matrix.multiplyMM(this.tmpHeadView2, 0, this.sensorToDisplay, 0, this.tmpHeadView, 0);
Matrix.multiplyMM(headView, offset, this.tmpHeadView2, 0, this.ekfToHeadTracker, 0);
Matrix.setIdentityM(this.neckModelTranslation, 0);
Matrix.translateM(this.neckModelTranslation, 0, 0.0F, -this.neckModelFactor * 0.075F, this.neckModelFactor * 0.08F);
Matrix.multiplyMM(this.tmpHeadView, 0, this.neckModelTranslation, 0, headView, offset);
Matrix.translateM(headView, offset, this.tmpHeadView, 0, 0.0F, this.neckModelFactor * 0.075F, 0.0F);
}
}
示例3: getLastHeadView
import com.google.vrtoolkit.cardboard.sensors.internal.OrientationEKF; //导入依赖的package包/类
public void getLastHeadView(float[] headView, int offset) {
if(offset + 16 > headView.length) {
throw new IllegalArgumentException("Not enough space to write the result");
} else {
float rotation = 0.0F;
switch(this.display.getRotation()) {
case 0:
rotation = 0.0F;
break;
case 1:
rotation = 90.0F;
break;
case 2:
rotation = 180.0F;
break;
case 3:
rotation = 270.0F;
}
if(rotation != this.displayRotation) {
this.displayRotation = rotation;
Matrix.setRotateEulerM(this.sensorToDisplay, 0, 0.0F, 0.0F, -rotation);
Matrix.setRotateEulerM(this.ekfToHeadTracker, 0, -90.0F, 0.0F, rotation);
}
OrientationEKF var4 = this.tracker;
synchronized(this.tracker) {
if(!this.tracker.isReady()) {
return;
}
double secondsSinceLastGyroEvent = (double)TimeUnit.NANOSECONDS.toSeconds(this.clock.nanoTime() - this.latestGyroEventClockTimeNs);
double secondsToPredictForward = secondsSinceLastGyroEvent + 0.057999998331069946D;
double[] mat = this.tracker.getPredictedGLMatrix(secondsToPredictForward);
int i = 0;
while(true) {
if(i >= headView.length) {
break;
}
this.tmpHeadView[i] = (float)mat[i];
++i;
}
}
Matrix.multiplyMM(this.tmpHeadView2, 0, this.sensorToDisplay, 0, this.tmpHeadView, 0);
Matrix.multiplyMM(headView, offset, this.tmpHeadView2, 0, this.ekfToHeadTracker, 0);
Matrix.setIdentityM(this.neckModelTranslation, 0);
Matrix.translateM(this.neckModelTranslation, 0, 0.0F, -this.neckModelFactor * 0.075F, this.neckModelFactor * 0.08F);
Matrix.multiplyMM(this.tmpHeadView, 0, this.neckModelTranslation, 0, headView, offset);
Matrix.translateM(headView, offset, this.tmpHeadView, 0, 0.0F, this.neckModelFactor * 0.075F, 0.0F);
}
}