Author: paperwing Date: 2012-03-21 11:55:41 -0700 (Wed, 21 Mar 2012) New Revision: 28605
Modified: csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/data/GraphicsData.java csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.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/EdgeShapeDrawer.java Log: Modified spherical layout algorithm to align nodes on latitudinal and longitudinal lines of sphere, first attempt to control number of latitude and longitude lines. Layout now looks like: http://wiki.cytoscape.org/Cytoscape_3/3D_Renderer?action=AttachFile&do=get&target=screenshot-0.58-spherical1.png Modified: csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/data/GraphicsData.java =================================================================== --- csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/data/GraphicsData.java 2012-03-21 18:36:30 UTC (rev 28604) +++ csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/data/GraphicsData.java 2012-03-21 18:55:41 UTC (rev 28605) @@ -41,7 +41,7 @@ * This value controls distance scaling when converting from Cytoscape * coordinates (such as from Ding) to the renderer's 3D coordinates */ - private float distanceScale = 178.0f; + private float distanceScale = 180.0f; private float verticalFov = 45.0f; Modified: csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.java =================================================================== --- csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.java 2012-03-21 18:36:30 UTC (rev 28604) +++ csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/layouts/SphericalLayoutAlgorithmTask.java 2012-03-21 18:55:41 UTC (rev 28605) @@ -33,10 +33,34 @@ for (View<CyNode> nodeView : networkView.getNodeViews()) { - double phi = Math.random() * Math.PI * 2; + /* + int nodesPerLevel = (int) Math.max(Math.sqrt(nodeCount), 1); - x = Math.cos((double) current / nodeCount * Math.PI * 2) * Math.sin(phi); - y = Math.sin((double) current / nodeCount * Math.PI * 2) * Math.sin(phi); + // The fraction should range from 0 to 1 + double levelFraction = Math.floor(current / nodesPerLevel) * nodesPerLevel / nodeCount; + + double thetaLimit = 0.1; + double phiLimit = 0.1; + + // double theta = Math.PI / 2 - (Math.PI * thetaLimit + (double) level / numLevels * Math.PI * (1 - 2 * thetaLimit)); + double theta = Math.PI / 2 - (Math.PI * thetaLimit + levelFraction * Math.PI * (1 - 2 * thetaLimit)); + double phi = Math.PI * phiLimit + (double) (current % nodesPerLevel) / nodesPerLevel * Math.PI * (2 - 2 * phiLimit); + + phi = 2; + */ + + int numLevels = (int) Math.sqrt(nodeCount); + + int level = (current / numLevels) * numLevels; + + double thetaLimit = 0.1; + double phiLimit = 0.1; + + double theta = Math.PI / 2 - (Math.PI * thetaLimit + (double) level / nodeCount * Math.PI * (1 - 2 * thetaLimit)); + double phi = Math.PI * phiLimit + (double) (current % numLevels) / numLevels * Math.PI * (2 - 2 * phiLimit); + + x = Math.cos(theta) * Math.sin(phi); + y = Math.sin(theta) * Math.sin(phi); z = Math.cos(phi); x *= sphereRadius; 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-03-21 18:36:30 UTC (rev 28604) +++ csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java 2012-03-21 18:55:41 UTC (rev 28605) @@ -96,7 +96,7 @@ // Draw it only if the visual property says it is visible if (nodeView.getVisualProperty(BasicVisualLexicon.NODE_VISIBLE) - && graphicsData.getViewingVolume().inside(new Vector3(x, y, z), graphicsData.getNearZ() / 2)) { + && graphicsData.getViewingVolume().inside(new Vector3(x, y, z), 1)) { gl.glPushMatrix(); gl.glTranslatef(x, y, z); Modified: csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/EdgeShapeDrawer.java =================================================================== --- csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/EdgeShapeDrawer.java 2012-03-21 18:36:30 UTC (rev 28604) +++ csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/shapes/EdgeShapeDrawer.java 2012-03-21 18:55:41 UTC (rev 28605) @@ -11,7 +11,7 @@ public class EdgeShapeDrawer { - private static int REGULAR_CYLINDER_SLICES = 4; + private static int REGULAR_CYLINDER_SLICES = 3; private static int REGULAR_CYLINDER_STACKS = 1; private static int DASHED_CYLINDER_SLICES = 3; -- 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.
