Mercurial > hg > Database > Alice
changeset 142:287aae21e7d8 working
minor change
author | sugi |
---|---|
date | Thu, 20 Sep 2012 22:05:32 +0900 |
parents | 4c71bbfe557d |
children | 0651fb36a369 |
files | scripts/run_manager.sh scripts/view_log.sh src/alice/test/topology/aquarium/MakeFrame.java src/alice/test/topology/aquarium/MakeObject.java src/alice/test/topology/aquarium/MouseViewEvent.java src/alice/test/topology/aquarium/ViewChange.java |
diffstat | 6 files changed, 21 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/run_manager.sh Thu Sep 20 22:05:32 2012 +0900 @@ -0,0 +1,6 @@ +#!/bin/bash +max=$1 +child_num=$2 +ruby ./topology/treen.rb $1 $2 > ./topology/tree.dot +dot -Tpng ./topology/tree.dot > ./topology/tree.png +java -cp ../Alice.jar alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot & \ No newline at end of file
--- a/scripts/view_log.sh Thu Sep 20 21:35:23 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -#!/bin/bash -ruby ./log.rb $1 > /tmp/log.dot -dot -Tpng /tmp/log.dot > /tmp/log.png; open /tmp/log.png \ No newline at end of file
--- a/src/alice/test/topology/aquarium/MakeFrame.java Thu Sep 20 21:35:23 2012 +0900 +++ b/src/alice/test/topology/aquarium/MakeFrame.java Thu Sep 20 22:05:32 2012 +0900 @@ -9,7 +9,6 @@ import javax.media.j3d.Background; import javax.media.j3d.BoundingSphere; import javax.media.j3d.BranchGroup; -import javax.media.j3d.Canvas3D; import javax.media.j3d.DirectionalLight; import javax.media.j3d.ImageComponent2D; @@ -20,15 +19,12 @@ import javax.vecmath.Vector3f; import com.sun.j3d.utils.universe.SimpleUniverse; -import com.sun.j3d.utils.universe.ViewingPlatform; public class MakeFrame { private int fSizeX = 800; private int fSizeY = 800; - //private Canvas3D canvas; private ViewChange canvas; - private SimpleUniverse universe; private JFrame frame; private ObjectList list = new ObjectList(); @@ -42,20 +38,16 @@ frame.add(cp); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); - //canvas = new Canvas3D(config); canvas = new ViewChange(3.0f,0.01f,config); canvas.setBounds(0,0,fSizeX,fSizeY); cp.add(canvas); - canvas.universe.addBranchGraph(createLight()); canvas.universe.addBranchGraph(setBackground()); canvas.addKeyListener(new KeyInputCodeSegment(this)); frame.setVisible(true); - //ViewingPlatform camera = universe.getViewingPlatform(); - //camera.setNominalViewingTransform(); } private BranchGroup setBackground(){ @@ -95,10 +87,6 @@ } - public SimpleUniverse getUniverse(){ - return this.universe; - } - public ViewChange getCanvas(){ return this.canvas; }
--- a/src/alice/test/topology/aquarium/MakeObject.java Thu Sep 20 21:35:23 2012 +0900 +++ b/src/alice/test/topology/aquarium/MakeObject.java Thu Sep 20 22:05:32 2012 +0900 @@ -7,7 +7,6 @@ import javax.media.j3d.Appearance; import javax.media.j3d.BranchGroup; -import javax.media.j3d.Canvas3D; import javax.media.j3d.Texture; import javax.media.j3d.Transform3D; import javax.media.j3d.TransformGroup; @@ -24,7 +23,6 @@ private Transform3D transform; private TransformGroup transform_group; - //private Canvas3D canvas; private ViewChange canvas; private Matrix4d matrix; private double s;
--- a/src/alice/test/topology/aquarium/MouseViewEvent.java Thu Sep 20 21:35:23 2012 +0900 +++ b/src/alice/test/topology/aquarium/MouseViewEvent.java Thu Sep 20 22:05:32 2012 +0900 @@ -3,45 +3,29 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; -import javax.media.j3d.Transform3D; -import javax.vecmath.Vector3f; - public class MouseViewEvent implements MouseMotionListener { - /* - float sensitivity; - float distance; int new_x, new_y; int pre_x, pre_y; - float camera_x, camera_y, camera_z, camera_xz, camera_xy, camera_yz = 0; - float phi = 0;//(float)Math.PI; - float theta = (float)Math.PI/3; + ViewChange v; - Transform3D Transform_camera_pos; - Transform3D Transform_camera_phi; - Transform3D Transform_camera_theta; - Vector3f Vector_camera_pos; - */ - ViewChange v; public MouseViewEvent(ViewChange v) { this.v = v; - //this.distance = d; - //this.sensitivity = s; + } @Override public void mouseDragged(MouseEvent event) { - v.new_x = event.getX(); - v.new_y = event.getY(); + new_x = event.getX(); + new_y = event.getY(); - v.theta -= v.sensitivity * (v.new_y - v.pre_y); - v.phi += v.sensitivity * (v.new_x - v.pre_x); + v.theta -= v.sensitivity * (new_y - pre_y); + v.phi += v.sensitivity * (new_x - pre_x); v.camera_y = v.distance * (float)Math.sin(v.theta); v.camera_xz = v.distance * (float)Math.cos(v.theta); - + v.camera_x = v.camera_xz * (float)Math.sin(v.phi); - v.camera_z = v.camera_xz * (float)Math.cos(v.phi); - + v.camera_z = v.camera_xz * (float)Math.cos(v.phi); v.Vector_camera_pos.x = v.camera_x; v.Vector_camera_pos.y = v.camera_y; v.Vector_camera_pos.z = v.camera_z; @@ -51,19 +35,18 @@ v.Transform_camera_theta.rotX(-v.theta); v.Transform_camera_phi.rotY(v.phi); - v.Transform_camera_phi.mul(v.Transform_camera_theta); v.Transform_camera_pos.mul(v.Transform_camera_phi); v.Camera.setTransform(v.Transform_camera_pos); - v.pre_x = event.getX(); - v.pre_y = event.getY(); + pre_x = event.getX(); + pre_y = event.getY(); } @Override public void mouseMoved(MouseEvent event) { - v.pre_x = event.getX(); - v.pre_y = event.getY(); + pre_x = event.getX(); + pre_y = event.getY(); } }
--- a/src/alice/test/topology/aquarium/ViewChange.java Thu Sep 20 21:35:23 2012 +0900 +++ b/src/alice/test/topology/aquarium/ViewChange.java Thu Sep 20 22:05:32 2012 +0900 @@ -11,14 +11,12 @@ private static final long serialVersionUID = 1L; float sensitivity; float distance; - int new_x, new_y; - int pre_x, pre_y; - SimpleUniverse universe; - TransformGroup Camera; float camera_x, camera_y, camera_z, camera_xz, camera_xy, camera_yz = 0; float phi = 0;//(float)Math.PI; float theta = (float)Math.PI/3; + SimpleUniverse universe; + TransformGroup Camera; Transform3D Transform_camera_pos; Transform3D Transform_camera_phi; Transform3D Transform_camera_theta; @@ -40,7 +38,6 @@ Vector_camera_pos = new Vector3f(camera_x, camera_y, camera_z); Transform_camera_pos = new Transform3D(); Transform_camera_pos.setTranslation(Vector_camera_pos); - Transform_camera_phi = new Transform3D(); Transform_camera_theta = new Transform3D(); Transform_camera_theta.rotX(-theta); @@ -50,8 +47,7 @@ Camera.setTransform(Transform_camera_pos); - MouseViewEvent mouse = new MouseViewEvent(this); - addMouseMotionListener(mouse); + addMouseMotionListener(new MouseViewEvent(this)); }