Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > TinyBrain | #1010377 - web_placeNodesOnU - arrange nodes in a U shape

JavaX fragment (include)

static void web_placeNodesOnU(L<WebNode> nodes) {
  for i over nodes: {
    WebNode n = nodes.get(i);
    double phi = (i/(double) (l(nodes)-1)+1.5)*pi();
    double x = sin(phi), y = cos(phi);
    n.x = 0.5+x*0.45;
    n.y = 0.06+y*0.81;
  }
}

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1010377
Snippet name: web_placeNodesOnU - arrange nodes in a U shape
Eternal ID of this version: #1010377/7
Text MD5: 32c806889c715f6b8a73df5e9758d7e6
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-13 17:22:57
Source code size: 252 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 14 / 16
Version history: 6 change(s)
Referenced in: [show]