public void applyProjectionMatrix(ulong givenTimestamp, float screenWidth, float screenHeight) { Debug.Log("Trying to pull with timestamp " + givenTimestamp); SimpleMatrix3x3 matrix = new SimpleMatrix3x3(); if (m_matrixPull.getMatrix3x3(matrix, givenTimestamp)) { intrinsics = UbiMeasurementUtils.ubitrackToUnity(matrix); projectionMatrix = CameraUtils.constructProjectionMatrix3x3(intrinsics.data(), screenWidth, screenHeight, nearClipping, farClipping); if (Flip_X_Y) { Matrix4x4 rotMat = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, -90), Vector3.one); projectionMatrix = rotMat * projectionMatrix; } //Debug.Log(projectionMatrix); if (GetComponent <Camera>() != null) { GetComponent <Camera>().projectionMatrix = projectionMatrix; //Debug.Log("set projection matrix of camera"); } } else { throw new Exception("unable to get 3x3 matrix"); } }
public void applyProjectionMatrix() { SimpleMatrix3x3 matrix = new SimpleMatrix3x3(); if (m_matrixPull.getMatrix3x3(matrix, UbiMeasurementUtils.getUbitrackTimeStamp())) { intrinsics = UbiMeasurementUtils.ubitrackToUnity(matrix); projectionMatrix = CameraUtils.constructProjectionMatrix3x3(intrinsics.data(), standardWidth, standardHeight, nearClipping, farClipping); if (Flip_X_Y) { Matrix4x4 rotMat = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, -90), Vector3.one); projectionMatrix = rotMat * projectionMatrix; } //Debug.Log(projectionMatrix); if (GetComponent <Camera>() != null) { GetComponent <Camera>().projectionMatrix = projectionMatrix; //Debug.Log("set projection matrix of camera"); } } else { throw new Exception("unable to get 3x3 matrix"); } }
public static void ubitrack3x4MatrixToFloatArray(SimpleMatrix3x3 ubiMatrix, ref float[] matrix) { doubleArrayClass dac = doubleArrayClass.frompointer(ubiMatrix.values); for (int i = 0; i < 9; i++) { matrix[i] = (float)dac.getitem(i); } }
public override void utStart() { base.utStart(); SimpleMatrix3x3 matrix = new SimpleMatrix3x3(); if (m_matrixPull.getMatrix3x3(matrix, UbiMeasurementUtils.getUbitrackTimeStamp())) { Measurement<float[]> intrinsics = UbiMeasurementUtils.ubitrackToUnity(matrix); Matrix4x4 mProj; mProj = CameraUtils.constructProjectionMatrix3x3(intrinsics.data(), standardWidth, standardHeight, nearClipping, farClipping); GetComponent<Camera>().projectionMatrix = mProj; } else { throw new Exception("unable to get 3x3 matrix"); } }
internal static Measurement <float[]> ubitrackToUnity(SimpleMatrix3x3 newMatrix) { float[] data = new float[12]; ubitrack3x4MatrixToFloatArray(newMatrix, ref data); return(new Measurement <float[]>(data, newMatrix.timestamp)); }
internal static Measurement<float[]> ubitrackToUnity(SimpleMatrix3x3 newMatrix) { float[] data = new float[12]; ubitrack3x4MatrixToFloatArray(newMatrix, ref data); return new Measurement<float[]>(data, newMatrix.timestamp); }
public static void ubitrack3x4MatrixToFloatArray(SimpleMatrix3x3 ubiMatrix, ref float[] matrix) { doubleArrayClass dac = doubleArrayClass.frompointer(ubiMatrix.values); for (int i = 0; i < 9; i++) { matrix[i] = (float)dac.getitem(i); } }