Author: paperwing
Date: 2012-01-19 15:02:48 -0800 (Thu, 19 Jan 2012)
New Revision: 28059

Modified:
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Graphics.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindVisualLexicon.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/BirdsEyeCoordinatorProcessor.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/ViewingCoordinator.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/data/CoordinatorData.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/geometric/Vector3.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderBoundingBoxProcedure.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
   
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
Log:
Tetrahedron done, in process of modifying bird's eye view's representation of 
the main camera from a rectangle to a 3D slice of the main camera's viewing 
volume

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Graphics.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Graphics.java
 2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/Graphics.java
 2012-01-19 23:02:48 UTC (rev 28059)
@@ -164,6 +164,7 @@
                gl.glEnable(GL.GL_DEPTH_TEST);
 
                gl.glDepthFunc(GL.GL_LEQUAL);
+               // gl.glDepthFunc(GL2.GL_LESS);
                // gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
                gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST);
                // gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE);

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
      2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindRenderingEngine.java
      2012-01-19 23:02:48 UTC (rev 28059)
@@ -97,6 +97,7 @@
                                
                                // TODO: check if negative effects produced by 
this
                                panel.setIgnoreRepaint(true);
+                               // panel.setDoubleBuffered(true);
                                
                                graphics = getGraphicsInstance(networkView, 
visualLexicon);
 

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindVisualLexicon.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindVisualLexicon.java
        2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/WindVisualLexicon.java
        2012-01-19 23:02:48 UTC (rev 28059)
@@ -18,6 +18,16 @@
        public static final VisualProperty<Double> TEST_PROPERTY = new 
DoubleVisualProperty(
                        1.0, ARBITRARY_DOUBLE_RANGE, "TEST_PROPERTY", "Wind 
Test Property", CyNode.class);
        
+       public static final VisualProperty<Double> NODE_PITCH = new 
DoubleVisualProperty(
+                       0.0, ARBITRARY_DOUBLE_RANGE, "NODE_PITCH", "Node Model 
Pitch", CyNode.class);
+       
+       public static final VisualProperty<Double> NODE_YAW = new 
DoubleVisualProperty(
+                       0.0, ARBITRARY_DOUBLE_RANGE, "NODE_YAW", "Node Model 
Yaw", CyNode.class);
+       
+       public static final VisualProperty<Double> NODE_ROLL = new 
DoubleVisualProperty(
+                       0.0, ARBITRARY_DOUBLE_RANGE, "NODE_ROLL", "Node Model 
Roll", CyNode.class);
+       
+       
        /** Create a new WindVisualLexicon object */
        public WindVisualLexicon() {
                super(WIND_ROOT);
@@ -26,9 +36,13 @@
                
                addIdentifierMapping(CyNode.class, "testProperty", 
TEST_PROPERTY);
                
-               VisualProperty visualProperty = this.lookup(Double.class, 
"test");
+               addIdentifierMapping(CyNode.class, "nodePitch", NODE_PITCH);
+               addIdentifierMapping(CyNode.class, "nodeYaw", NODE_YAW);
+               addIdentifierMapping(CyNode.class, "nodeRoll", NODE_ROLL);
                
+               // VisualProperty visualProperty = this.lookup(Double.class, 
"test");
                
+               
        }
 
 }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/BirdsEyeCoordinatorProcessor.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/BirdsEyeCoordinatorProcessor.java
 2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/BirdsEyeCoordinatorProcessor.java
 2012-01-19 23:02:48 UTC (rev 28059)
@@ -53,6 +53,10 @@
                                        // Obtain data from coordinator
                                        
coordinatorData.setBoundsTo(coordinator.calculateBounds());
                                        
+                                       // Store a copy of the main camera's 
position
+                                       
coordinatorData.setLastReportedMainCameraPosition(
+                                                       
coordinator.getUpdatedMainCameraPosition());
+                                       
                                        // Unset flag
                                        coordinator.setMainCameraMoved(false);
                                }
@@ -63,6 +67,9 @@
                                        // Obtain data from coordinator
                                        
coordinatorData.setBoundsTo(coordinator.calculateBounds());
                                        
+                                       
coordinatorData.setLastReportedMainCameraPosition(
+                                                       
coordinator.getUpdatedMainCameraPosition());
+                                       
                                        // Unset flag
                                        
coordinator.setSuggestRecalculateBounds(false);
                                }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/ViewingCoordinator.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/ViewingCoordinator.java
   2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/coordinator/ViewingCoordinator.java
   2012-01-19 23:02:48 UTC (rev 28059)
