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


Java Matrix4.multiply方法代码示例

本文整理汇总了Java中org.rajawali3d.math.Matrix4.multiply方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4.multiply方法的具体用法?Java Matrix4.multiply怎么用?Java Matrix4.multiply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.rajawali3d.math.Matrix4的用法示例。


在下文中一共展示了Matrix4.multiply方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getViewMatrix

import org.rajawali3d.math.Matrix4; //导入方法依赖的package包/类
@Override
public Matrix4 getViewMatrix() {
    Matrix4 m = super.getViewMatrix();

    if(mTarget != null) {
        mScratchMatrix.identity();
        mScratchMatrix.translate(mTarget.getPosition());
        m.multiply(mScratchMatrix);
    }

    mScratchMatrix.identity();
    mScratchMatrix.rotate(mEmpty.getOrientation());
    m.multiply(mScratchMatrix);

    if(mTarget != null) {
        mScratchVector.setAll(mTarget.getPosition());
        mScratchVector.inverse();

        mScratchMatrix.identity();
        mScratchMatrix.translate(mScratchVector);
        m.multiply(mScratchMatrix);
    }

    return m;
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:26,代码来源:ArcballCamera.java

示例2: getPointInEngineFrame

import org.rajawali3d.math.Matrix4; //导入方法依赖的package包/类
/**
 * Converts a point, represented as a Vector3 from it's initial refrence frame to 
 * the OpenGl world refrence frame. This allows various points to be depicted in
 * the OpenGl rendering.
 */
public static Vector3 getPointInEngineFrame(
        Vector3 inPoint,
        TangoPoseData deviceTPointFramePose,
        TangoPoseData startServiceTDevicePose) {
    Matrix4 startServiceTDeviceMatrix = tangoPoseToMatrix(startServiceTDevicePose);
    Matrix4 deviceTPointFrameMatrix = tangoPoseToMatrix(deviceTPointFramePose);
    Matrix4 startServiceTDepthMatrix 
            = startServiceTDeviceMatrix.multiply(deviceTPointFrameMatrix);

    // Convert the depth point to a Matrix. 
    Matrix4 inPointMatrix = new Matrix4();
    inPointMatrix.setToTranslation(inPoint);

    // Transform Point from depth frame to start of service frame to OpenGl world frame.
    Matrix4 startServicePointMatrix = startServiceTDepthMatrix.multiply(inPointMatrix);
    Matrix4 openGlWorldPointMatrix 
            = OPENGL_T_TANGO_WORLD.clone().multiply(startServicePointMatrix);
    return matrixToPose(openGlWorldPointMatrix).getPosition();
}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:25,代码来源:ScenePoseCalculator.java

示例3: unProject

import org.rajawali3d.math.Matrix4; //导入方法依赖的package包/类
public Vector3 unProject(double x, double y, double z) {
    x = mDefaultViewportWidth - x;
    y = mDefaultViewportHeight - y;

    final double[] in = new double[4], out = new double[4];

    Matrix4 projectionMatrix = getCurrentCamera().getProjectionMatrix().clone();
    Matrix4 MVPMatrix = projectionMatrix.multiply(getCurrentCamera().getViewMatrix());
    MVPMatrix.inverse();

    in[0] = (x / mDefaultViewportWidth) * 2 - 1;
    in[1] = (y / mDefaultViewportHeight) * 2 - 1;
    in[2] = 2 * z - 1;
    in[3] = 1;

    Matrix.multiplyMV(out, 0, MVPMatrix.getDoubleValues(), 0, in, 0);

    if (out[3] == 0)
        return null;

    out[3] = 1 / out[3];
    return new Vector3(out[0] * out[3], out[1] * out[3], out[2] * out[3]);
}
 
开发者ID:godstale,项目名称:VR-Defense-Game,代码行数:24,代码来源:Renderer.java

示例4: toOpenGLPoseWithScreenRotation

import org.rajawali3d.math.Matrix4; //导入方法依赖的package包/类
/**
 * Given a pose in start of service or area description frame and a screen rotaion calculate
 * the corresponding position and orientation for a 3D object in the Rajawali world.
 *
 * @param tangoPose     The input Tango Pose in start service or area description frame.
 * @param rotationIndex The screen rotation index, the index is following Android rotation enum.
 *                      see Android documentation for detail:
 *                      http://developer.android.com/reference/android/view/Surface.html#ROTATION_0 // NO_LINT
 */
public static Pose toOpenGLPoseWithScreenRotation(TangoPoseData tangoPose, int rotationIndex) {
    Matrix4 startServiceTDevice = tangoPoseToMatrix(tangoPose);

    // Get device pose in OpenGL world frame.
    Matrix4 openglWorldTDevice = OPENGL_T_TANGO_WORLD.clone().multiply(startServiceTDevice);

    switch (rotationIndex) {
        case 0:
            openglWorldTDevice.multiply(ROTATION_0_T_DEFAULT);
            break;
        case 1:
            openglWorldTDevice.multiply(ROTATION_90_T_DEFAULT);
            break;
        case 2:
            openglWorldTDevice.multiply(ROTATION_180_T_DEFAULT);
            break;
        case 3:
            openglWorldTDevice.multiply(ROTATION_270_T_DEFAULT);
            break;
        default:
            openglWorldTDevice.multiply(ROTATION_0_T_DEFAULT);
            break;
    }

    return matrixToPose(openglWorldTDevice);
}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:36,代码来源:ScenePoseCalculator.java

示例5: toDepthCameraOpenGlPose

import org.rajawali3d.math.Matrix4; //导入方法依赖的package包/类
/**
 * Given the device pose in start of service frame, calculate the position and orientation of
 * the depth sensor in OpenGL coordinate frame.
 */
public static Pose toDepthCameraOpenGlPose(TangoPoseData devicePose,
                                           DeviceExtrinsics extrinsics) {
    Matrix4 startServiceTdevice = tangoPoseToMatrix(devicePose);

    // Get device pose in OpenGL world frame.
    Matrix4 openglTDevice = OPENGL_T_TANGO_WORLD.clone().multiply(startServiceTdevice);

    // Get OpenGL camera pose in OpenGL world frame.
    Matrix4 openglWorldTOpenglCamera =
            openglTDevice.multiply(extrinsics.getDeviceTDepthCamera());

    return matrixToPose(openglWorldTOpenglCamera);
}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:18,代码来源:ScenePoseCalculator.java

示例6: DeviceExtrinsics

import org.rajawali3d.math.Matrix4; //导入方法依赖的package包/类
public DeviceExtrinsics(TangoPoseData imuTDevicePose, TangoPoseData imuTColorCameraPose,
                        TangoPoseData imuTDepthCameraPose) {
    Matrix4 deviceTImu = ScenePoseCalculator.tangoPoseToMatrix(imuTDevicePose).inverse();
    Matrix4 imuTColorCamera = ScenePoseCalculator.tangoPoseToMatrix(imuTColorCameraPose);
    Matrix4 imuTDepthCamera = ScenePoseCalculator.tangoPoseToMatrix(imuTDepthCameraPose);
    mDeviceTDepthCamera = deviceTImu.clone().multiply(imuTDepthCamera);
    mDeviceTColorCamera = deviceTImu.multiply(imuTColorCamera);
}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:9,代码来源:DeviceExtrinsics.java


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