Package com.sun.j3d.utils.geometry

Examples of com.sun.j3d.utils.geometry.Box


    Appearance fBoxApp = new Appearance();

    fBoxApp.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
                          diffuseColourFBox,specularColourFBox,shininessFBox));

    Box fBox = new Box(0.2f,0.2f,0.2f,fBoxApp);

    //The UserData are needed in order to identify the cube when it is picked.
    fBox.setUserData("box");

    TransformGroup tgmBox = new TransformGroup();
    tgmBox.addChild(fBox);

    Transform3D rotationAxis = new Transform3D();
View Full Code Here


                          diffuseColourBox,specularColourBox,shininessBox));




    Box myBox = new Box(0.2f,0.2f,0.2f,boxApp);

    //Rotate and shift the cube slightly.
    Transform3D tfBox = new Transform3D();
    tfBox.rotY(Math.PI/6);
    tfBox.rotX(Math.PI/9);
View Full Code Here

    fBoxApp.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
                          diffuseColourFBox,specularColourFBox,shininessFBox));


    //Create the box.
    Box fBox = new Box(0.2f,0.2f,0.2f,fBoxApp);

    //Add some data to the box in order to identify it, when it is picked.
    fBox.setUserData("box");



    //Create a transformgroup for the rotation of the box.
    TransformGroup tgmBox = new TransformGroup();
View Full Code Here

    //Half edge length of the cube that represents the platform.
    float platformSize = 0.1f;

    //Generate the platform in the form of a cube.
    Box platform = new Box(platformSize,platformSize,platformSize,redApp);

    //A transformation rotating the platform a little bit.
    Transform3D tfPlatform = new Transform3D();
    tfPlatform.rotY(Math.PI/6);

    //The transformation group of the platform.
    TransformGroup tgPlatform = new TransformGroup(tfPlatform);
    tgPlatform.addChild(platform);





//*** The cockpit of the helicopter. ****

    //An Appearance to make the cockpit green.
    Appearance greenApp = new Appearance();
    setToMyDefaultAppearance(greenApp,new Color3f(0.0f,0.7f,0.0f));

    //Radius of the cockpit.
    float cabinRadius = 0.1f;

    //Generate the cockpit in the form of a sphere.
    Sphere cabin = new Sphere(cabinRadius,greenApp);

    //The transformation group for the cockpit.
    //The cockpit first remains in the origin. Later on, the whole
    //helicopter is shifted onto the platform.
    TransformGroup tgCabin = new TransformGroup();
    tgCabin.addChild(cabin);


//*** The rotor blade of the helicopter. ***

    //An Appearance to make the rotor blade blue.
    Appearance blueApp = new Appearance();
    setToMyDefaultAppearance(blueApp,new Color3f(0.0f,0.0f,1.0f));

    //Generate the rotor blade in the form of a (very thin and long) box.
    Box rotor = new Box(0.4f,0.0001f,0.01f,blueApp);

    //A transformation placing the rotor blade on top of the cockpit.
    Transform3D tfRotor = new Transform3D();
    tfRotor.setTranslation(new Vector3f(0.0f,cabinRadius,0.0f));

    //The transformation group for the rotor blade.
    TransformGroup tgRotor = new TransformGroup(tfRotor);
    tgRotor.addChild(rotor);


//*** The tail of the helicopter. ***

    //Length of the tail.
    float halfTailLength = 0.2f;

    //Generate the tail in form of a green box.
    Box tail = new Box(halfTailLength,0.02f,0.02f,greenApp);

    //A transformation placing the tail at the end of the cockpit.
    Transform3D tfTail = new Transform3D();
    tfTail.setTranslation(new Vector3f(cabinRadius+halfTailLength,0.0f,0.0f));

View Full Code Here

    fBoxApp.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
                          diffuseColourFBox,specularColourFBox,shininessFBox));


    Box fBox = new Box(0.2f,0.2f,0.2f,fBoxApp);

    //The UserData are needed in order to identify the cube when it is picked.
    fBox.setUserData("cube");


    Transform3D tfFBox = new Transform3D();
    tfFBox.rotY(Math.PI/6);
    Transform3D rotationX = new Transform3D();