@@ -113,7 +113,6 @@
                }
        }
        
-       
        public Vector3 calculateCameraPosition(Vector3 cameraDirection, double 
distance) {
                if (!initialBoundsMatched) {
                        return null;
@@ -122,6 +121,10 @@
                }
        }
        
+       public Vector3 getUpdatedMainCameraPosition() {
+               return mainCameraCopy.getPosition().copy();
+       }
+       
        // Claim by a main window rendering object
        public void claimMain() {
                mainStatus = CoordinatorStatus.CLAIMED_AND_LINKED;

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/data/CoordinatorData.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/data/CoordinatorData.java
     2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/data/CoordinatorData.java
     2012-01-19 23:02:48 UTC (rev 28059)
@@ -9,6 +9,8 @@
        
        private boolean boundsManuallyChanged;
        private boolean initialBoundsMatched;
+
+       public Vector3 lastReportedMainCameraPosition;
        
        // This class only works with copies of Vector3 objects
        public CoordinatorData() {
@@ -16,6 +18,8 @@
                
                boundsManuallyChanged = false;
                initialBoundsMatched = false;
+               
+               lastReportedMainCameraPosition = new Vector3();
        }
 
        public void setBoundsTo(Quadrilateral bounds) {
@@ -41,4 +45,13 @@
        public boolean isInitialBoundsMatched() {
                return initialBoundsMatched;
        }
+
+       public Vector3 getLastReportedMainCameraPosition() {
+               return lastReportedMainCameraPosition;
+       }
+
+       public void setLastReportedMainCameraPosition(
+                       Vector3 lastReportedMainCameraPosition) {
+               
this.lastReportedMainCameraPosition.set(lastReportedMainCameraPosition);
+       }
 }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/geometric/Vector3.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/geometric/Vector3.java
        2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/geometric/Vector3.java
        2012-01-19 23:02:48 UTC (rev 28059)
@@ -343,40 +343,8 @@
        
        return rotated;
     }
+
        
-       public Vector3 rotateDebug(Vector3 normal, double angle) {
-       // Parametric equation for circle in 3D space:
-       // P = Rcos(t)u + Rsin(t)nxu + c
-       //
-       // Where:
-       //  -u is a unit vector from the centre of the circle to any point
-       // on the circumference
-       //  -R is the radius
-       //  -n is a unit vector perpendicular to the plane
-        //  -c is the centre of the circle.
-       
-               //TODO: obtain a more efficient sin function
-       Vector3 rotated;
-       
-       rotated = normal.normalize();
-       
-       
-       System.out.println("current vector:" + this);
-       System.out.println("normal after normalization:" + rotated);
-       
-       rotated.crossLocal(this.normalize());
-       System.out.println("normal after cross product:" + rotated);
-       
-       rotated.multiplyLocal(Math.sin(angle));
-       System.out.println("normal after multiplication with sin(angle):" + 
rotated);
-       
-       System.out.println("current vector multiplied by cos(angle): " + 
this.multiply(Math.cos(angle)));
-       
-       rotated.addLocal(this.multiply(Math.cos(angle)));
-       
-       return rotated;
-    }
-       
        // Removed requirement for this vector to be perpendicular to the given 
normal
        public Vector3 rotate(Vector3 normal, double angle) {
        // Parametric equation for circle in 3D space:
@@ -409,6 +377,18 @@
        return rotated;
     }
        
