/** * write the content of the wheelWorldRotation into the store * * @param store */ public void getWheelWorldRotation(final Quaternion store) { store.set(this.wheelWorldRotation); }
@Override public Quaternion getOrientation(int index) { tempq.set((float)-handState[index].rotation.data[1], (float)handState[index].rotation.data[2], (float)-handState[index].rotation.data[3], (float)handState[index].rotation.data[0]); return tempq; }
/** * Sets the rotation of the bone in object space. * Warning: you need to call {@link #setUserControl(boolean)} with true to be able to do that operation * @param rot */ public void setLocalRotation(Quaternion rot){ if (!userControl) { throw new IllegalStateException("User control must be on bone to allow user transforms"); } this.localRot.set(rot); }
@Override public void getPositionAndOrientation(Vector3f storePos, Quaternion storeRot) { storePos.x = (float)-hmdPose.translation.data[0]; storePos.y = (float)hmdPose.translation.data[1]; storePos.z = (float)-hmdPose.translation.data[2]; storeRot.set((float)-hmdPose.rotation.data[1], (float)hmdPose.rotation.data[2], (float)-hmdPose.rotation.data[3], (float)hmdPose.rotation.data[0]); if( storeRot.equals(Quaternion.ZERO) ) storeRot.set(Quaternion.DIRECTION_Z); }
/** * Stores this rotation value into the given Quaternion. If quat is null, a new Quaternion is created to * hold the value. The value, once stored, is returned. * @param quat The store location for this matrix's rotation. * @return The value of this matrix's rotation. */ public Quaternion getRotation(Quaternion quat) { if (quat==null) quat=new Quaternion(); quat.set(rot); return quat; }
/** * <code>setAxes</code> uses a rotational matrix to set the axes of the * camera. * * @param axes the matrix that defines the orientation of the camera. */ public void setAxes(Quaternion axes) { this.rotation.set(axes); onFrameChange(); }
@Override protected Quaternion deserialize(int i, Quaternion store) { int j = i * getTupleSize(); store.set(array[j], array[j + 1], array[j + 2], array[j + 3]); return store; } }
@Override public void getPositionAndOrientation(Vector3f storePos, Quaternion storeRot) { hmdPose.toTranslationVector(storePos); storePos.x = -storePos.x; storePos.z = -storePos.z; storeRot.set(getOrientation()); }
@Override public void getPositionAndOrientation(Vector3f storePos, Quaternion storeRot) { hmdPose.toTranslationVector(storePos); storePos.x = -storePos.x; storePos.z = -storePos.z; storeRot.set(getOrientation()); }
void set(Quaternion rot) { rotation.set(rot); float[] a = new float[3]; rotation.toAngles(a); eulerAngles.set(a[0], a[1], a[2]); }
/** * Loads the identity. Equal to translation=0,0,0 scale=1,1,1 rot=0,0,0,1. */ public void loadIdentity() { translation.set(0, 0, 0); scale.set(1, 1, 1); rot.set(0, 0, 0, 1); }
/** * Sets this matrix to be equal to the given matrix. * @param matrixQuat The matrix to be equal to. * @return this */ public Transform set(Transform matrixQuat) { this.translation.set(matrixQuat.translation); this.rot.set(matrixQuat.rot); this.scale.set(matrixQuat.scale); return this; }
/** * Sets this transform to the interpolation between the first transform and the second by delta amount. * @param t1 The beginning transform. * @param t2 The ending transform. * @param delta An amount between 0 and 1 representing how far to interpolate from t1 to t2. */ public void interpolateTransforms(Transform t1, Transform t2, float delta) { t1.rot.nlerp(t2.rot, delta); this.rot.set(t1.rot); this.translation.interpolateLocal(t1.translation,t2.translation,delta); this.scale.interpolateLocal(t1.scale,t2.scale,delta); }
@Override public Quaternion getFinalObserverRotation(int index) { OSVRViewManager vrvm = (OSVRViewManager)environment.getVRViewManager(); if( vrvm == null || isInputDeviceTracking(index) == false ) return null; Object obs = environment.getObserver(); if( obs instanceof Camera ) { tempq.set(((Camera)obs).getRotation()); } else { tempq.set(((Spatial)obs).getWorldRotation()); } return tempq.multLocal(getOrientation(index)); }
public static void convertMatrix4toQuat(Matrix4f in, Quaternion out) { // convert rotation matrix to quat out.fromRotationMatrix(in.m00, in.m01, in.m02, in.m10, in.m11, in.m12, in.m20, in.m21, in.m22); // flip the pitch out.set(-out.getX(), out.getY(), -out.getZ(), out.getW()); }
@Override public void read(JmeImporter e) throws IOException { InputCapsule capsule = e.getCapsule(this); rot.set((Quaternion)capsule.readSavable("rot", Quaternion.IDENTITY)); translation.set((Vector3f)capsule.readSavable("translation", Vector3f.ZERO)); scale.set((Vector3f)capsule.readSavable("scale", Vector3f.UNIT_XYZ)); }
/** * @return the physicsLocation */ public Quaternion getPhysicsRotation(Quaternion rot) { if (rot == null) { rot = new Quaternion(); } gObject.getWorldTransform(tempTrans); Converter.convert(tempTrans.getRotation(tempRot), physicsLocation.getRotation()); return rot.set(physicsLocation.getRotation()); }
public void fromTransformMatrix(Matrix4f mat) { TempVars vars = TempVars.get(); translation.set(mat.toTranslationVector(vars.vect1)); rot.set(mat.toRotationQuat(vars.quat1)); scale.set(mat.toScaleVector(vars.vect2)); vars.release(); }
private static Quaternion spline(Quaternion qnm1, Quaternion qn, Quaternion qnp1, Quaternion store, Quaternion tmp) { Quaternion invQn = new Quaternion(-qn.x, -qn.y, -qn.z, qn.w); log(invQn.mult(qnp1), tmp); log(invQn.mult(qnm1), store); store.addLocal(tmp).multLocal(-1f / 4f); exp(store, tmp); store.set(qn).multLocal(tmp); return store.normalizeLocal(); //return qn * (((qni * qnm1).log() + (qni * qnp1).log()) / -4).exp(); }