SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for (var i=0;i<node_set.length;i++){
  2.     var n_x = node_set[i].x;
  3.     var n_y = node_set[i].y;
  4.     if (!adj_list[i+1]){
  5.         adj_list[i+1] = [];
  6.     }
  7.     if (x <= n_x+10 && x >= n_x-10 && y <= n_y+10 && y >= n_y-10){
  8.         if (!edge_started){
  9.             s_x = n_x, s_y = n_y;
  10.             glitter(s_x, s_y);
  11.             ctx.beginPath();
  12.             ctx.moveTo(n_x, n_y);
  13.             edge_started = true;
  14.             bgn_vertex = i+1;
  15.         } else {
  16.             draw_edge(n_x, n_y);
  17.             glitter(s_x, s_y);
  18.             edge_started = false;
  19.             adj_list[bgn_vertex].push(node_set[i]["id"]);
  20.             adj_list[node_set[i].id].push(node_set[bgn_vertex-1]["id"]);
  21.         }      
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top