Author: tomithy
Date: 2010-08-15 08:51:26 -0700 (Sun, 15 Aug 2010)
New Revision: 21391

Added:
   cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/util/Pathfinder.as
   
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/ControlPoint.as
Modified:
   cytoscapeweb/branches/gsoc2010/gbeb/src/CodeArchive.as
   cytoscapeweb/branches/gsoc2010/gbeb/src/GBEBView.as
   cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/util/GeometryUtil.as
   
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/GBEBRouter.as
Log:
Version 0.95
- Bundling success~!

Modified: cytoscapeweb/branches/gsoc2010/gbeb/src/CodeArchive.as
===================================================================
--- cytoscapeweb/branches/gsoc2010/gbeb/src/CodeArchive.as      2010-08-14 
23:51:18 UTC (rev 21390)
+++ cytoscapeweb/branches/gsoc2010/gbeb/src/CodeArchive.as      2010-08-15 
15:51:26 UTC (rev 21391)
@@ -1,3 +1,91 @@
-/*Code Archive
+//Code Archive
 
-*/
\ No newline at end of file
+
+
+
+
+//this method changes the set of control points stored in 
edge.prop.$controlPointsArray 
+public static function changeToDerivedPoints(e:EdgeSprite):void
+{
+       //trace("Geometry Util: Targeting Edge: " + e.toString());
+       var controlPoints:Array = e.props.$controlPointsArray;
+       
+       var tempPoint:Point;
+       var newCPArray:Array = []; //to store derived CP Array
+       
+       if(controlPoints == null ) return;
+       if(controlPoints.length <= 0 ) return;
+       
+       if(e.target == null || e.source == null) return;
+       
+       controlPoints.unshift(new Point(e.source.x, e.source.y));
+       controlPoints.push(new Point(e.target.x, e.target.y));
+       
+       for(var i:int = 1; i < controlPoints.length - 1; i++)
+       {
+               var p:Point = controlPoints[i] as Point;
+               
+               if(p == null) controlPoints.splice(i, 1);
+       }
+       
+       //trace("Geometry Util: CP.length: " + (controlPoints.length - 
2).toString());
+       
+       for(var i:int = 1; i < controlPoints.length - 1; i++)
+       {
+               var p0:Point = controlPoints[i-1] as Point;
+               var p1:Point = controlPoints[i] as Point;
+               var p2:Point = controlPoints[i+1] as Point;
+               
+               var derivedPt:Point = derivePoint(p0, p1, p2);
+               newCPArray.push(derivedPt);                             
+               //trace("Geometry Util:" , p0, p1, p2);
+               
+       }
+       
+       e.props.$controlPointsArray = newCPArray;
+       
+}
+
+
+
+/*
+* Draw a quadratic Bezier curve through a set of control points 
anchorPoints[], with the first point being the start and last points 
+* being static anchor points of the curve. 
+* 
+* This method extends from the solution given at: 
http://stackoverflow.com/questions/2075544/how-can-i-modify-my-code-to-line-through-the-bezier-control-points,
+* with question+code by WillyCornbread and solution+code given by Sly_cardinal
+*/
+               public static function drawCPDirectedCurves(g:Graphics, 
anchorPoints:Array):void
+               {
+                       // clear old line and draw new / begin fill
+                       g.clear();
+                       g.lineStyle(0.5, 0, 1);
+                       g.beginFill(0x0099FF,.1);
+                       
+                       //move to starting anchor point
+                       var startX:Number = anchorPoints[0].x;
+                       var startY:Number = anchorPoints[0].y;
+                       g.moveTo(startX, startY);
+                       
+                       // Connect the dots
+                       var p0:Point = new Point(startX, startY);
+                       var p2:Point;
+                       
+                       var numAnchors:Number = anchorPoints.length;
+                       for (var i:Number=1; i<numAnchors; i++) {
+                               
+                               p2 = new Point(anchorPoints[i].x, 
anchorPoints[i].y);
+                               
+                               // curve to next anchor through control
+                               //var b1:Point = new 
Point(controlPoints[i].x,controlPoints[i].y);
+                               var b1:Point = new 
Point(anchorPoints[i].x,anchorPoints[i].y);
+                               var p1:Point = derivePoint(p0, b1, p2);
+                               
+                               g.curveTo(p1.x, p1.y, p2.x, p2.y);
+                               
+                               p0 = p2;
+                               
+                       }
+                       // Close the loop - not necessarys
+                       
//g.curveTo(controlPoints[0].x,controlPoints[0].y,startX,startY);
+}

