Hello,

I learn newly Java programming.

Because of this I have this small following question on it:

I must create several points from different 3 components (x, y, z), values.

e.g: I must create 2 points and (2, 4, 6) in Java3D of (1, 2, 3).

Does anybody have idea for it?

If somebody can help me, I am very grateful for it.

Greeting

Angelo

Hello,

it is draw of a point.

Therefore I must draw 3 components (x, y, z), points.

It is a whole simple question.

But I learn Java programming completely newly.
Because of this I need help with it.

I am immediately available for a further explanation.

Many thanks

Angelo

Hello,

it is draw of a point.

Therefore I must draw 3 components (x, y, z), points.

It is a whole simple question.

But I learn Java programming completely newly.
Because of this I need help with it.

I am immediately available for a further explanation.

Many thanks

Angelo

hi,
sorry.. I will try to answer to your question.

Hello again,

I have found and continued to work on an example programme.

But I get, only black area without points.

Somebody has idea as I can further solve it.

Greeting

Angelo

The last worked on programme:

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;

import javax.media.j3d.Appearance;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.Material;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Vector3f;

import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.Primitive;
import com.sun.j3d.utils.geometry.Sphere;
import com.sun.j3d.utils.universe.SimpleUniverse;

//   HelloJava3Da renders a single, rotating cube.

public class HelloJava3Da extends Applet {
            /**
             * The generated serialVersionUID.
             */
            private static final long serialVersionUID = -8652165991244123757L;

            public static void main(final String[] args) {
                        new MainFrame(new HelloJava3Da(), 256, 256);
            } // end of main (method of HelloJava3Da)

            public HelloJava3Da() {
                        this.setLayout(new BorderLayout());
                        final GraphicsConfiguration config = SimpleUniverse
                                               .getPreferredConfiguration();

                        final Canvas3D canvas3D = new Canvas3D(config);
                        this.add("Center", canvas3D);

                        final BranchGroup scene = this.createSceneGraph();

                        // SimpleUniverse is a Convenience Utility class
                        final SimpleUniverse simpleU = new SimpleUniverse(canvas3D);

                        // This will move the ViewPlatform back a bit so the
                        // objects in the scene can be viewed.
                        simpleU.getViewingPlatform().setNominalViewingTransform();

                        simpleU.addBranchGraph(scene);
            } // end of HelloJava3Da (constructor)

            // The following allows this to be run as an application
            // as well as an applet

            Appearance createAppearance() {

                        final Appearance appear = new Appearance();
                        final Material material = new Material();
                        // material.setDiffuseColor(0.0f, 0.0f, 1.0f);
                        material.setShininess(50.0f);
                        // make modifications to default material properties
                        appear.setMaterial(material);

                        // ColoringAttributes colorAtt = new ColoringAttributes();
                        // colorAtt.setShadeModel(ColoringAttributes.SHADE_FLAT);
                        // appear.setColoringAttributes(colorAtt);

                        return appear;
            }

            public BranchGroup createSceneGraph() {
                        // Create the root of the branch graph
                        final BranchGroup objRoot = new BranchGroup();

                        final Transform3D zTrans = new Transform3D();
                        zTrans.set(new Vector3f(1f, 2f, 1.3f)); // -------------------------------
                        // POSITION 1
                        final TransformGroup objTrans = new TransformGroup(zTrans);
                        objTrans.addChild(new Sphere(0.9f, Primitive.GENERATE_NORMALS, this
                                               .createAppearance()));

                        final Transform3D zTrans2 = new Transform3D();
                        zTrans.set(new Vector3f(3f, 3f, 4f)); // -------------------------------
                        // POSITION 2
                        final TransformGroup objTrans2 = new TransformGroup(zTrans2);
                        objTrans2.addChild(new Sphere(0.9f, Primitive.GENERATE_NORMALS, this
                                               .createAppearance()));

                        objRoot.addChild(objTrans);
                        objRoot.addChild(objTrans2);

                        return objRoot;
            } // end of CreateSceneGraph method of HelloJava3Da

} // end of class HelloJava3Da

Hello,

does nobody want further to help me at it?

Is anything not all right?

HI,
Can u plz help me in executing this program u sent in your message. I want to know what all API's are needed and what classpath setting need to be done. As of now i have simple java1.5 setup. Kindly help me.
Thanx in advance.

Hello,

does nobody want further to help me at it?

Is anything not all right?

This article has been dead for over six months. Start a new discussion instead.