本文整理汇总了Java中javax.vecmath.Matrix3d.rotY方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix3d.rotY方法的具体用法?Java Matrix3d.rotY怎么用?Java Matrix3d.rotY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.vecmath.Matrix3d
的用法示例。
在下文中一共展示了Matrix3d.rotY方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addRotAroundAxis
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
public static PointD addRotAroundAxis(double x, double y, double z, double axis) {
// May be faster to rewrite with your own to reduce the number of calculations
Matrix3d rotationMatrix = new Matrix3d();
rotationMatrix.rotZ(z); // Add z rotation
Matrix3d yRot = new Matrix3d();
yRot.rotY(y);
Matrix3d xRot = new Matrix3d();
xRot.rotX(x);
Matrix3d axisRot = new Matrix3d();
axisRot.rotY(axis);
rotationMatrix.mul(yRot);
rotationMatrix.mul(xRot);
rotationMatrix.mul(axisRot);
return new PointD(Math.atan2(rotationMatrix.m21, rotationMatrix.m22),
Math.atan2(-rotationMatrix.m20,Math.sqrt(rotationMatrix.m21 * rotationMatrix.m21 + rotationMatrix.m22 * rotationMatrix.m22)),
Math.atan2(rotationMatrix.m10, rotationMatrix.m00));
}
示例2: paintSphericalVanishingPoints
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
public void paintSphericalVanishingPoints(Graphics g) {
final double EPS = 0.1;
final int R = 1;
g.setColor(Constants.Vanish_Color);
Matrix3d RZ = new Matrix3d();
Matrix3d RY = new Matrix3d();
for (double rz = 0; rz < 2 * Math.PI; rz += EPS) {
RZ.rotZ(rz);
for (double ry = -Math.PI / 2; ry < Math.PI / 2; ry += EPS) {
RY.rotY(ry);
Vector3d v = new Vector3d(1, 0, 0);
RY.transform(v);
RZ.transform(v);
Point2d vp = projection.vanishingPoint(v);
if (vp != null) {
g.fillOval((int) vp.x - R, (int) vp.y - R, 2 * R, 2 * R);
}
}
}
}
示例3: Rotation
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
/**
* Creates a new instance of Translation.
*
* @param center
* @param xAngle
* @param yAngle
* @param zAngle
*/
public Rotation(Point3d center, double xAngle, double yAngle, double zAngle) {
super();
centerOfRotation = center;
double x = Math.toRadians(xAngle);
double y = Math.toRadians(yAngle);
double z = Math.toRadians(zAngle);
Matrix3d xrot = new Matrix3d();
xrot.rotX(x);
Matrix3d yrot = new Matrix3d();
yrot.rotY(y);
Matrix3d zrot = new Matrix3d();
zrot.rotZ(z);
yrot.mul(zrot);
xrot.mul(yrot);
rotation = xrot;
toOrigin = new Translation(-centerOfRotation.x, -centerOfRotation.y,
-centerOfRotation.z);
toCenter = new Translation(centerOfRotation.x, centerOfRotation.y,
centerOfRotation.z);
}
示例4: getViewMatrix
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public Matrix3d getViewMatrix(int index) {
Matrix3d m = new Matrix3d();
switch (index) {
case 0:
m.setIdentity(); // front
break;
case 1:
m.rotX(Math.PI/2); // side edge-centered
break;
case 2:
m.rotY(Math.PI/n); // side face-centered
Matrix3d m1 = new Matrix3d();
m1.rotX(Math.PI/2);
m.mul(m1);
break;
case 3:
m.set(flipX()); // back
break;
default:
throw new IllegalArgumentException("getViewMatrix: index out of range:" + index);
}
return m;
}
示例5: getViewMatrix
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public Matrix3d getViewMatrix(int index) {
Matrix3d m = new Matrix3d();
switch (index) {
case 0:
m.setIdentity(); // C4 vertex-centered
break;
case 1:
m.rotX(-0.5 * TETRAHEDRAL_ANGLE); // C3 face-centered 2.0*Math.PI/3
Matrix3d m1 = new Matrix3d();
m1.rotZ(Math.PI/4);
m.mul(m1);
break;
case 2:
m.rotY(Math.PI/4); // side face-centered
break;
default:
throw new IllegalArgumentException("getViewMatrix: index out of range:" + index);
}
return m;
}
示例6: getViewMatrix
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public Matrix3d getViewMatrix(int index) {
Matrix3d m = new Matrix3d();
switch (index) {
case 0: m.setIdentity(); // front
break;
case 1: m.rotY(Math.PI/2); // left
break;
case 2: m.rotY(Math.PI); // back
break;
case 3: m.rotY(-Math.PI/2); // right
break;
case 4: m.rotX(Math.PI/2); // top
break;
case 5: m.rotX(-Math.PI/2); // bottom
break;
default: throw new IllegalArgumentException("getViewMatrix: index out of range:" + index);
}
return m;
}
示例7: update
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
@Override
public void update(long t) {
this.position = baseObject.position;
this.velocity = baseObject.velocity;
this.acceleration = baseObject.acceleration;
double yaw = Math.atan2(baseObject.rotation.getElement(1, 0), baseObject.rotation.getElement(0, 0));
this.rotation.rotZ(yaw);
if (pitchChannel >= 0 && baseObject instanceof AbstractVehicle) {
// Control camera pitch
List<Double> control = ((AbstractVehicle) baseObject).getControl();
if (control.size() > pitchChannel) {
Matrix3d r = new Matrix3d();
r.rotY(control.get(4) * pitchScale);
this.rotation.mul(r);
}
}
}
示例8: createRotationOy
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
public static AffineTransform3D createRotationOy(double theta) {
Matrix3d matrix3d = new Matrix3d();
matrix3d.rotY(theta);
Matrix4d matrix4d = new Matrix4d();
matrix4d.set(matrix3d);
return new AffineTransform3D(matrix4d);
}
示例9: panTilt
import javax.vecmath.Matrix3d; //导入方法依赖的package包/类
public void panTilt(double pan, double tilt) {
if (pan > -Math.PI && pan < Math.PI && tilt > -Math.PI / 2 && tilt < Math.PI / 2) {
Matrix3d ry = new Matrix3d();
ry.rotY(-pan + Math.PI / 2);
Matrix3d rx = new Matrix3d();
rx.rotX(tilt);
Matrix3d rot = new Matrix3d();
rot.rotX(-Math.PI / 2);
rot.mul(ry);
rot.mul(rx);
this.setRotation(rot);
}
}