本文整理汇总了Java中javax.vecmath.Quat4d.conjugate方法的典型用法代码示例。如果您正苦于以下问题:Java Quat4d.conjugate方法的具体用法?Java Quat4d.conjugate怎么用?Java Quat4d.conjugate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.vecmath.Quat4d
的用法示例。
在下文中一共展示了Quat4d.conjugate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _rotate
import javax.vecmath.Quat4d; //导入方法依赖的package包/类
private Vector3d _rotate(Vector3d omega, Vector3d v) {
double angle = omega.length() / this.w.fps / 2.0;
double sin = Math.sin(angle);
double cos = Math.cos(angle);
// Convert the rotation vector into a rotation quaternion
Quat4d q1 = new Quat4d(
omega.x * sin,
omega.y * sin,
omega.z * sin,
cos
);
q1.normalize();
// Get the quaternion's conjugate
Quat4d q2 = new Quat4d(q1);
q2.conjugate();
// Perform the rotation
Quat4d rotated = new Quat4d();
Quat4d qv = new Quat4d(v.x, v.y, v.z, 0);
rotated.mul(q1, qv);
rotated.mul(q2);
// Get the X, Y and Z from the resulting rotated quaternion, and
// resize the vector to its original length
Vector3d ret = new Vector3d(rotated.x, rotated.y, rotated.z);
ret.scale(v.length());
return ret;
}
示例2: _rotate
import javax.vecmath.Quat4d; //导入方法依赖的package包/类
private Vector3d _rotate(Vector3d omega, Vector3d v) {
double angle = omega.length() / this.w.fps / 2.0;
double sin = Math.sin(angle);
double cos = Math.cos(angle);
// Convert the rotation vector into a rotation quaternion
Quat4d q1 = new Quat4d(
omega.x * sin,
omega.y * sin,
omega.z * sin,
cos
);
q1.normalize();
// Get the quaternion's conjugate
Quat4d q2 = new Quat4d(q1);
q2.conjugate();
// Perform the rotation
Quat4d rotated = new Quat4d();
Quat4d qv = new Quat4d(v.x, v.y, v.z, 0);
rotated.mul(q1, qv);
rotated.mul(q2);
// Get the X, Y and Z from the resulting rotated quaternion, and
// resize the vector to its original length
Vector3d ret = new Vector3d(rotated.x, rotated.y, rotated.z);
ret.scale(v.length());
return ret;
}
示例3: relativeOrientation
import javax.vecmath.Quat4d; //导入方法依赖的package包/类
/**
* Calculate the relative quaternion orientation of two arrays of points.
*
* @param fixed
* point array, coordinates will not be modified
* @param moved
* point array, coordinates will not be modified
* @return a unit quaternion representing the relative orientation, to
* rotate moved to bring it to the same orientation as fixed.
*/
public static Quat4d relativeOrientation(Point3d[] fixed, Point3d[] moved) {
Matrix m = CalcPoint.formMatrix(moved, fixed); // inverse
EigenvalueDecomposition eig = m.eig();
double[][] v = eig.getV().getArray();
Quat4d q = new Quat4d(v[1][3], v[2][3], v[3][3], v[0][3]);
q.normalize();
q.conjugate();
return q;
}