Modified: cytoscapeweb/branches/gsoc2010/gbeb/src/GBEBView.as
===================================================================
--- cytoscapeweb/branches/gsoc2010/gbeb/src/GBEBView.as 2010-08-14 23:51:18 UTC 
(rev 21390)
+++ cytoscapeweb/branches/gsoc2010/gbeb/src/GBEBView.as 2010-08-15 15:51:26 UTC 
(rev 21391)
@@ -121,7 +121,7 @@
                                                                
//_vis.operators.add(new ColorEncoder("index", "edges", "lineColour"))
                                                                
 //                             _vis.operators.add(new Labeler("data.name"));
-                _vis.operators.add(new GBEBRouter(_bounds, 80 , 0.95));
+                _vis.operators.add(new GBEBRouter(_bounds, 30 , 0.95));
                 trace("GBEBView: how many times GBEBView called the 
GBEBRouter? " + addEventCounter++);
                 // 
############################################################## 
                                

Modified: cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/util/GeometryUtil.as
===================================================================
--- cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/util/GeometryUtil.as   
2010-08-14 23:51:18 UTC (rev 21390)
+++ cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/util/GeometryUtil.as   
2010-08-15 15:51:26 UTC (rev 21391)
@@ -307,6 +307,34 @@
                        return p1;
                }
                
+               
+               
+               
+               /**
+                * Source: 
http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
+               */
+               public static function segmentDistToPoint(segA:Point, 
segB:Point, p:Point):Number
+               {
+                       var p2:Point = new Point(segB.x - segA.x, segB.y - 
segA.y);
+                       var something:Number = p2.x*p2.x + p2.y*p2.y;
+                       var u:Number = ((p.x - segA.x) * p2.x + (p.y - segA.y) 
* p2.y) / something;
+                       
+                       if (u > 1)
+                               u = 1;
+                       else if (u < 0)
+                               u = 0;
+                       
+                       var x:Number = segA.x + u * p2.x;
+                       var y:Number = segA.y + u * p2.y;
+                       
+                       var dx:Number = x - p.x;
+                       var dy:Number = y - p.y;
+                       
+                       var dist:Number = Math.sqrt(dx*dx + dy*dy);
+                       
+                       return dist;
+               }
+               
 
        } //end of class
 }
\ No newline at end of file

Added: cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/util/Pathfinder.as
===================================================================
--- cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/util/Pathfinder.as             
                (rev 0)
