view.reset(); float azimuth = (float)view.getAzimuth(); float elevation = (float)view.getElevation(); float scale = (float)view.getScale(); Vector3 t = view.getTranslate(); System.out.println("OrbitView: azimuth="+azimuth); System.out.println(" elevation="+elevation); Tuple3 s = view.getAxesScale(); view.setAxesScale(s.x,s.y,s.z/1.1); Tuple3 s = view.getAxesScale(); view.setAxesScale(s.x,s.y,s.z*1.1); OrbitView.Projection projection = view.getProjection(); if (projection==OrbitView.Projection.ORTHOGRAPHIC) { projection = OrbitView.Projection.PERSPECTIVE; view.setProjection(projection); double scale = view.getScale(); if (kc==KeyEvent.VK_UP) { scale *= 0.9; view.setScale(scale); Matrix44 unitSphereToView = _view.getUnitSphereToView(); Matrix44 unitSphereToCube = viewToCube.times(unitSphereToView);
/** * Sets the bounding sphere of the frame. * @param bs the bounding sphere. */ public void setWorldSphere(BoundingSphere bs) { _view.setWorldSphere(bs); }
private void beginRotate(MouseEvent e) { _xmouse = e.getX(); _ymouse = e.getY(); _canvas = (ViewCanvas)e.getSource(); _canvas.addMouseMotionListener(_mml); _view = (OrbitView)_canvas.getView(); _azimuth = _view.getAzimuth(); _elevation = _view.getElevation(); }
public DemoFrame(World world) { OrbitView view = (world!=null)?new OrbitView(world):new OrbitView(); view.setAxesOrientation(AxesOrientation.XRIGHT_YOUT_ZDOWN); _canvas = new ViewCanvas(view); _canvas.setView(view);
Tuple3 as = getAxesScale(); AxesOrientation ao = getAxesOrientation(); _worldToUnitSphere = Matrix44.identity(); World world = getWorld(); if (world!=null) { if (_worldSphere==null) setWorldToView(_unitSphereToView.times(_worldToUnitSphere));
private void duringScale(MouseEvent e) { int h = _canvas.getHeight(); int y = e.getY(); int dy = y-_ymouse; double ds = 2.0*(double)dy/(double)h; _view.setScale(_scale*Math.pow(10.0,ds)); }
private void beginScale(MouseEvent e) { _ymouse = e.getY(); _canvas = (ViewCanvas)e.getSource(); _canvas.addMouseMotionListener(_mml); _view = (OrbitView)_canvas.getView(); _scale = _view.getScale(); }
if (ao==null) ao = AxesOrientation.XRIGHT_YOUT_ZDOWN; _world = world; _view = new OrbitView(_world); _view.setAxesOrientation(ao); _canvas = new ViewCanvas(); _canvas.setView(_view);
private static void show(Node node) { World world = new World(); world.addChild(node); SimpleFrame sf = new SimpleFrame(world); sf.getOrbitView().setScale(2.0); } }
/** * 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; }
world.addChild(ipg); final DemoFrame frame = new DemoFrame(world); frame.getOrbitView().setScale(2.0); frame.setVisible(true); if (args.length>0) {
/** * 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; }
public static void main(String[] args) { float[] xyz = makeSineWave(); xyz = addBulge(xyz); xyz = addTear(xyz); float[] rgb = makeColors(xyz); System.out.println("Making QuadGroup ..."); QuadGroup tg = new QuadGroup(true,xyz,rgb); System.out.println("QuadGroup bounding sphere =\n" + tg.getBoundingSphere(true)); StateSet states = new StateSet(); ColorState cs = new ColorState(); cs.setColor(Color.CYAN); states.add(cs); LightModelState lms = new LightModelState(); lms.setTwoSide(true); states.add(lms); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.white); ms.setShininess(100.0f); states.add(ms); tg.setStates(states); World world = new World(); world.addChild(tg); DemoFrame frame = new DemoFrame(world); OrbitView view = frame.getOrbitView(); view.setWorldSphere(new BoundingSphere(5,5,5,5)); frame.setSize(new Dimension(800,600)); frame.setVisible(true); }
view.setWorldSphere(new BoundingSphere(5,5,5,5)); frame.setSize(new Dimension(800,600)); frame.setVisible(true);
public static void go() { float[] xyz = makeSineWave(); xyz = addBulge(xyz); xyz = addTear(xyz); float[] rgb = makeColors(xyz); TriangleGroup tg = new TriangleGroup(true,xyz,rgb); System.out.println("TriangleGroup bounding sphere =\n" + tg.getBoundingSphere(true)); StateSet states = new StateSet(); ColorState cs = new ColorState(); cs.setColor(Color.CYAN); states.add(cs); LightModelState lms = new LightModelState(); lms.setTwoSide(true); states.add(lms); MaterialState ms = new MaterialState(); ms.setColorMaterial(GL_AMBIENT_AND_DIFFUSE); ms.setSpecular(Color.WHITE); ms.setShininess(100.0f); states.add(ms); tg.setStates(states); World world = new World(); world.addChild(tg); DemoFrame frame = new DemoFrame(world); OrbitView view = frame.getOrbitView(); view.setWorldSphere(new BoundingSphere(5,5,5,5)); frame.setSize(new Dimension(800,600)); frame.setVisible(true); }