@Override public void getOrientationMeasurement(Matrix3f orientationToPack) { orientationToPack.set(orientationMeasurement); }
public void getMatrix3f(Matrix3f matrixToPack) { matrixToPack.set(quaternion); }
/** * Utility method to rotate a given mesh using a given rotation matrix. * @param input the mesh to rotate. Not modified. * @param axisAngle the axis-angle describing the rotation to apply to the mesh. Not Modified. * @return the rotated mesh. */ public static MeshDataHolder rotate(MeshDataHolder input, AxisAngle4d axisAngle) { Matrix3f matrix = new Matrix3f(); matrix.set(axisAngle); return rotate(input, matrix); }
/** * Utility method to rotate a given mesh using a given rotation matrix. * @param input the mesh to rotate. Not modified. * @param quaternion the quaternion describing the rotation to apply to the mesh. Not Modified. * @return the rotated mesh. */ public static MeshDataHolder rotate(MeshDataHolder input, Quat4f quaternion) { Matrix3f matrix = new Matrix3f(); matrix.set(quaternion); return rotate(input, matrix); }
private static Vector3d rotate(Vector3d vector, Vector3d axis, double angle) { Matrix3f rotate = new Matrix3f(); rotate.set(new AxisAngle4f(new Vector3f(axis), (float) Math.toRadians(angle))); Vector3f result = new Vector3f(); Vector3f vector3f = new Vector3f(vector); rotate.transform(vector3f, result); return new Vector3d(result); }
private static Vector3d rotate(Vector3d vector, Vector3d axis, double angle) { Matrix3f rotate = new Matrix3f(); rotate.set(new AxisAngle4f(new Vector3f(axis), (float) Math.toRadians(angle))); Vector3f result = new Vector3f(); Vector3f vector3f = new Vector3f(vector); rotate.transform(vector3f, result); return new Vector3d(result); }
private static Multimap<Orientation, XYZRotation> calculateXyzRotations(Map<Matrix3f, Orientation> fromMatrix) { final Multimap<Orientation, XYZRotation> toXYZRotation = HashMultimap.create(); for (Rotation x : Rotation.values()) for (Rotation y : Rotation.values()) for (Rotation z : Rotation.values()) { final XYZRotation rotation = new XYZRotation(x, y, z); Quat4f q = new Quat4f(0, 0, 0, 1); Quat4f tmp = new Quat4f(); tmp.set(new AxisAngle4f(0, 0, 1, z.angle)); q.mul(tmp); tmp.set(new AxisAngle4f(0, 1, 0, y.angle)); q.mul(tmp); tmp.set(new AxisAngle4f(1, 0, 0, x.angle)); q.mul(tmp); Matrix3f m = new Matrix3f(); m.set(q); roundMatrixElements(m); final Orientation orientation = fromMatrix.get(m); Preconditions.checkNotNull(orientation, rotation); toXYZRotation.put(orientation, rotation); } return toXYZRotation; }