+++ cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/util/Pathfinder.as     
2010-08-15 15:51:26 UTC (rev 21391)
@@ -0,0 +1,322 @@
+package gbeb.util
+{
+       import flare.vis.data.Data;
+       import flare.vis.data.EdgeSprite;
+       
+       import flash.geom.Point;
+       import flash.geom.Rectangle;
+       
+       /**Pseudo Code for pathtraversal, inspired by A* algorithm. This 
algorithm has:
+        * - modified cost calculation function that takes into accountthe 
angles of the edges
+        *       as well as the perpendicular distance of the nodes(vertices) 
to the original edge
+        * - to transversed complete graphs generated from the set by all the 
participating nodes
+        *   hence has to use a heuristic function (and maybe dynamic 
programing) to improve run time
+        * 
+        * Idea:
+        *              1) Get the set of nodes in which the edge can 
transverse across, WayPoints.
+        *                              WayPoints = {nodes that are control 
points of the edge} + {nodes that are within the 'search zone'}
+        *              2) Although conceptually the idea is to create complete 
graphs, there is no need to 
+        *                      in exhaustively search through all 
possibilities.
+        *                                      - Initialize = Define start 
node as the closest and have the same direction as the original edge
+        *                                              Define end node 
similarly.
+        *                                      a) During stepping (moving 
through the graph), we would just step through the top 10
+        *                                      or less nodes in terms of 
search quality.
+        *                                      The search quality equation is 
given by:  Q = DistanceCost - Q(angle) - Q (distance)  
+        *                                      b) We would eliminate nodes 
that are further than 125% of the current node to reduce the search space
+        *                                      c) Repeat a and b until there 
is a path from start node to end node. 
+        *                                      d) Draw the Path
+        *                                      e) ?Smooth
+        *              Repeat for all dataEdges. 
+        * 
+        * */
+       
+       public class Pathfinder
+       {
+               private var _data:Data;
+               private var _mesh:Object;
+               private var _maxDis:Number;
+               
+               //for Kmeans alt
+               private var _CPClusters:Array;
+               private var _centroidArray:Array = [];
+               
+               public function Pathfinder()
+               {
+               }
+               
+               //This public function is exposed to allow call only after all 
the required steps are done. 
+               public function pathfind(data:Data, mesh:*, bounds:Rectangle)
+               {
+                               _data = data;
+                               _mesh = mesh;
+                               _maxDis = 
GeometryUtil.calculateDistanceBetweenPoints(bounds.topLeft, bounds.bottomRight);
+                               
+                               Kmeans_Pathfinding2_Preprocessing(_mesh.CP);
+                               _data.edges.visit(_pathfind);
+                               
+                               
+               }
+               
+               //This function takes in an EdgeSprite and finds the 
appropriate path for the edge by first setting up 
+               //a search space to find all the neighbouring nodes that it can 
pass through and use a heuristic pathfinding algorithm
+               //to generate a path that fits the quality citeria for the 
curve.
+               private function _pathfind(edge:EdgeSprite):void
+               {
+                       var searchSpace:Array = generateSearchSpace(_mesh.CP, 
edge);
+                       var searchSpaceTrace:String = ""; //debug
+                       
+                       
+                       edge.lineWidth *= 0.5; edge.lineAlpha = 0.5;
+                       
+                       //kmeans_Pathfinding(edge, searchSpace);
+                       Kmeans_Pathfinding2(edge);
+                       
+                       //AStar_pathfindingAlgrithm(edge, searchSpace);
+                       //trace("Pathfinder: " + e.source.data["name"] + " | " 
+ e.target.data["name"]);
+                       //trace("Search Space: " + searchSpace.length);
+                       /*for each (var p:Point in searchSpace) //debug loop
+                       {
+                               searchSpaceTrace += p.toString() + " | ";
+                       }
+                       trace(searchSpaceTrace); */
+               }
+               
+               //Get the set of nodes in which the edge can transverse across, 
WayPoints.
+               //                              WayPoints = {nodes that are 
control points of the edge} + {nodes that are within the 'search zone'}
+               private function generateSearchSpace(CPset:Array, 
edge:EdgeSprite):Array
+               {
+                       var searchSpace:Array = [];
+                       var CPArrayFromEdge:Array = 
edge.props.$controlPointsArray;
+                       var s:Point = new Point(edge.source.x, edge.source.y);
+                       var t:Point = new Point(edge.target.x, edge.target.y);
+                       var angle:Number = Math.PI / 6;
+                       var maxSearchDist:int = getMaxSearchDist(s, t, angle); 
//stores the maximum search distance for nodes that are not already on the 
edgeSprite
+       
+                       //should i return here if there are no contol points?
+                       
+                       //adds CP by inclusive addition
+                       for each (var p:Point in CPset)
+                       {
+                                       if(checkSearchSpace(p, t, s, 
maxSearchDist)) searchSpace.push(p);       
+                                       //trace("Pathfinder: Hi " + 
CPset.length, maxSearchDist);                       
+                       }
+       
+                       trace("Pathfinder: GSP: searchSpace.length: " + 
searchSpace.length, "maxSearchDist: " + maxSearchDist, edge.name);
+                       if(CPArrayFromEdge == null) return searchSpace;
+
+                       
+                       for each(var p:Point in CPArrayFromEdge)
+                       {
+                               if(searchSpace.indexOf(p) == -1) 
searchSpace.push(p);
+                       }
+                       
+                       trace("Pathfinder: GSP (After): searchSpace.length: " + 
searchSpace.length, edge.name);
+                       
+                       return searchSpace;
+               } 
+               
+               // Checks if a particular CP from the CPset should be included 
in the search space base on its distance to the 
+               // source and target node of the EdgeSprite: The search space 
is a semi-circle in shape.
+               private function checkSearchSpace(currNode:Point, s:Point, 
t:Point, maxDis:int):Boolean
+               {
+                       var c:Point = new Point(currNode.x, currNode.y); 
//current point
+                       var dis:int = 
Math.floor(GeometryUtil.calculateDistanceBetweenPoints(c, s) + 
Math.floor(GeometryUtil.calculateDistanceBetweenPoints(c, t)));
+                       //trace("Pathfinder: dis: " + dis + " | Max Dis: " + 
maxDis);
+                       return ( dis < maxDis ? true : false);
+               }               
+               
+               // Returns the boundary distance of the search space. The 
further the source and target nodes are apart, 
+               // the larger the boundary.
+               private function getMaxSearchDist(t:Point, s:Point, 
angle:Number):int
+               {
+                       return 
Math.floor(GeometryUtil.calculateDistanceBetweenPoints(s, t) * Math.tan(angle) 
* 2 );
+               }
+               
+               // Astar is a pathfinding algorithm...
+               private function AStar_pathfindingAlgrithm(edge:EdgeSprite, 
searchSpace:Array):void
+               {
+                       var debugString:String = ""; //debug
+                       var ctrl:Array = edge.props.$controlPointsArray;
+                       var curr:Point = new Point(edge.source.x, 
edge.source.y); 
+                       var end:Point = new Point(edge.target.x, 
edge.target.y); 
+                       var selectedPoint:int = -1;
+                       var wayPoints:Array = []; //stores in order the final 
path of the edgeSprite
+
+                                       
+                       if(ctrl == null) return;        
+                       edge.props.$controlPointsArray = searchSpace;
+                       sortCPByDistance(edge);
+                       
+                       trace("Pathfinding: Test: " + (searchSpace.length == 
edge.props.$controlPointsArray.length) + " | ctrl.length: " + ctrl.length );
+                       trace(edge.props.$controlPointsArray.length);
+                       
+                       while(Math.abs(curr.x - end.x) > 0.1 || Math.abs(curr.y 
- end.y) > 0.1) //Just in case there is some floating points mismatch
+                       {
+                               for(var i:int = 0; i < searchSpace.length; i++)
+                               {
+                                       
+                               }
+                               
+                       }
+                       
+               }
+               
+               
+               //private test2
+               //should i include start and end in kmeans?
+               private function kmeans_Pathfinding(edge:EdgeSprite, 
searchSpace:Array):void
+               {
+                       var ctrl:Array = edge.props.$controlPointsArray;
+                       var curr:Point = new Point(edge.source.x, 
edge.source.y); 
+                       var end:Point = new Point(edge.target.x, edge.target.y);
+                       var wayPointsSet:Array; // Stores the sets of way point 
path after kmeans. 
+                       var wayPoints:Array = []; //stores in order the final 
path of the edgeSprite
+                       
+                       if(searchSpace.length == 0) return;     
+                       
+                       wayPointsSet = GeometryUtil.kmeans(searchSpace);
+                       
+                       for each (var cluster:Array in wayPointsSet)
+                       {
+                               if(cluster[0] != null) 
wayPoints.push(cluster[0]);
+                               //trace("Pathfinder: tracing clusters: " + 
cluster[0]);
+                       }
+                       
+                       trace("Pathfinder: KmeansPF: WayPoints.length: " + 
wayPoints.length);
+                       
+                       edge.props.$controlPointsArray = wayPoints;
+                       sortCPByDistance(edge);
+                       
+               }
+               
+               //some pre-processing such that the CP forms clusters
+               private function 
Kmeans_Pathfinding2_Preprocessing(CPSet:Array):void
+               {
+                       _CPClusters = GeometryUtil.kmeans(CPSet);
+                       
+                       for (var i:int = 0; i < _CPClusters.length; i++)
+                       {
+                               
_centroidArray.push(GeometryUtil.findCentroidFromPoints(_CPClusters[i]));
+                       }               
+                       trace("Pathfinding: _centroidArray.length: " + 
_centroidArray.length);
+               }
+               
+               //alternative kmeans_pathfinding
+               private function Kmeans_Pathfinding2(edge:EdgeSprite):void
+               {
+                       var ctrl:Array = edge.props.$controlPointsArray;
+                       var newCtrl:Array = [];
+                       if(ctrl == null) return;
+                       
+                       for each(var p:Point in ctrl)
+                       {
+                               var closetDist:Number = Number.MAX_VALUE;
+                               var distToCentroid:Number = -1;
+                               var tempCentroid:Point = null;
+                               
+                               //check which cluster is it nearest to
+                               for each(var centroid:Point in _centroidArray)
+                               {
+                                       distToCentroid = 
GeometryUtil.calculateDistanceBetweenPoints(p, centroid);
+                                       if(distToCentroid == closetDist)
+                                       {
+                                               //search the array and find out 
which cluster does the point belong to
+                                       }
+                                       if(distToCentroid < closetDist)
+                                       {
+                                               closetDist = distToCentroid;
+                                               tempCentroid = centroid;
+                                       }
+                               }
+                               
+                               if(tempCentroid != null && 
newCtrl.indexOf(tempCentroid) == -1) newCtrl.push(tempCentroid);
+                       }
+                       
+                       edge.props.$controlPointsArray = newCtrl;
+                       sortCPByDistance(edge);
+               }
+               
+               
+               public function sortCPByDistance(e:EdgeSprite):void
+               {
+                       var ctrl:Array = e.props.$controlPointsArray;
+                       if(ctrl == null) return;        
+                       
+                       var sourceNode:Point = new Point(e.source.x, 
e.source.y); //casting source node as mesh modes
+                       var targetNode:Point = new Point(e.target.x, 
e.target.y);
+                       var swapArray:Array = [];
+                       var disSourceTarget:Number = 
GeometryUtil.calculateDistanceBetweenPoints(sourceNode, targetNode);
+                       var distance:String = ""; //debug
+                       
+                       //trace("GBEBRouter: Bubble sorting CP by Distance...", 
e.name);
+                       for each (var p:Point in ctrl)
+                       {
+                               if( p == null){
+                                       ctrl.splice(ctrl.indexOf(p), 1); 
//trace("A null node has been spliced");
+                               } 
+                       }
+                       ctrl = bubbleSortPointsArray(ctrl, sourceNode);
+                       
+                       
+                       /*for each (var p:Point in ctrl) //debug
+                       {
+                       distance += " " + 
GeometryUtil.calculateDistanceBetweenPoints(sourceNode, p);
+                       } */
+                       
+                       //trace("GBEBRouter: BubbleSort - Array trace: " + 
distance );//+ distance, e.source.data["name"], e.target.data["name"]);
+                       
+                       for(var i:int = 0; i < ctrl.length; i++)
+                       {
+                               
+                               var disTargetP:Number = 
GeometryUtil.calculateDistanceBetweenPoints(targetNode, ctrl[i]);
+                               if(disTargetP > disSourceTarget)
+                               {
+                                       swapArray.push(ctrl[i]);
+                                       ctrl.splice(ctrl.indexOf(i), 1);
+                               }
+                       }
+                       
+                       swapArray = bubbleSortPointsArray(swapArray, 
targetNode, false);
+                       
+                       for each (var p:Point in swapArray) 
+                       {
+                               ctrl.unshift(swapArray.shift()); 
+                               distance += " " + 
GeometryUtil.calculateDistanceBetweenPoints(sourceNode, p); //debug
+                       }
+                       //trace("GBEBRouter: BubbleSort - Swap Array trace: " + 
distance, e.source.data["name"], e.target.data["name"]);
+                       
+               }
+               
+               // takes in an array and result a sorted arraying in increasing 
distance away from target point.
+               private function bubbleSortPointsArray(a:Array, 
targetPoint:Point, increasing:Boolean = true):Array
+               {
+                       var currDist:Number; var nextDist:Number; var temp:*;
+                       for (var i:int = 0; i < a.length; i++)
+                       {
+                               for (var j:int = 0; j < a.length - i - 1; j++)
+                               {
+                                       currDist = 
GeometryUtil.calculateDistanceBetweenPoints(targetPoint,a[j]);
+                                       nextDist = 
GeometryUtil.calculateDistanceBetweenPoints(targetPoint,a[j + 1]);
+                                       if(increasing)
+                                       {
+                                               if(currDist > nextDist)
+                                               {
+                                                       temp = a[j+1]
+                                                       a[j+1] = a[j];
+                                                       a[j] = temp;
+                                               }
+                                       } else {
+                                               if(currDist < nextDist)
+                                               {
+                                                       temp = a[j+1]
+                                                       a[j+1] = a[j];
+                                                       a[j] = temp;
+                                               }
+                                       }
+                               }
+                       }
+                       return a;
+               }
+
+       } //end of class
+}
\ No newline at end of file

