Java Code Examples for javax.vecmath.Matrix3d#rotY()

The following examples show how to use javax.vecmath.Matrix3d#rotY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Model.java    From Robot-Overlord-App with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Rotate all the vertexes by a given amount
 * @param arg0 amount in degrees to rotate around X,Y, and then Z. 
 */
public void adjustRotation(Vector3d arg0) {
	// generate the pose matrix
	Matrix3d pose = new Matrix3d();
	Matrix3d rotX = new Matrix3d();
	Matrix3d rotY = new Matrix3d();
	Matrix3d rotZ = new Matrix3d();
	rotX.rotX((float)Math.toRadians(arg0.x));
	rotY.rotY((float)Math.toRadians(arg0.y));
	rotZ.rotZ((float)Math.toRadians(arg0.z));
	pose.set(rotX);
	pose.mul(rotY);
	pose.mul(rotZ);
	adjust.set(pose);
	isDirty=true;
}
 
Example 2
Source File: Prism.java    From biojava with GNU Lesser General Public License v2.1 6 votes vote down vote up
@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;
}
 
Example 3
Source File: Octahedron.java    From biojava with GNU Lesser General Public License v2.1 6 votes vote down vote up
@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;
}
 
Example 4
Source File: RectangularPrism.java    From biojava with GNU Lesser General Public License v2.1 6 votes vote down vote up
@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;
}
 
Example 5
Source File: CameraGimbal2D.java    From jMAVSim with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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);
        }
    }
}