+       /** Treating this and the given vector as position vectors,
+        * moves this vector towards the given vector such that
+        * the distance between them becomes equal to "fraction"
+        * times the original distance.
+        * 
+        * @param other The vector to move towards
+        * @param fraction How much to multiply the distance between the
+        * vectors. Distance is reduced for values less than 1, increased
+        * for values greater than 1. Negative values will place this
+        * vector on the other side of the target vector as in a mirror image.
+        * @return
+        */
        public Vector3 towards(Vector3 other, double fraction) {
                Vector3 result = other.subtract(this);
                result.multiplyLocal(fraction);

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
        2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderArcEdgesProcedure.java
        2012-01-19 23:02:48 UTC (rev 28059)
@@ -25,7 +25,7 @@
 
 public class RenderArcEdgesProcedure implements ReadOnlyGraphicsProcedure {
 
-       private static final double SEGMENT_RADIUS = 0.009;
+       private static final double SEGMENT_RADIUS = 0.007;
        private static final int SEGMENT_SLICES = 4;
        private static final int SEGMENT_STACKS = 1;
        
@@ -38,7 +38,7 @@
        private static final RenderColor DEFAULT_HOVER_COLOR = 
                new RenderColor(0.5, 0.5, 0.7);
        
-       private static final int NUM_SEGMENTS = 11;
+       private static final int NUM_SEGMENTS = 3;
        
        private int segmentListIndex;
        

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderBoundingBoxProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderBoundingBoxProcedure.java
     2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderBoundingBoxProcedure.java
     2012-01-19 23:02:48 UTC (rev 28059)
@@ -9,6 +9,7 @@
 import org.cytoscape.paperwing.internal.geometric.Quadrilateral;
 import org.cytoscape.paperwing.internal.geometric.Vector3;
 import org.cytoscape.paperwing.internal.tools.RenderColor;
+import org.cytoscape.paperwing.internal.tools.RenderToolkit;
 import org.cytoscape.paperwing.internal.tools.SimpleCamera;
 
 public class RenderBoundingBoxProcedure implements ReadOnlyGraphicsProcedure {
@@ -22,10 +23,12 @@
 
        @Override
        public void execute(GraphicsData graphicsData) {
-//             drawFullBox(graphicsData);
                
                if (graphicsData.getCoordinatorData().isInitialBoundsMatched()) 
{
-                       drawHalfBox(graphicsData);
+                       // drawFullBox(graphicsData);
+                       
+                       drawViewingVolumePortion(graphicsData);
+                       // drawHalfBox(graphicsData);
                }
        }
        
@@ -114,4 +117,63 @@
                gl.glEnable(GL.GL_DEPTH_TEST);
                gl.glEnable(GL2.GL_LIGHTING);
        }
+       
+       /** Draws a portion of the viewing volume.
+        * 
+        * Currently, the stored bounds representing the main camera's view is 
used as the front
+        * face of the volume, and the back face is placed at a distance equal 
to 2 times the distance
+        * between the front face and the camera.
+        */
+       private void drawViewingVolumePortion(GraphicsData graphicsData) {
+               
+               GL2 gl = graphicsData.getGlContext();
+               
+               Quadrilateral frontFace = 
graphicsData.getCoordinatorData().getBounds();
+               Quadrilateral backFace = frontFace.copy();
+               
+               // Move the back face so it is twice the distance away from the 
depicted camera as the front face
+               backFace.moveTo(frontFace.getCenterPoint().towards(
+                               
graphicsData.getCoordinatorData().getLastReportedMainCameraPosition(), 2));
+               
+               gl.glDisable(GL2.GL_LIGHTING);
+               gl.glDisable(GL.GL_DEPTH_TEST);
+               
+               gl.glColor3f(0.7f, 0.7f, 0.7f);
+               
+               gl.glBegin(GL2.GL_LINE_STRIP);
+               
+               // Front face
+               RenderToolkit.drawPoint(gl, frontFace.getTopLeft());
+               RenderToolkit.drawPoint(gl, frontFace.getTopRight());
+               RenderToolkit.drawPoint(gl, frontFace.getBottomRight());
+               RenderToolkit.drawPoint(gl, frontFace.getBottomLeft());
+               RenderToolkit.drawPoint(gl, frontFace.getTopLeft());
+               
+               // Back face (includes top left edge)
+               RenderToolkit.drawPoint(gl, backFace.getTopLeft());
+               RenderToolkit.drawPoint(gl, backFace.getBottomLeft());
+               RenderToolkit.drawPoint(gl, backFace.getBottomRight());
+               RenderToolkit.drawPoint(gl, backFace.getTopRight());
+               gl.glEnd();
+               
+               gl.glBegin(GL2.GL_LINES);
+               
+               // Bottom left edge
+               RenderToolkit.drawPoint(gl, frontFace.getBottomLeft());
+               RenderToolkit.drawPoint(gl, backFace.getBottomLeft());
+               
+               // Bottom right edge
+               RenderToolkit.drawPoint(gl, frontFace.getBottomRight());
+               RenderToolkit.drawPoint(gl, backFace.getBottomRight());
+               
+               // Top right edge
+               RenderToolkit.drawPoint(gl, frontFace.getTopRight());
+               RenderToolkit.drawPoint(gl, backFace.getTopRight());
+               
+               gl.glEnd();
+               
+               gl.glEnable(GL.GL_DEPTH_TEST);
+               gl.glEnable(GL2.GL_LIGHTING);
+               
+       }
 }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
   2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
   2012-01-19 23:02:48 UTC (rev 28059)
@@ -126,8 +126,8 @@
                                //gl.glCallList(nodeListIndex);
                                
                                gl.glScalef(SMALL_SPHERE_RADIUS, 
SMALL_SPHERE_RADIUS, SMALL_SPHERE_RADIUS);
-                               // shapeDrawer.drawShape(gl, 
ShapeType.SHAPE_CUBIC);
-                               shapeDrawer.drawShape(gl, 
ShapeType.SHAPE_TETRAHEDRAL);
+                               shapeDrawer.drawShape(gl, 
ShapeType.SHAPE_CUBIC);
+                               // shapeDrawer.drawShape(gl, 
ShapeType.SHAPE_TETRAHEDRAL);
                                
                                gl.glPopMatrix();
                        }