Added: 
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/ControlPoint.as
===================================================================
--- 
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/ControlPoint.as
                           (rev 0)
+++ 
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/ControlPoint.as
   2010-08-15 15:51:26 UTC (rev 21391)
@@ -0,0 +1,15 @@
+package gbeb.view.operator.router
+{
+       import flash.geom.Point;
+
+       public class ControlPoint
+       {
+               public var pos:Point = new Point(-1,11);
+               public var associatedDataEdges:Array = [];
+               
+               public function ControlPoint()
+               {
+                       
+               }
+       }
+}
\ No newline at end of file

Modified: 
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/GBEBRouter.as
===================================================================
--- 
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/GBEBRouter.as 
    2010-08-14 23:51:18 UTC (rev 21390)
+++ 
cytoscapeweb/branches/gsoc2010/gbeb/src/gbeb/view/operator/router/GBEBRouter.as 
    2010-08-15 15:51:26 UTC (rev 21391)
@@ -16,6 +16,7 @@
     
     import gbeb.util.GBEBInterfaceUtil;
     import gbeb.util.GeometryUtil;
+    import gbeb.util.Pathfinder;
     import gbeb.util.delaunay.Delaunay;
     import gbeb.util.delaunay.ITriangle;
     import gbeb.util.delaunay.XYZ;