View Full Code Here

    Appearance birdApp = new Appearance();
    birdApp.setMaterial(new Material(ambientColourBird,emissiveColourBird,
                          diffuseColourBird,specularColourBird,shininessBird));

    //The wings.
    Box wings = new Box(0.03f,0.005f,0.3f,birdApp);

    //The transformation group for the bird including the flight and the sound.
    TransformGroup tgmBird = new TransformGroup();
    tgmBird.addChild(wings);

    //The body of the bird.
    Box body = new Box(0.1f,0.01f,0.01f,birdApp);
    tgmBird.addChild(body);


    //The bird's flight.
    long flightTime = 10000;
View Full Code Here

    Appearance fBoxApp = new Appearance();
    fBoxApp.setMaterial(new Material(ambientColourFBox,emissiveColourFBox,
                          diffuseColourFBox,specularColourFBox,shininessFBox));

    //The cube.
    Box fBox = new Box(0.2f,0.2f,0.2f,fBoxApp);

    //The transformation group of the cube.
    Transform3D tfFBox = new Transform3D();
    tfFBox.rotY(Math.PI/6);
    Transform3D rotationX = new Transform3D();
View Full Code Here




//*** The cube and its transformation group ***
    Box b2 = new Box(boxHL,boxHL,boxHL,shadedApp);
    Transform3D tfBox2 = new Transform3D();
    tfBox2.setTranslation(new Vector3f(-0.95f+r+shift,0.0f,0.0f));
    Transform3D rotation = new Transform3D();
    rotation.rotY(Math.PI/4);
    Transform3D rotationX = new Transform3D();
View Full Code Here




//*** The cube and its transformation group ***
    Box b2 = new Box(boxHL,boxHL,boxHL,shadedApp);
    Transform3D tfBox2 = new Transform3D();
    tfBox2.setTranslation(new Vector3f(-0.95f+r+shift,0.0f,0.0f));
    Transform3D rotation = new Transform3D();
    rotation.rotY(Math.PI/4);
    Transform3D rotationX = new Transform3D();
View Full Code Here

    //Half edge length of the cube that represents the platform.
    float platformSize = 0.1f;

    //Generate the platform in the form of a cube.
    Box platform = new Box(platformSize,platformSize,platformSize,blackApp);

    //A transformation rotating the platform a little bit.
    Transform3D tfPlatform = new Transform3D();
    tfPlatform.rotY(Math.PI/6);

    //The transformation group of the platform.
    TransformGroup tgPlatform = new TransformGroup(tfPlatform);
    tgPlatform.addChild(platform);





//*** The cockpit of the helicopter. ****


    //Radius of the cockpit.
    float cabinRadius = 0.1f;

    //Generate the cockpit in the form of a sphere.
    Sphere cabin = new Sphere(cabinRadius,blackApp);

    //The transformation group for the cockpit.
    //The cockpit first remains in the origin. Later on, the whole
    //helicopter is shifted onto the platform.
    TransformGroup tgCabin = new TransformGroup();
    tgCabin.addChild(cabin);


//*** The rotor blade of the helicopter. ***

    //Generate the rotor blade in the form of a (very thin and long) box.
    Box rotor = new Box(0.4f,0.0001f,0.01f,blackApp);

    //A transformation placing the rotor blade on top of the cockpit.
    Transform3D tfRotor = new Transform3D();
    tfRotor.setTranslation(new Vector3f(0.0f,cabinRadius,0.0f));

    //The transformation group for the rotor blade.
    TransformGroup tgRotor = new TransformGroup(tfRotor);
    tgRotor.addChild(rotor);


//*** The tail of the helicopter. ***

    //Length of the tail.
    float halfTailLength = 0.2f;

    //Generate the tail in form of a box.
    Box tail = new Box(halfTailLength,0.02f,0.02f,blackApp);

    //A transformation placing the tail at the end of the cockpit.
    Transform3D tfTail = new Transform3D();
    tfTail.setTranslation(new Vector3f(cabinRadius+halfTailLength,0.0f,0.0f));

View Full Code Here

TOP

Related Classes of com.sun.j3d.utils.geometry.Box

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.