• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RotationInterpolator类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中javax.media.j3d.RotationInterpolator的典型用法代码示例。如果您正苦于以下问题:Java RotationInterpolator类的具体用法?Java RotationInterpolator怎么用?Java RotationInterpolator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

RotationInterpolator类属于javax.media.j3d包,在下文中一共展示了RotationInterpolator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: makeSpin

点赞 3

import javax.media.j3d.RotationInterpolator; //导入依赖的package包/类
private RotationInterpolator makeSpin(TransformGroup spinner) {
    //Alpha alpha = new Alpha(1, Alpha.DECREASING_ENABLE, 0, 10000, 5000, 0, 1000, 5000, 0, 1000);
    Alpha alpha = new Alpha(1, 3000);//new Alpha(-1, 10000) set speed here
    alpha.setAlphaAtOneDuration(3000);
    alpha.setIncreasingAlphaRampDuration(500);
    alpha.setMode(Alpha.INCREASING_ENABLE);

    rotator = new RotationInterpolator(alpha, spinner);
    double rot = Math.toRadians(90);
    Transform3D rotate1 = new Transform3D();
    rotate1.rotX(rot);
    rotate1.setTranslation(new Vector3f(0.3f, 0.3f, 0.0f));
    rotator.setTransformAxis(rotate1);
    rotator.setSchedulingBounds(bounds);
    return rotator;
}
 

开发者ID:NeuroBox3D,
项目名称:NeuGen,
代码行数:17,
代码来源:NeuGenVisualization.java

示例2: createSceneGraph

点赞 3

import javax.media.j3d.RotationInterpolator; //导入依赖的package包/类
/**
 * Creates a scene graph for the 3D model, translates the model on the
 * y-axis by {@code MODEL_Y_POSITION} and sets the rotation.
 * 
 * @return a BranchGroup for the 3D model.
 */
private BranchGroup createSceneGraph() {
	BranchGroup objRoot = new BranchGroup();
	TransformGroup objTrans = new TransformGroup();
	objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	objRoot.addChild(objTrans);
	// Move the shape down on the y-axis
	TransformGroup moveDownGroup = new TransformGroup();
	Transform3D moveDownTrans = new Transform3D();
	moveDownTrans.setTranslation(new Vector3f(0, MODEL_Y_POSITION, 0));
	moveDownGroup.setTransform(moveDownTrans);
	objTrans.addChild(moveDownGroup);
	moveDownGroup.addChild(this.shape3d);
	// Rotate the shape
	Transform3D yAxis = new Transform3D();
	Alpha rotationAlpha = new Alpha(-1, ROTATION_ALPHA_DURATION);
	RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0, (float) Math.PI * 2.0f);
	BoundingSphere bounds = new BoundingSphere(new Point3d(0, 0, 0), ROTATOR_SPHERE_RADIUS);
	rotator.setSchedulingBounds(bounds);
	objRoot.addChild(rotator);
	objRoot.compile();
	return objRoot;
}
 

开发者ID:nerdouille,
项目名称:silvie,
代码行数:29,
代码来源:ModelPreviewer.java

示例3: createSceneGraph

点赞 2

import javax.media.j3d.RotationInterpolator; //导入依赖的package包/类
/**
 * �V�[�����\�z����
 * @return BG
 */
public BranchGroup createSceneGraph() {
    BranchGroup bg = new BranchGroup();

    // ��]�pTG
    TransformGroup spinTG = new TransformGroup();
    spinTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    // ��]�^��
    Alpha rotationAlpha = new Alpha(-1, 4000);
    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha,
            spinTG);

    // �͈͂��w��
    BoundingSphere bounds = new BoundingSphere();
    rotator.setSchedulingBounds(bounds);

    spinTG.addChild(rotator);

    // �g���C�t�H�[�X
    Triforce triforce = new Triforce();
    spinTG.addChild(triforce.getBG()); // spinTG�ɒlj��I

    bg.addChild(spinTG);

    return bg;
}
 

开发者ID:aidiary,
项目名称:javagame,
代码行数:31,
代码来源:Main3D.java

示例4: createSceneGraph

点赞 2

import javax.media.j3d.RotationInterpolator; //导入依赖的package包/类
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;
}
 

开发者ID:aidiary,
项目名称:javagame,
代码行数:34,
代码来源:RotatingCube.java

示例5: createPlanete

点赞 2

import javax.media.j3d.RotationInterpolator; //导入依赖的package包/类
/**
 * Create a group componsed of a sphere and different transform group + a hostname label
 * @param root where adding the "sphere group" in 3D scene
 * @param i body to represent
 * @param a appearance of the sphere which represent the body
 */