@@ -38,7 +39,8 @@
         private var _meshResolution:int = 100; //Stores the resolution of the 
Mesh. defined as number of meshnodes.
         private var nonRedundantShapeIndexArray:Array = new Array(); // Stores 
Shape that actually contain meshEdges and have a general direction
         private var _grid:Array;
-        public var _mesh:Object = { nodes: [], edges: [] };
+                               private var _pathfinder:Pathfinder = new 
Pathfinder();
+        public var _mesh:Object = { nodes: [], edges: [], CP: [] }; //each 
mesh objects will store all the meshNodes, meshEdges, and ControlPoints
         
         private var _dataDisplay:DataDisplay;
         private var _bounds:Rectangle;
@@ -163,6 +165,8 @@
                                                                
//addCPDebugTrace();
                                                                
                                                                
KmeansClustering();
+                                                               
+                                                               
_pathfinder.pathfind(visualization.data, _mesh, visualization.bounds)
                 
                                                                
//addControlPointsToAll(); //normal use either this method or the one few lines 
above to add CPs
                 
@@ -178,7 +182,7 @@
                                                                        
                                                                }); */
                                                                
//data.edges.visit(GeometryUtil.changeToDerivedPoints);
-                                                               
data.edges.visit(sortCPByDistance);
+                                                               
//data.edges.visit(sortCPByDistance);
                                                                
