本文整理了Java中com.jme3.math.Quaternion.toRotationMatrix
方法的一些代码示例,展示了Quaternion.toRotationMatrix
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.toRotationMatrix
方法的具体详情如下:
包路径:com.jme3.math.Quaternion
类名称:Quaternion
方法名:toRotationMatrix
[英]toRotationMatrix
converts this quaternion to a rotational matrix. Note: the result is created from a normalized version of this quat.
[中]toRotationMatrix
将此四元数转换为旋转矩阵。注意:结果是根据这个quat的规范化版本创建的。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* <code>setRotationQuaternion</code> builds a rotation from a
* <code>Quaternion</code>.
*
* @param quat
* the quaternion to build the rotation from.
* @throws NullPointerException
* if quat is null.
*/
public void setRotationQuaternion(Quaternion quat) {
quat.toRotationMatrix(this);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
*
* <code>set</code> defines the values of the matrix based on a supplied
* <code>Quaternion</code>. It should be noted that all previous values
* will be overridden.
*
* @param quaternion
* the quaternion to create a rotational matrix from.
* @return this
*/
public Matrix3f set(Quaternion quaternion) {
return quaternion.toRotationMatrix(this);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* <code>toRotationMatrix</code> converts this quaternion to a rotational
* matrix. Note: the result is created from a normalized version of this quat.
*
* @return the rotation matrix representation of this quaternion.
*/
public Matrix3f toRotationMatrix() {
Matrix3f matrix = new Matrix3f();
return toRotationMatrix(matrix);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
*
* <code>toAxes</code> takes in an array of three vectors. Each vector
* corresponds to an axis of the coordinate system defined by the quaternion
* rotation.
*
* @param axis
* the array of vectors to be filled.
*/
public void toAxes(Vector3f axis[]) {
Matrix3f tempMat = toRotationMatrix();
axis[0] = tempMat.getColumn(0, axis[0]);
axis[1] = tempMat.getColumn(1, axis[1]);
axis[2] = tempMat.getColumn(2, axis[2]);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public Matrix3f getPhysicsRotationMatrix() {
gObject.getWorldTransform(tempTrans);
Converter.convert(tempTrans.getRotation(tempRot), physicsLocation.getRotation());
return physicsLocation.getRotation().toRotationMatrix();
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void setSpatial(Spatial spatial) {
this.spatial = spatial;
setUserObject(spatial);
if (spatial == null) {
return;
}
setPhysicsLocation(spatial.getWorldTranslation());
setPhysicsRotation(spatial.getWorldRotation().toRotationMatrix());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Stores the skinning transform in the specified Matrix4f.
* The skinning transform applies the animation of the bone to a vertex.
*
* This assumes that the world transforms for the entire bone hierarchy
* have already been computed, otherwise this method will return undefined
* results.
*
* @param outTransform
*/
void getOffsetTransform(Matrix4f outTransform, Quaternion tmp1, Vector3f tmp2, Vector3f tmp3, Matrix3f tmp4) {
// Computing scale
Vector3f scale = modelScale.mult(modelBindInverseScale, tmp3);
// Computing rotation
Quaternion rotate = modelRot.mult(modelBindInverseRot, tmp1);
// Computing translation
// Translation depend on rotation and scale
Vector3f translate = modelPos.add(rotate.mult(scale.mult(modelBindInversePos, tmp2), tmp2), tmp2);
// Populating the matrix
outTransform.setTransform(translate, scale, rotate.toRotationMatrix(tmp4));
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
vehicle.resetSuspension();
bridge.setPhysicsLocation(new Vector3f(0,1.4f,4));
bridge.setPhysicsRotation(Quaternion.DIRECTION_Z.toRotationMatrix());
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), trans.getScale()),
trans.getTranslation(),
trans.getRotation().toRotationMatrix());
} else if (spatial instanceof Node) {
createCompoundShape(realRootNode, (Node) spatial, shape, meshAccurate, dynamic);
shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()),
trans.getTranslation(),
trans.getRotation().toRotationMatrix());
} else if (spatial instanceof Geometry) {
Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
shape.addChildShape(childShape,
trans.getTranslation(),
trans.getRotation().toRotationMatrix());
shape.addChildShape(createSingleBoxShape(spatial, realRootNode),
trans.getTranslation(),
trans.getRotation().toRotationMatrix());
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), trans.getScale()),
trans.getTranslation(),
trans.getRotation().toRotationMatrix());
} else if (spatial instanceof Node) {
createCompoundShape(realRootNode, (Node) spatial, shape, meshAccurate, dynamic);
shape.addChildShape(new HeightfieldCollisionShape(terrain.getHeightMap(), terrain.getLocalScale()),
trans.getTranslation(),
trans.getRotation().toRotationMatrix());
} else if (spatial instanceof Geometry) {
Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
shape.addChildShape(childShape,
trans.getTranslation(),
trans.getRotation().toRotationMatrix());
shape.addChildShape(createSingleBoxShape(spatial, realRootNode),
trans.getTranslation(),
trans.getRotation().toRotationMatrix());
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Callback from Control.render(), do not use.
*
* @param rm
* @param vp
*/
private void renderFromControl(RenderManager rm, ViewPort vp) {
Camera cam = vp.getCamera();
if (meshType == ParticleMesh.Type.Point) {
float C = cam.getProjectionMatrix().m00;
C *= cam.getWidth() * 0.5f;
// send attenuation params
this.getMaterial().setFloat("Quadratic", C);
}
Matrix3f inverseRotation = Matrix3f.IDENTITY;
TempVars vars = null;
if (!worldSpace) {
vars = TempVars.get();
inverseRotation = this.getWorldRotation().toRotationMatrix(vars.tempMat3).invertLocal();
}
particleMesh.updateParticleData(particles, cam, inverseRotation);
if (!worldSpace) {
vars.release();
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void updateMatrix() {
TempVars vars = TempVars.get();
Matrix3f r = vars.tempMat3;
Matrix4f u = uniformMatrix;
transform.getRotation().toRotationMatrix(r);
u.m00 = r.get(0,0);
u.m10 = r.get(1,0);
u.m20 = r.get(2,0);
u.m01 = r.get(0,1);
u.m11 = r.get(1,1);
u.m21 = r.get(2,1);
u.m02 = r.get(0,2);
u.m12 = r.get(1,2);
u.m22 = r.get(2,2);
//scale
u.m30 = transform.getScale().x;
u.m31 = transform.getScale().y;
u.m32 = transform.getScale().z;
//position
u.m03 = transform.getTranslation().x;
u.m13 = transform.getTranslation().y;
u.m23 = transform.getTranslation().z;
vars.release();
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* <code>setRotationQuaternion</code> builds a rotation from a
* <code>Quaternion</code>.
*
* @param quat
* the quaternion to build the rotation from.
* @throws NullPointerException
* if quat is null.
*/
public void setRotationQuaternion(Quaternion quat) {
quat.toRotationMatrix(this);
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* <code>setRotationQuaternion</code> builds a rotation from a
* <code>Quaternion</code>.
*
* @param quat
* the quaternion to build the rotation from.
* @throws NullPointerException
* if quat is null.
*/
public void setRotationQuaternion(Quaternion quat) {
quat.toRotationMatrix(this);
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
*
* <code>set</code> defines the values of the matrix based on a supplied
* <code>Quaternion</code>. It should be noted that all previous values
* will be overridden.
*
* @param quaternion
* the quaternion to create a rotational matrix from.
* @return this
*/
public Matrix3f set(Quaternion quaternion) {
return quaternion.toRotationMatrix(this);
}
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* <code>toRotationMatrix</code> converts this quaternion to a rotational
* matrix. Note: the result is created from a normalized version of this quat.
*
* @return the rotation matrix representation of this quaternion.
*/
public Matrix3f toRotationMatrix() {
Matrix3f matrix = new Matrix3f();
return toRotationMatrix(matrix);
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* <code>toRotationMatrix</code> converts this quaternion to a rotational
* matrix. Note: the result is created from a normalized version of this quat.
*
* @return the rotation matrix representation of this quaternion.
*/
public Matrix3f toRotationMatrix() {
Matrix3f matrix = new Matrix3f();
return toRotationMatrix(matrix);
}
代码示例来源:origin: info.projectkyoto/mms-engine
public static Matrix4f getBoneToModelMatrix(Bone bone, Matrix4f m, Matrix3f tmp1) {
m.setTransform(bone.getModelSpacePosition(), bone.getModelSpaceScale(), bone.getModelSpaceRotation().toRotationMatrix(tmp1));
return m;
}
代码示例来源:origin: org.jmonkeyengine/jme3-jbullet
public Matrix3f getPhysicsRotationMatrix() {
gObject.getWorldTransform(tempTrans);
Converter.convert(tempTrans.getRotation(tempRot), physicsLocation.getRotation());
return physicsLocation.getRotation().toRotationMatrix();
}
代码示例来源:origin: info.projectkyoto/mms-engine
void _convPMDEuler(Matrix3f out, float x, float y, float z) {
Quaternion qx = new Quaternion();
Quaternion qy = new Quaternion();
Quaternion qz = new Quaternion();
qx.fromAngles(x, 0, 0);
qy.fromAngles(0, y, 0);
qz.fromAngles(0, 0, z);
qz.multLocal(qy);
qz.multLocal(qx);
qz.toRotationMatrix(out);
}
void convPMDEuler(Matrix3f out, float x, float y, float z) {
内容来源于网络,如有侵权,请联系作者删除!