private void createPlanete(BranchGroup root, int i, Appearance a) {
    // Creation of the Root Animation Node of the planet
    TransformGroup planeteAnimationGroup = new TransformGroup();
    planeteAnimationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    translationsGroup[i] = planeteAnimationGroup;

    // Allow to Translate the Node of the planet
    Transform3D translationPlanete = new Transform3D();
    translations[i] = translationPlanete;

    // Creating floating hostname label near the planet
    BranchGroup lGroup = new BranchGroup();
    lGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    lGroup.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
    lGroup.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
    labels[i] = lGroup;

    // Rotation of the planet on itself
    TransformGroup planeteRotationGroup = new TransformGroup();
    planeteRotationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    Alpha planeteRotationAlpha = new Alpha(-1, 4000);
    RotationInterpolator rotator = new RotationInterpolator(planeteRotationAlpha, planeteRotationGroup);
    rotator.setSchedulingBounds(new BoundingSphere(new Point3d(0, 0, 0), 999999999));
    planetesScalingGroup[i] = planeteRotationGroup;

    // Allow to change the Scale of the sphere representing the planet
    Transform3D planeteScaling = new Transform3D();
    planeteRotationGroup.setTransform(planeteScaling);
    planetesScaling[i] = planeteScaling;

    // Creation of the sphere representing the planete
    Sphere planete = new Sphere(0.01f, Sphere.GENERATE_NORMALS, 80, a);

    // Assembling java3D nodes
    planeteRotationGroup.addChild(planete);
    planeteAnimationGroup.addChild(lGroup);
    planeteAnimationGroup.addChild(planeteRotationGroup);
    root.addChild(planeteAnimationGroup);
}
 

开发者ID:mnip91,
项目名称:proactive-component-monitoring,
代码行数:46,
代码来源:NBody3DFrame.java

示例6: getRotation

点赞 2

import javax.media.j3d.RotationInterpolator; //导入依赖的package包/类
private TransformGroup getRotation() {

        /*
         * Create a TransformGroup to rotate the objects in the scene
         * and set the capability bits on the TransformGroup so that
         * it can be modified at runtime by the rotation behavior.
         */
        TransformGroup objTrans = new TransformGroup();
        objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

        //Create a spherical bounding volume that will define the volume
        //within which the rotation behavior is active.
        BoundingSphere bounds = new BoundingSphere(
                new Point3d(0.0, 0.0, 0.0), 100.0);

        //Create a 4 × 4 transformation matrix
        Transform3D yAxis = new Transform3D();
        double rot = Math.toRadians(90);
        yAxis.rotZ(rot);

        /*
         * Create an Alpha interpolator to automatically generate
         * modifications to the rotation component of the transformation
         * matrix. This Alpha loops indefinitely and generates numbers
         * from 0 to 1 every 4000 milliseconds.
         */
        /*
         Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE,
         0, 0,
         32000, 0, 0,
         0, 0, 0);
         *
         */

        Alpha rotationAlpha = new Alpha(-1, 0);
        /*
         * Create a RotationInterpolator behavior to effect the
         * TransformGroup. Here we will rotate from 0 to 2p degrees about
         * the Y-axis based on the output of rotationAlpha.
         */
        rotator = new RotationInterpolator(rotationAlpha,
                objTrans, yAxis, 0.0f,
                (float) Math.PI * 2.0f);

        //Set the scheduling bounds on the behavior. This defines the
        //volume within which this behavior will be active.
        rotator.setSchedulingBounds(bounds);

        //Add the behavior to the scenegraph so that Java 3D
        //can schedule it for activation.
        objTrans.addChild(rotator);
        return objTrans;
    }
 

开发者ID:NeuroBox3D,
项目名称:NeuGen,
代码行数:55,
代码来源:VRLDensityVisualization.java

示例7: getRotation

点赞 2

import javax.media.j3d.RotationInterpolator; //导入依赖的package包/类
private TransformGroup getRotation() {

        /*
         * Create a TransformGroup to rotate the objects in the scene
         * and set the capability bits on the TransformGroup so that
         * it can be modified at runtime by the rotation behavior.
         */
        TransformGroup objTrans = new TransformGroup();
        objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

        //Create a spherical bounding volume that will define the volume
        //within which the rotation behavior is active.
        BoundingSphere bounds = new BoundingSphere(
                new Point3d(0.0, 0.0, 0.0), 100.0);

        //Create a 4 × 4 transformation matrix
        Transform3D yAxis = new Transform3D();
        double rot = Math.toRadians(90);
        yAxis.rotZ(rot);

        /*
         * Create an Alpha interpolator to automatically generate
         * modifications to the rotation component of the transformation
         * matrix. This Alpha loops indefinitely and generates numbers
         * from 0 to 1 every 4000 milliseconds.
         */
        /*
        Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE,
        0, 0,
        32000, 0, 0,
        0, 0, 0);
         *
         */

        Alpha rotationAlpha = new Alpha(-1, 0);
        /*
         * Create a RotationInterpolator behavior to effect the
         * TransformGroup. Here we will rotate from 0 to 2p degrees about
         * the Y-axis based on the output of rotationAlpha.
         */
        rotator = new RotationInterpolator(rotationAlpha,
                objTrans, yAxis, 0.0f,
                (float) Math.PI * 2.0f);

        //Set the scheduling bounds on the behavior. This defines the
        //volume within which this behavior will be active.
        rotator.setSchedulingBounds(bounds);

        //Add the behavior to the scenegraph so that Java 3D
        //can schedule it for activation.
        objTrans.addChild(rotator);
        return objTrans;
    }
 

开发者ID:NeuroBox3D,
项目名称:NeuGen,
代码行数:55,
代码来源:NeuGenDensityVisualization.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)