trace("GBEBRouter has finished running. numNodes: " + _mesh.nodes.length + " | 
numEdges: " + _mesh.edges.length);
             }
         }
@@ -918,7 +922,7 @@
                                private function triangulateMesh():void
                                {
                                        var nodeCounter:int = 0; //debug
-                                       renderOriginalMeshEdges();//debug;
+                                       //renderOriginalMeshEdges();//debug;
                                        trace("GBEBRouter: Triangulation: 
_mesh.nodes.length: " + _mesh.nodes.length + " | _mesh.edges.length " + 
_mesh.edges.length);
                                        
                                        if(_mesh.nodes.length < 3) return; 
//there must be at least 3 nodes to triangulate
@@ -934,7 +938,7 @@
                                        
                                        var triangles:Array = 
Delaunay.triangulate(pointsArray);
                                        
-                                       
GBEBInterfaceUtil.drawDelaunay(triangles, pointsArray, visualization);
+                                       
//GBEBInterfaceUtil.drawDelaunay(triangles, pointsArray, visualization);
                                        
                                        _mesh.edges = 
GBEBInterfaceUtil.convertToMeshEdges(triangles, pointsArray, _mesh.nodes);
                                }
@@ -964,9 +968,9 @@
                                                
                                                if (intersectionPoint != null) {
                                                        deiPair = new Object();
-                                                       deiPair.dataEdge = 
dataEdge;
+                                                       deiPair.dataEdge = 
dataEdge;            
                                                        deiPair.ip = 
intersectionPoint;
-                                                       
meshEdge.dataEdgeIntersectionPairs.push(deiPair);
+                                                       
meshEdge.dataEdgeIntersectionPairs.push(deiPair);                               
        
                                                        ipCounter++; //debug
                                                }
                                        }                                       
