Package com.sun.j3d.utils.geometry

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


  }/**/
 
 
  public void generateSpheres(Point3f nodes[]){
    for(int i=0; i<nodes.length; i++) {
      Sphere sphere = new Sphere(0.01f);
   
      sphere.setName("Sphere #" + i);
     
      TransformGroup method1Transform = new TransformGroup();
        Transform3D MoveTheMethod1 = new Transform3D();
      Vector3f method1Vector = new Vector3f(nodes[i]);
       
View Full Code Here


   
     final Cylinder cylinder = new Cylinder(1, 1,
         Cylinder.GENERATE_NORMALS |
         Cylinder.ENABLE_GEOMETRY_PICKING,
         26, 26, lightGrayLook);
        final Sphere sphere = new Sphere(10,
            Sphere.GENERATE_NORMALS |
            Sphere.ENABLE_GEOMETRY_PICKING, redLook);
        final Box box = new Box(10,10,10,
            Box.GENERATE_NORMALS |
            Box.ENABLE_GEOMETRY_PICKING,
            redLook);

    this.edgeAppearanceTransformer = new ConstantTransformer(lightGrayLook);
    this.edgeShapeTransformer = new Transformer<Context<Graph<V,E>,E>,Node>() {

      public Node transform(Context<Graph<V,E>,E> ec) {
        LineArray lineArray = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
        lineArray.setCoordinates(0, new Point3f[]{new Point3f(0,-.5f,0),new Point3f(0,.5f,0)});
        lineArray.setColor(0, new Color3f(1,1,1));
        lineArray.setColor(1, new Color3f(1,1,1));
        Shape3D shape = new Shape3D();
        shape.setGeometry(lineArray);
        return shape;
//        return new Cylinder(1, 1,
//            Cylinder.GENERATE_NORMALS |
//            Cylinder.ENABLE_GEOMETRY_PICKING,
//             26, 26, lightGrayLook);
      }};
    this.vertexAppearanceTransformer = new ConstantTransformer(redLook);
    this.vertexShapeTransformer = new Transformer<V,Node>() {

      public Node transform(V arg0) {
        return new Sphere(10,
            Sphere.GENERATE_NORMALS |
            Sphere.ENABLE_GEOMETRY_PICKING|
            Sphere.ENABLE_APPEARANCE_MODIFY, redLook);
      }};
  }
View Full Code Here

/*  91 */     super.buildGraph();
/*     */   }
/*     */
/*     */   public SceneGraphObject createNode(Class j3dClass)
/*     */   {
/*  97 */     Sphere sphere = (Sphere)createNode(j3dClass, new Class[] { Float.TYPE, Integer.TYPE, Integer.TYPE, Appearance.class }, new Object[] { new Float(this.radius), new Integer(this.primflags), new Integer(this.divisions), null });
/*     */
/* 108 */     return sphere;
/*     */   }
View Full Code Here

/*     */
/* 108 */     return sphere;
/*     */   }
/*     */
/*     */   protected SceneGraphObject createNode() {
/* 112 */     return new Sphere(this.radius, this.primflags, this.divisions, null);
/*     */   }
View Full Code Here

    // transform for sphere
    Transform3D tr5 = new Transform3D();
    tr5.set(new Vector3f(0f,-1f,0f));
    tr1.mul(tr5);   
    TransformGroup trGsphere = new TransformGroup(tr1);
    Sphere sphere= new Sphere(0.2f,appSphere);
    trGsphere.addChild(sphere);
   
   
   
    trG1.addChild(trGcyl1);
View Full Code Here

        // and add it into the scene graph.
        ColoringAttributes Sun = new ColoringAttributes();
        Sun.setColor(SunColor);
        Appearance sun = new Appearance();
        sun.setColoringAttributes(Sun);
        Solar.addChild( new Sphere(.05f, Sphere.GENERATE_NORMALS,180,sun));
        Light SunLight = null;
        Point3f lPoint  = new Point3f(0.0f, 0.0f, 0.0f);
        Point3f atten = new Point3f(1.0f, 0.0f, 0.0f);
        SunLight = new PointLight(SunColor, lPoint, atten);
        // Set the influencing bounds
View Full Code Here

    {
        Material Ma = new Material(lightedColor, darkColor,lightedColor,darkColor, 0);
        Appearance ma = new Appearance();
        ma.setMaterial(Ma);
        Ma.setLightingEnable(true);
        Sphere Sph = new Sphere(diameter,Sphere.GENERATE_NORMALS,140,ma);
        return Sph;
    }
View Full Code Here

        // and add it into the scene graph.
        Material m = new Material(objColor, eColor, objColor, sColor, 100.0f);
        Appearance a = new Appearance();
        m.setLightingEnable(true);
        a.setMaterial(m);
        Sphere sph = new Sphere(1.0f, Sphere.GENERATE_NORMALS, 180, a);
        /*#
         * add the main cernter sphere
         */
        objScale.addChild(sph);
        // Create the transform group node for the each light and initialize
        // it to the identity.  Enable the TRANSFORM_WRITE capability so that
        // our behavior code can modify it at runtime.  Add them to the root
        // of the subgraph.
        Transform3D r = new Transform3D();
        TransformGroup l1RotTrans = new TransformGroup();
        l1RotTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objScale.addChild(l1RotTrans);
        TransformGroup l2RotTrans = new TransformGroup();
        l2RotTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objScale.addChild(l2RotTrans);
        Vector3d Pos1 = new Vector3d(1.3, 1.3, 1.3);
        r.set(Pos1);
        TransformGroup errans = new TransformGroup(r);
        errans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objScale.addChild(errans);
        // Create transformations for the positional lights
        t = new Transform3D();
        /*#
         * set the position of the 2 other spheres
         */
        Vector3d lPos1 =  new Vector3d(1.7,1.6, 1.5);
        t.set(lPos1);
        TransformGroup l1Trans = new TransformGroup(t);
        l1RotTrans.addChild(l1Trans);
        Vector3d lPos2 = new Vector3d(0, 0, 0);
        t.set(lPos2);
        TransformGroup l2Trans = new TransformGroup(t);
        l2RotTrans.addChild(l2Trans);
        Vector3d lPos3 = new Vector3d(1.3, 1.3, 1.3);
        t.set(lPos3);
        TransformGroup l3Trans = new TransformGroup(t);
        errans.addChild(l2Trans);
        errans.addChild(l3Trans);
        // Create Geometry for point lights
        ColoringAttributes caL1 = new ColoringAttributes();
        ColoringAttributes caL2 = new ColoringAttributes();
        ColoringAttributes caL3 = new ColoringAttributes();
        caL1.setColor(lColor1);
        caL2.setColor(lColor2);
        caL3.setColor(lColor3);
        Appearance appL1 = new Appearance();
        Appearance appL2 = new Appearance();
        Appearance appL3 = new Appearance();
        appL1.setColoringAttributes(caL1);
        appL2.setColoringAttributes(caL2);
        appL3.setColoringAttributes(caL3);
        l1Trans.addChild(new Sphere(0.05f, appL1));
        l2Trans.addChild(new Sphere(0.05f, appL2));
        l3Trans.addChild(new Sphere(0.05f, appL3));
        // Create lights
        AmbientLight aLgt = new AmbientLight(alColor);
        Light lgt1 = null;
        Light lgt2 = null;
        Light lgt3 = null;
View Full Code Here

TOP

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

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.