Java Code Examples for javax.media.j3d.Transform3D#rotX()

The following examples show how to use javax.media.j3d.Transform3D#rotX() . 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: Java3DWindow.java    From GpsPrune with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Calculate the angles and call them back to the app
 * @param inFunction function to call for export
 */
private void callbackRender(Export3dFunction inFunction)
{
	Transform3D trans3d = new Transform3D();
	_orbit.getViewingPlatform().getViewPlatformTransform().getTransform(trans3d);
	Matrix3d matrix = new Matrix3d();
	trans3d.get(matrix);
	Point3d point = new Point3d(0.0, 0.0, 1.0);
	matrix.transform(point);
	// Set up initial rotations
	Transform3D firstTran = new Transform3D();
	firstTran.rotY(Math.toRadians(-INITIAL_Y_ROTATION));
	Transform3D secondTran = new Transform3D();
	secondTran.rotX(Math.toRadians(-INITIAL_X_ROTATION));
	// Apply inverse rotations in reverse order to the test point
	Point3d result = new Point3d();
	secondTran.transform(point, result);
	firstTran.transform(result);

	// Give the settings to the rendering function
	inFunction.setCameraCoordinates(result.x, result.y, result.z);
	inFunction.setAltitudeExaggeration(_altFactor);
	inFunction.setTerrainDefinition(_terrainDefinition);
	inFunction.setImageDefinition(_imageDefinition);

	inFunction.begin();
}
 
Example 2
Source File: RotatingCube.java    From javagame with MIT License 5 votes vote down vote up
public BranchGroup createSceneGraph() {
    BranchGroup bg = new BranchGroup();

    // �L���[�u���X����
    Transform3D rotate = new Transform3D();
    Transform3D tempRotate = new Transform3D();

    rotate.rotX(Math.PI / 4.0);
    tempRotate.rotY(Math.PI / 4.0);
    rotate.mul(tempRotate);

    TransformGroup rotateTG = new TransformGroup(rotate);

    // �L���[�u����]����
    TransformGroup spinTG = new TransformGroup();
    spinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    // �J���[�L���[�u���쐬����spinTG�ɒlj�
    ColorCube cube = new ColorCube(0.4);
    spinTG.addChild(cube);

    // ��]�^��
    Alpha rotationAlpha = new Alpha(-1, 4000);
    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, spinTG);
    // �͈͂��w��
    BoundingSphere bounds = new BoundingSphere();
    rotator.setSchedulingBounds(bounds);
    spinTG.addChild(rotator);

    rotateTG.addChild(spinTG);
    bg.addChild(rotateTG);

    return bg;
}