Modified: 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
===================================================================
--- 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
     2012-01-19 21:32:17 UTC (rev 28058)
+++ 
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/ScalableShapeDrawer.java
     2012-01-19 23:02:48 UTC (rev 28059)
@@ -127,13 +127,10 @@
                Vector3 zAxisDirection = new Vector3(0, 0, 1);
                
                // Points' positions are relative to the center of the shape
-               Vector3 topPoint = new Vector3(0, radius * 4, 0);
+               Vector3 topPoint = new Vector3(0, radius, 0);
                Vector3 nearLeftPoint = topPoint.rotate(zAxisDirection, 
Math.toRadians(120));
-               System.out.println("nearLeft after first rotation: " + 
nearLeftPoint);
-               System.out.println("nearLeft distance: " + 
nearLeftPoint.magnitude());
+               nearLeftPoint = nearLeftPoint.rotate(yAxisDirection, 
Math.toRadians(30));
                
-               nearLeftPoint = nearLeftPoint.rotateDebug(yAxisDirection, 
Math.toRadians(30));
-               
                Vector3 farPoint = nearLeftPoint.rotate(yAxisDirection, 
Math.toRadians(240));
                Vector3 nearRightPoint = nearLeftPoint.rotate(yAxisDirection, 
Math.toRadians(120));
                
@@ -144,14 +141,14 @@
                Vector3 rightBackNormal = frontNormal.rotate(yAxisDirection, 
Math.toRadians(120));
                Vector3 bottomNormal = new Vector3(0, -1, 0);
                
-               System.out.println("Tetrahedron coordinates: ");
-               System.out.println("top: " + topPoint);
-               System.out.println("nearLeft: " + nearLeftPoint);
-               System.out.println("nearLeft distance: " + 
nearLeftPoint.magnitude());
-               System.out.println("nearRight: " + nearRightPoint);
-               System.out.println("nearRight distance: " + 
nearRightPoint.magnitude());
-               System.out.println("far: " + farPoint);
-               System.out.println("far distance: " + farPoint.magnitude());
+//             System.out.println("Tetrahedron coordinates: ");
+//             System.out.println("top: " + topPoint);
+//             System.out.println("nearLeft: " + nearLeftPoint);
+//             System.out.println("nearLeft distance: " + 
nearLeftPoint.magnitude());
+//             System.out.println("nearRight: " + nearRightPoint);
+//             System.out.println("nearRight distance: " + 
nearRightPoint.magnitude());
+//             System.out.println("far: " + farPoint);
+//             System.out.println("far distance: " + farPoint.magnitude());
                
                gl.glNewList(shapeListIndex, GL2.GL_COMPILE);
                
@@ -165,7 +162,7 @@
                RenderToolkit.setNormal(gl, leftBackNormal);
                RenderToolkit.drawPoint(gl, topPoint);
                RenderToolkit.drawPoint(gl, farPoint);
-               RenderToolkit.drawPoint(gl, nearRightPoint);
+               RenderToolkit.drawPoint(gl, nearLeftPoint);
                
                RenderToolkit.setNormal(gl, rightBackNormal);
                RenderToolkit.drawPoint(gl, topPoint);

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to