@@ -999,7 +1003,7 @@
                                                        {
                                                                var pair:* = 
e.dataEdgeIntersectionPairs[ipArray.indexOf(p)]; //assumes that the index of 
ipArray and dataEdgeIntersectionPair is the same
                                                                var 
dataEdge:EdgeSprite = pair.dataEdge as EdgeSprite; 
-                                                               
+                               
                                                                var ctrl:Array 
= dataEdge.props.$controlPointsArray;
                                                                if (ctrl == 
null) dataEdge.props.$controlPointsArray = ctrl = [];
                                                                
ctrl.push(centroid);
@@ -1008,7 +1012,7 @@
                                                                dataEdge.shape 
= Shapes.BSPLINE; //Here to change curve type
                                                                
dataEdge.lineAlpha = 0.5;
                                                        }
-                                                       
+                                                               
_mesh.CP.push(centroid);                                                        
                                                }
                                        }
                                }
@@ -1040,6 +1044,13 @@
                                                                }
                                                        }
                                
+                                                       
+                               //Step 6: Pathfinding 
+                                                       private function 
updateMeshStructure():void
+                                                       {
+                                                               
+                                                       }
+                                                       
                                
         // Old         
         // Step 5. For each edge in _data, check for their intersection with 
_mesh.edge and record these 

-- 
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