当前位置: 首页>>代码示例>>Java>>正文


Java OrientationEKF类代码示例

本文整理汇总了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);
}
 
开发者ID:Kjos,项目名称:HoloKilo,代码行数:9,代码来源:HeadTracker.java

示例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);
    }
}
 
开发者ID:Kjos,项目名称:HoloKilo,代码行数:49,代码来源:HeadTracker.java

示例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);
    }
}
 
开发者ID:ashqal,项目名称:MD360Player4Android,代码行数:55,代码来源:HeadTracker.java


注:本文中的com.google.vrtoolkit.cardboard.sensors.internal.OrientationEKF类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。