/** * Returns a new simple frame with a triangle group. * @param tg a triangle group. * @return the simple frame. */ public static SimpleFrame asTriangles(TriangleGroup tg) { SimpleFrame sf = new SimpleFrame(); sf.addTriangles(tg); sf.getOrbitView().setWorldSphere(tg.getBoundingSphere(true)); return sf; }
/** * Returns a new simple frame with an image panel group. * @param ipg an image panel group. * @return the simple frame. */ public static SimpleFrame asImagePanels(ImagePanelGroup ipg) { SimpleFrame sf = new SimpleFrame(); sf.addImagePanels(ipg); sf.getOrbitView().setWorldSphere(ipg.getBoundingSphere(true)); return sf; }
/** * Returns a new simple frame with an image panel group. * @param f a 3D array. * @return the simple frame. */ public static SimpleFrame asImagePanels(float[][][] f) { return asImagePanels(new ImagePanelGroup(f)); }
/** * Demos re-positioning the light source to the top-right corner. */ private static void demo1() { Sphere sphere = new Sphere(); StateSet states = StateSet.forTwoSidedShinySurface(Color.WHITE); sphere.setStates(states); World world = new World(); world.addChild(sphere); SimpleFrame sf = new SimpleFrame(world); OrbitViewLighting ovl = new OrbitViewLighting(); ovl.setPosition(0,1.0f,1.0f,0.0f); ovl.setLightSourceType(LightSourceType.DIRECTIONAL); sf.getOrbitView().setOrbitViewLighting(ovl); sf.setTitle("OrbitViewLighting Demo: Re-positioned primary light"); }
public static void go(String[] args) { float[] xyz = makeSineWave(); xyz = addBulge(xyz); xyz = addTear(xyz); SimpleFrame sf = new SimpleFrame(); TriangleGroup tg = sf.addTriangles(xyz); tg.setColor(Color.BLUE); if (args.length>0) sf.paintToFile(args[0]); }
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(new Dimension(SIZE,SIZE)); this.add(_canvas,BorderLayout.CENTER); this.add(_toolBar,BorderLayout.WEST); this.setJMenuBar(menuBar); this.setVisible(true);
private static void show(Node node) { World world = new World(); world.addChild(node); SimpleFrame sf = new SimpleFrame(world); sf.getOrbitView().setScale(2.0); } }
SimpleFrame sf = new SimpleFrame(); World world = sf.getWorld(); sf.getViewCanvas().setBackground(new Color(254,246,235)); StateSet ss = new StateSet(); PointState ps = new PointState();
/** * Demos the default behavior. */ private static void demo0() { Sphere sphere = new Sphere(); StateSet states = StateSet.forTwoSidedShinySurface(Color.WHITE); sphere.setStates(states); World world = new World(); world.addChild(sphere); SimpleFrame sf = new SimpleFrame(world); sf.setTitle("OrbitViewLighting Demo: Default lighting"); }
/** * Adds a triangle group with specified vertex coordinates and colors. * @param xyz array of packed vertex coordinates. * @param rgb array of packed color components. * @return the triangle group. */ public TriangleGroup addTriangles(float[] xyz, float[] rgb) { return addTriangles(new TriangleGroup(true,xyz,rgb)); }
/** * Returns a new simple frame with a triangle group. * @param vn true, for vertex normals; false, for triangle normals. * @param xyz array of packed vertex coordinates. * @return the simple frame. */ public static SimpleFrame asTriangles(boolean vn, float[] xyz) { return asTriangles(vn,xyz,null); }
private static void show(Node node) { StateSet states = StateSet.forTwoSidedShinySurface(Color.CYAN); node.setStates(states); World world = new World(); world.addChild(node); SimpleFrame sf = new SimpleFrame(world); }
/** * Adds an image panel group to a simple frame from given samplings and * a 3D array. * @param s1 sampling in the 1st dimension (Z). * @param s2 sampling in the 2nd dimension (Y). * @param s3 sampling in the 3rd dimension (X). * @param f a 3D array. * @return the image panel group. */ public ImagePanelGroup addImagePanels( Sampling s1, Sampling s2, Sampling s3, float[][][] f) { return addImagePanels(new ImagePanelGroup(s1,s2,s3,f)); }
/** * Demos activating all three lights and assigning colors. */ private static void demo2() { Sphere sphere = new Sphere(); StateSet states = StateSet.forTwoSidedShinySurface(Color.WHITE); sphere.setStates(states); World world = new World(); world.addChild(sphere); SimpleFrame sf = new SimpleFrame(world); OrbitViewLighting ovl = new OrbitViewLighting(); ovl.setPosition(0,-2.0f, 2.0f,0.0f); ovl.setPosition(1, 2.0f, 2.0f,0.0f); ovl.setPosition(2, 0.0f,-2.0f,0.0f); ovl.setLightSourceType(0, LightSourceType.POSITIONAL); ovl.setLightSourceType(1, LightSourceType.POSITIONAL); ovl.setLightSourceType(2, LightSourceType.POSITIONAL); ovl.setDiffuse(0,RED); ovl.setDiffuse(1,GREEN); ovl.setDiffuse(2,BLUE); ovl.toggleLight(1); ovl.toggleLight(2); sf.getOrbitView().setOrbitViewLighting(ovl); sf.setTitle("OrbitViewLighting Demo: Three Lights"); }
/** * Adds a triangle group for a sampled function z = f(x,y). * @param sx sampling of x coordinates; may be non-uniform. * @param sy sampling of y coordinates; may be non-uniform. * @param z array[nx][ny] of z coordinates z = f(x,y). */ public TriangleGroup addTriangles(Sampling sx, Sampling sy, float[][] z) { return addTriangles(new TriangleGroup(true,sx,sy,z)); }
/** * Returns a new simple frame with a triangle group. * Triangles will be constructed as vertex normals. * @param xyz array of packed vertex coordinates. * @param rgb array of packed color coordinates. * @return the simple frame. */ public static SimpleFrame asTriangles(float[] xyz, float[] rgb) { return asTriangles(true,xyz,rgb); } /**
/** * Adds an image panel group to a simple frame from a given 3D array * @param f a 3D array. * @return the image panel group. */ public ImagePanelGroup addImagePanels(float[][][] f) { return addImagePanels(new Sampling(f[0][0].length), new Sampling(f[0].length), new Sampling(f.length), f); }
/** * Adds a triangle group with specified vertex coordinates. * @param xyz array of packed vertex coordinates. * @return the triangle group. */ public TriangleGroup addTriangles(float[] xyz) { return addTriangles(new TriangleGroup(true,xyz,null)); }
/** * Returns a new simple frame with a triangle group. * Triangles will be constructed as vertex normals. * @param xyz array of packed vertex coordinates. * @return a simple frame. */ public static SimpleFrame asTriangles(float[] xyz) { return asTriangles(true,xyz); }
/** * Returns a new simple frame with an image panel group. * @param s1 sampling in the 1st dimension (Z). * @param s2 sampling in the 2nd dimension (Y). * @param s3 sampling in the 3rd dimension (X). * @param f a 3D array. * @return the simple frame. */ public static SimpleFrame asImagePanels( Sampling s1, Sampling s2, Sampling s3, float[][][] f) { return asImagePanels(new ImagePanelGroup(s1,s2,s3,f)); }