ruprecht
Senior Newbie 
Do you Linux?
|
 |
«
Reply #3 - Posted
2003-01-10 11:43:41 » |
|
Hi,
In the meentime I've checked the including with some other examples and found no differences in the line com.sun.j3d.utils.universe.
I still get errors within the code - One error with wrong startingpoint in the for-loorp and different error relating with the above mentioned including and an error within the startingprocedure. A class is wanted that was the content of the message.
Here my code:
import com.sun.j3d.utils.geometry.*; import com.sun.j3d.utils.universe.*; import javax.media.j3d.*; import javax.vecmath.*;
public class Position extends applet{ SimpleUniverse universe = new SimpleUniverse(); BranchGroup group = new BranchGroup();
//x-axis made of sphere
for (float x =-1.0f;x <= 1.0f;x=x+ 0.1f) { Sphere sphere = new Sphere(0.5f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(x,-0.f,0.f); transform.setTranslation(vector); tg.addChild(sphere); group.addChild(tg); }
//y-axis made of cones //y-axis made of cones
for (float y=-1.0f;y<=1.0f;y=y+0.1f) { Cone cone = new Cone(0.5f,0.1f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(-0.f,y,0.f); transform.setTranslation(vector); tg.addChild(cone); group.addChild(tg); }
//z-axis made of zylinders
for (float z=1.0f; z<=1.0f; z = z+0.1f) { Cylinder cylinder = new Cylinder(0.5f,0.1f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(-0.f,y,0.f); transform.setTranslation(vector); tg.addChild(sphere); group.addChild(tg); }
//y-axis made of cones
for (float y=-1.0f;y<=1.0f;y=y+0.1f) { Cone cone = new Cone(0.5f,0.1f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(-0.f,y,0.f); transform.setTranslation(vector); tg.addChild(cone); group.addChild(tg); }
//z-axis made of zylinders
for (float z=1.0f; z<=1.0f; z = z+0.1f) { Cylinder cylinder = new Cylinder(0.5f,0.1f); TransformGroup tg = new TransformGroup(); Transform3D transform = new Transform3d(); Vector3f vector = new Vector3f(-0.f,y,0.f); transform.setTranslation(vector); tg.addChild(cone); group.addChild(tg); }
Color3f light1Color = new Color3f(.1f,1.4f,.1f); // green light BoundingSphere bounds = new BoundingSphere(new Point3D(0.0,0.0,0.0),100); Vector3f light1Direction = new Vector3f(4.0f,-7.0f,-12.0f); DirectionalLight light1 = new DirectionalLight(light1Color,lightDirection); light1.setInfluencingBounds(bounds); group.addChild(light1); universe.getViewingPlatform().setNominalViewingTransform(); //add the group of objects to the Universe
universe.addBranchGraph(group); }
public Position();
}
|